I have bought a plugin called 'User insights' and it gives all information about my users.
There is a way to show extra information about my users (from other plugins) by creating custom fields. I would like to hook it up with the Event Calender, for instance: how many times a user attended an event.
I couldn't find anything/ meta keys (yet) in mysql database....
Thank you so much! Only one more question... How do I place this code into/ get this output on my Wordpress site? I would like to know more about coding I just never find the time ;-)
Ok, think I did it: used a code snippet for the function and inserted the php code (via php plugin) on a page! Is there a way to show them in a different order: user ID starting from low to high? And get the First and Last name in there too?
Hi,
I have bought a plugin called 'User insights' and it gives all information about my users.
There is a way to show extra information about my users (from other plugins) by creating custom fields. I would like to hook it up with the Event Calender, for instance: how many times a user attended an event.
I couldn't find anything/ meta keys (yet) in mysql database....
Can you help me out?
Thanks!
Jochem
Hi,
The attendance data in mysql is OpenSSL encrypted and can't be read directly.
I've written a small function that obtains attendance data for each users:
function calendar_get_users_attendances() { $users_attendances = array(); $attended_events = \Stachethemes\Stec\Events::get_events(array('meta_query' => array(
'key' => 'attendance',
'value' => '',
'compare' => '!='
)
)); foreach ($attended_events as $event) {
$attendees = $event->get_attendance(true);
foreach ($attendees as $attendee) { if (is_nan($attendee->get_userid())) {
continue;
} $user_attend_dates = array(); foreach ($attendee->get_status() as $date => $status) {
if (1 === $status) {
$user_attend_dates[] = $date;
}
} $users_attendances[$attendee->get_userid()][$event->get_id()] = array(
'event_id' => $event->get_id(),
'event_title' => $event->get_title(),
'count' => count($user_attend_dates),
'attend_dates' => implode(', ', $user_attend_dates)
);
}
} return $users_attendances;
}
Example:
will return something like this:
Here's example how to process this data:
will return:
I hope this helps you out.
Stachethemes Developer
Thank you so much! Only one more question... How do I place this code into/ get this output on my Wordpress site? I would like to know more about coding I just never find the time ;-)
High regards,
Jochem
Ok, think I did it: used a code snippet for the function and inserted the php code (via php plugin) on a page! Is there a way to show them in a different order: user ID starting from low to high? And get the First and Last name in there too?
Try this example:
Stachethemes Developer
Great! Thank you so much!
And how can I show all events and the members (by first and last name) attending these events? Plus a total count.
High regards,
Jochem
$events = \Stachethemes\Stec\Events::get_events(); $html_ar = array(); foreach ($events as $event) { $html_ar[] = sprintf('Event title: %s', $event->get_title());
$attendees = $event->get_parsed_attendees(); foreach ($attendees as $attendee) {
$html_ar[] = sprintf('Attendee name: %s', $attendee->name);
} $html_ar[] = sprintf('Total attendees: %d', count($attendees)); $html_ar[] = '<hr>';
}
echo implode('<br>', $html_ar);
Stachethemes Developer