WordPress.org

Support

Support » Plugins and Hacks » Events Manager » [Resolved] [Plugin: Events Manager] Export role in CSV

[Resolved] [Plugin: Events Manager] Export role in CSV

  • 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/

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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?

    can I know what do you mean by user Role?

    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.

    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())

    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)

    Plugin Author Marcus

    @netweblogic

    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)

    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

    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

    Plugin Author Marcus

    @netweblogic

    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] [Plugin: Events Manager] Export role in CSV’ is closed to new replies.
Skip to toolbar