Support

Home Forums Event Espresso Premium User Integration – Table Data Stored on User Record

User Integration – Table Data Stored on User Record

Posted: June 28, 2018 at 2:44 pm


BoostersInABox

June 28, 2018 at 2:44 pm

Is there any way to edit the data that is passed in a data table to the user record? (admin-primary-mbox-tbl) We would like to see the event date in the table so that we don’t have to click on the Event Name every time to find out which date they attended. Thanks so much!


Josh

  • Support Staff

June 28, 2018 at 3:59 pm

Hi,

Yes there is a way and it involves adding some custom PHP code to your site. To be clear though, this does not involve making direct edits to the EE4 core plugin, and it does require maintaining the customizations because a template file will be overridden.

The basic outline of how to make this happen is as follows:
1) Make a copy of the attendee_registrations_main_meta_box.template.php template and place that copy into your WP child theme or your own custom plugin
2) Use the filter hook from display_template() so Event Espresso knows to use your custom template
For example, if your custom template is located in your own little plugin, the following code would point to your template:

add_filter(
    'FHEE__EEH_Template__display_template__template_path',
    'my_custom_attendee_registrations_main_meta_box_path'
);
function my_custom_attendee_registrations_main_meta_box_path($path) {
    if($path == REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php') {
        $path = plugin_dir_path(__FILE__) . '/attendee_registrations_main_meta_box.template.php';
    }
    return $path;
}

3) Make edits to the template so it displays the event date. One way to get the date that’s related to their registration is:
$registration->get_earliest_related_datetime()->get_pretty('DTT_EVT_start')


BoostersInABox

July 2, 2018 at 2:48 pm

Josh,
This is OUTSTANDING! Thank you very much!!

I have done it and it works. Quick other question, Is there a way to drop the time off of the datetime field?


BoostersInABox

July 2, 2018 at 3:35 pm

I thought I had done it. 🙂 Once I hit re-fresh, it went back to the normal template. Are you sure I don’t need to make a copy of the template:
eea-wp-users-registrations-table.template

And use that instead?


Josh

  • Support Staff

July 2, 2018 at 7:53 pm

Maybe you can clarify exactly which table view you’re looking to customize.

Can you describe in more detail beyond “Is there any way to edit the data that is passed in a data table to the user record? (admin-primary-mbox-tbl)”?


BoostersInABox

July 4, 2018 at 12:23 pm

It is the table view on the admin WP user screen. I assume the data (view of) is passed by the wp-user integration add-on. On an inspect of the table in Chrome, it states the class of the table is admin-primary-mbox-dv.


Josh

  • Support Staff

July 4, 2018 at 12:42 pm

You’ll find that many table classes within the WP admin will have
admin-primary-mbox-dv. That’s really not a means of identification.

The code/instructions I gave you are for modifying the list of events within the individual Contact records found in Event Espresso > Registrations > Contact List. If you also/instead want to override the template for the registrations list table displayed on user profile page, you’ll copy over the eea-wp-users-registrations-table.template.php file into your custom plugin, and this code will tell the WP user add-on to look for your custom template:

function my_custom_wp_users_registrations_table_template( $template_path ) {
	if (basename( $template_path ) == 'eea-wp-users-registrations-table.template.php'){
		$template_path = plugin_dir_path(__FILE__) . '/eea-wp-users-registrations-table.template.php';
	}
	return $template_path;
}
add_filter( 'FHEE__EEH_Template__display_template__template_path', 'my_custom_wp_users_registrations_table_template' );

The support post ‘User Integration – Table Data Stored on User Record’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso