WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Export role in CSV (9 posts)

  1. paulverhulst
    Member
    Posted 1 year ago #

    Hello,

    I was wondering if it is possible to add the user Role to a CSV export?

    When you look at an users profile, you can see phone data. Next to this information shows the italic word: (Events Manager), wich gives me the information that i can export this data.

    Can someone help me to export the user Role data?

    Kind regards,

    Paul

    http://wordpress.org/extend/plugins/events-manager/

  2. paulverhulst
    Member
    Posted 1 year ago #

    I found the file which i have to edit. It's the em-bookings-table.php.
    Here's a list of data you can export:

    $this->cols_template = apply_filters('em_bookings_table_cols_template', array(
    'user_name'=>__('Name','dbem'),
    'event_name'=>__('Event','dbem'),
    'event_date'=>__('Event Date(s)','dbem'),
    'event_time'=>__('Event Time(s)','dbem'),
    'user_email'=>__('E-mail','dbem'),
    'dbem_phone'=>__('Phone Number','dbem'),
    'booking_spaces'=>__('Spaces','dbem'),
    'booking_status'=>__('Status','dbem'),
    'booking_date'=>__('Booking Date','dbem'),
    'role'=>__('Role','dbem'),

    When i replace the last line (see above) it shows in the export settings, but the export don't give me the information. (the title Role shows in the export, but the cells are empty)

    Anyone know how to fix this?

  3. agelonwl
    Member
    Posted 1 year ago #

    can I know what do you mean by user Role?

  4. paulverhulst
    Member
    Posted 1 year ago #

    Sure,

    When people subscribe to the site, you can give them a role, such as: subscriber, editor, etc.
    You can see it when you to to users, and select one.

  5. agelonwl
    Member
    Posted 1 year ago #

    try to see function get_row() then add a new else if and then add a function similar to this http://wordpress.org/support/topic/get-a-users-role-by-user-id?replies=20

    note: this is not update safe OR try to hook into em_bookings_table_rows_col_* filter instead (below function get_row())

  6. paulverhulst
    Member
    Posted 1 year ago #

    Hmm..
    Maybe this is too difficult for me..

    I tried to replace 'dbem_phone' with 'role'.
    This looks like:

    L83: 'role'=>__('Role','dbem'),
    L521: }elseif($col == 'role'){
    L522: $cols[] = $EM_Booking->get_person()->role;

    But this won't work.
    I don't know what they are talking about in the link you send me. It's not in php, is it?

    (thanks for the quick response)

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    Yes, it's a bit more complicated than that. First, you'd need to add some more php there to get the role of the user than what you did on l522

    also, you should be using the filter provided around those lines to add new collumns (that's what we do in Pro for example)

  8. paulverhulst
    Member
    Posted 1 year ago #

    Hi all,

    I was wondering if someone knows an easier solution for my problem?
    There has to be an easier solution, because telephone numbers can be exported.

    Can someone help me please?

    KR, Paul

  9. paulverhulst
    Member
    Posted 1 year ago #

    Hi all,

    I was wondering if someone knows an easier solution for my problem?
    There has to be an easier solution, because telephone numbers can be exported.

    Can someone help me please?

    KR, Paul

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    you need to code in some hooks to add new data, that's the easiest way.

    it's all done in classes/em-bookings-table.php, particularly in __construct and get_rows()

    in __construct, you hook into the booking_actions table and add to $this->cols and $this->cols_template

    and then in get_rows you hook into this bit here:
    $val = apply_filters('em_bookings_table_rows_col_'.$col, '', $EM_Booking, $this, $csv);

    where $col would be that which you added in $this->cols above.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags