Support

Home Forums Event Espresso Premium Manually add Member as Event Attendee

Manually add Member as Event Attendee

Posted: September 12, 2013 at 6:15 pm


Adal Bermann

September 12, 2013 at 6:15 pm

I have seen the documentation on manually adding attendees to an event as an admin.

However when using the Members addon, this does not work well because it does not properly tie the registered user to the event ‘attendee’ registration in the database.

As a consequence, the Manage My Events shortcode does not display events that were added manually by the admin for that user.

How can me and my client do manual registrations for users and still give them access to the tools provided by the Members addon?


Adal Bermann

September 12, 2013 at 6:44 pm

Although I have not found a solution that solves this problem properly, I was able to quick-fix the situation by modifying the My Events shortcode query to filter by email instead of user ID.


Dean

September 13, 2013 at 1:00 am

Hi,

In that situation you would have to be logged in as that user and register from the front end. A Plugin called User Switching can be very useful here as it allows the admin to log into a users account with one click.

If you are not logged in as the user then the registration will not be allocated to that user.


Adal Bermann

September 13, 2013 at 5:21 pm

Hey Dean,

I went ahead and wrote a patch for this that checks for the email address of the attendee (always valid if using WP User addon and if admin adds correctly) instead of the user ID of the person who added the attendee database entry (currently showing admin instead of user). I wrote this patch after carefully studying the database structure to solve the problem immediately for my client without using more complicated plugins and workflows.

In plugins/espresso-members/my_events_page.php just replace with these lines (around line 59):

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>if ($wpdb->num_rows > 0) {
$events = $wpdb->get_results("SELECT e.id event_id, e.event_name, e.event_code, e.start_date, e.event_desc, e.display_desc, a.id attendee_id, a.event_time start_time, a.payment_status, a.payment_date, a.amount_pd, u.user_id user_id, a.registration_id, a.fname, a.lname, a.price_option, a.event_time, a.email

FROM " . EVENTS_ATTENDEE_TABLE . " a
JOIN " . EVENTS_MEMBER_REL_TABLE . " u ON u.attendee_id = a.id
JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id = u.event_id
WHERE a.email = '" . $current_user->user_email . "'");

I hope this might help your development team continue to improve this awesome plugin!


Adal Bermann

September 13, 2013 at 5:22 pm

[code language=”PHP”]
if ($wpdb->num_rows > 0) {
$events = $wpdb->get_results(“SELECT e.id event_id, e.event_name, e.event_code, e.start_date, e.event_desc, e.display_desc, a.id attendee_id, a.event_time start_time, a.payment_status, a.payment_date, a.amount_pd, u.user_id user_id, a.registration_id, a.fname, a.lname, a.price_option, a.event_time, a.email
FROM ” . EVENTS_ATTENDEE_TABLE . ” a
JOIN ” . EVENTS_MEMBER_REL_TABLE . ” u ON u.attendee_id = a.id
JOIN ” . EVENTS_DETAIL_TABLE . ” e ON e.id = u.event_id
WHERE a.email = ‘” . $current_user->user_email . “‘”);
[/code]

Pasting code here is a little dodgy… ๐Ÿ™‚


Dean

September 14, 2013 at 3:09 am

Hi,

Thanks for posting your solution! And yes the code formatting on this forum is a little dodgy ๐Ÿ˜€ pastebin is a good alternative

The support post ‘Manually add Member as Event Attendee’ 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