Comments 2david started the conversationNovember 3, 2020 at 9:19pmHello Zhivko, I wonder if we can link the users who attended the event to theirs profiles? 2david repliedNovember 3, 2020 at 9:21pmhere 2david repliedNovember 4, 2020 at 6:49pmHello Zhivko,any updates? 2david repliedNovember 5, 2020 at 9:13amHello Zhivko, I wonder if we can link the users who attended the event to theirs profiles? david replied privately 894Zhivko repliedNovember 5, 2020 at 11:44amI'll check if this can be done and will let you know today. Stachethemes Developer1 Like 894Zhivko repliedNovember 5, 2020 at 2:16pmAre you talking about buddypress profile? Stachethemes Developer 2david repliedNovember 5, 2020 at 2:38pmUser pro 894Zhivko repliedNovember 5, 2020 at 2:44pmThe one in the admin panel? Stachethemes Developer 2david repliedNovember 5, 2020 at 2:48pmyes! or this one https://codecanyon.net/item/ultimate-membership-pro-wordpress-plugin/12159253 894Zhivko repliedNovember 5, 2020 at 2:49pmOr you mean the Author Page? Stachethemes Developer 894Zhivko repliedNovember 5, 2020 at 2:54pmUnfortunately the code required is not very short...Place it in your child-theme functions.php file: /** * IN CALENDAR ATTENDEES TAB PROFILE LINK */add_filter('stec_event_get_front_data', function($data) { $attendees = &$data['attendance']; if ($attendees) { foreach ($attendees as &$attendee) { $userid = $attendee->userid; if ($userid && $userid > 0) { $profile_link = get_edit_profile_url($userid); $attendee->profile_link = $profile_link; } } } return $data;});add_action('wp_footer', function() { global $post; if (!is_a($post, 'WP_Post') || !has_shortcode($post->post_content, 'stachethemes_ec')) { return; } ?> <script type="text/javascript"> (function ($) { $(function () { if (typeof $.stecExtend === 'undefined') { return; } $.stecExtend(function (m) { m.$instance.on('onEventToggleOpen', function (e, data) { setTimeout(function () { if (data.event.attendance.length > 0) { $.each(data.event.attendance, function () { if (this.profile_link && this.userid) { let $attendeeName = data.$container.find('.stec-layout-event-inner-attendance-attendee-avatar[data-userid="' + this.userid + '"]').next('p'); if ($attendeeName.find('a').length === 0) { let name = $attendeeName.text(); $attendeeName.html('<a href="' + this.profile_link + '">' + name + '</a>'); } } }); } }); }); }); }); })(window.jQuery); </script> <?php}); /** * SINGLE PAGE ATTENDEES PROFILE LINK */add_action('stec_single_wp_footer', function($event) { $profiles = array(); $attendees = $event->get_attendance(); if (!$attendees) { return; } foreach ($attendees as $attendee) { $userid = $attendee->get_userid(); if ($userid && $userid > 0) { $profile_link = get_edit_profile_url($userid); $profiles['userid-' . $userid] = array( 'id' => $userid, 'link' => $profile_link ); } } if (!$profiles) { return; } ?> <script type="text/javascript"> (function ($) { if (stecSingleEvent.attendance.length > 0) { const profiles = <?php echo wp_json_encode($profiles); ?> $.each(stecSingleEvent.attendance, function () { if (this.userid && profiles['userid-' + this.userid] && profiles['userid-' + this.userid].link) { let $attendeeName = $('.stec-layout-single-attendance-attendee-avatar[data-userid="' + this.userid + '"]').next('p'); if ($attendeeName.find('a').length === 0) { let name = $attendeeName.text(); $attendeeName.html('<a href="' + profiles['userid-' + this.userid].link + '">' + name + '</a>'); } } }); } })(window.jQuery); </script> <?php}); Stachethemes Developer 2david repliedNovember 5, 2020 at 3:20pm/** * IN CALENDAR ATTENDEES TAB PROFILE LINK */add_filter('stec_event_get_front_data', function($data) { $attendees = &$data['attendance']; if ($attendees) { foreach ($attendees as &$attendee) { $userid = $attendee->userid; if ($userid && $userid > 0) { $profile_link = get_edit_profile_url($userid); $attendee->profile_link = $profile_link; } } } return $data;});add_action('wp_footer', function() { global $post; if (!is_a($post, 'WP_Post') || !has_shortcode($post->post_content, 'stachethemes_ec')) { return; } ?> 2david repliedNovember 5, 2020 at 5:15pmOr you mean the Author Page?YES :=) and sorry but it is not working 894Zhivko repliedNovember 5, 2020 at 5:53pmThen the code should look like this: /** * IN CALENDAR ATTENDEES TAB PROFILE LINK */add_filter('stec_event_get_front_data', function($data) { $attendees = &$data['attendance']; if ($attendees) { foreach ($attendees as &$attendee) { $userid = $attendee->userid; if ($userid && $userid > 0) { $profile_link = get_author_posts_url($userid); $attendee->profile_link = $profile_link; } } } return $data;});add_action('wp_footer', function() { global $post; if (!is_a($post, 'WP_Post') || !has_shortcode($post->post_content, 'stachethemes_ec')) { return; } ?> <script type="text/javascript"> (function ($) { $(function () { if (typeof $.stecExtend === 'undefined') { return; } $.stecExtend(function (m) { m.$instance.on('onEventToggleOpen', function (e, data) { setTimeout(function () { if (data.event.attendance.length > 0) { $.each(data.event.attendance, function () { if (this.profile_link && this.userid) { let $attendeeName = data.$container.find('.stec-layout-event-inner-attendance-attendee-avatar[data-userid="' + this.userid + '"]').next('p'); if ($attendeeName.find('a').length === 0) { let name = $attendeeName.text(); $attendeeName.html('<a href="' + this.profile_link + '">' + name + '</a>'); } } }); } }); }); }); }); })(window.jQuery); </script> <?php});/** * SINGLE PAGE ATTENDEES PROFILE LINK */add_action('stec_single_wp_footer', function($event) { $profiles = array(); $attendees = $event->get_attendance(); if (!$attendees) { return; } foreach ($attendees as $attendee) { $userid = $attendee->get_userid(); if ($userid && $userid > 0) { $profile_link = get_author_posts_url($userid); $profiles['userid-' . $userid] = array( 'id' => $userid, 'link' => $profile_link ); } } if (!$profiles) { return; } ?> <script type="text/javascript"> (function ($) { if (stecSingleEvent.attendance.length > 0) { const profiles = <?php echo wp_json_encode($profiles); ?> $.each(stecSingleEvent.attendance, function () { if (this.userid && profiles['userid-' + this.userid] && profiles['userid-' + this.userid].link) { let $attendeeName = $('.stec-layout-single-attendance-attendee-avatar[data-userid="' + this.userid + '"]').next('p'); if ($attendeeName.find('a').length === 0) { let name = $attendeeName.text(); $attendeeName.html('<a href="' + profiles['userid-' + this.userid].link + '">' + name + '</a>'); } } }); } })(window.jQuery); </script> <?php});Make sure you've placed it in your active theme functions.php file. And clear your browser cache on the calendar page (ctrl + f5 on chrome).Also check your browser console (F12 on chrome) for javascript errors just in case. Stachethemes Developer 2david repliedNovember 6, 2020 at 2:02amTHANKS !!!!!!!!! it works great 1 Like Sign in to reply ...
Hello Zhivko,
I wonder if we can link the users who attended the event to theirs profiles?
here
Hello Zhivko,
any updates?
Hello Zhivko,
I wonder if we can link the users who attended the event to theirs profiles?
I'll check if this can be done and will let you know today.
Stachethemes Developer
Are you talking about buddypress profile?
Stachethemes Developer
User pro
The one in the admin panel?
Stachethemes Developer
yes!
or this one https://codecanyon.net/item/ultimate-membership-pro-wordpress-plugin/12159253
Or you mean the Author Page?
Stachethemes Developer
Unfortunately the code required is not very short...
Place it in your child-theme functions.php file:
Stachethemes Developer
/** * IN CALENDAR ATTENDEES TAB PROFILE LINK */
add_filter('stec_event_get_front_data', function($data) { $attendees = &$data['attendance']; if ($attendees) { foreach ($attendees as &$attendee) { $userid = $attendee->userid; if ($userid && $userid > 0) { $profile_link = get_edit_profile_url($userid); $attendee->profile_link = $profile_link; } } } return $data;
});
add_action('wp_footer', function() { global $post; if (!is_a($post, 'WP_Post') || !has_shortcode($post->post_content, 'stachethemes_ec')) { return; } ?>
Or you mean the Author Page?
YES :=)
and sorry but it is not working
Then the code should look like this:
Make sure you've placed it in your active theme functions.php file.
And clear your browser cache on the calendar page (ctrl + f5 on chrome).
Also check your browser console (F12 on chrome) for javascript errors just in case.
Stachethemes Developer
THANKS !!!!!!!!! it works great