Hi there, is there any possibility to easily get a calendar or event list just for one author? I.e. if I post as a registered user with a certain username, can this be filtered?
Thanks in advance, best Frank
-
This topic was modified 10 years, 4 months ago by
Frank Herget.

Frank Herget
Hi Frank,
This isn’t currently possible for the calendar. However I’ll look into this for a future update.
As for the event list shortcode, you can do:
[eo_events author="{ID}"]
where ID is replaced by the ID of the user. Alternatively you can use author_name
instead of author
to use the author’s nicename.

Stephen Harris
Hi Stephen,
sounds great – meanwhile I managed it to get me the data sorted by author by writing an own function. Yet this update would be highly appreciated.
Thanks a lot for pointing out the solution on the shortcode 🙂
keep up the good work,
cheers
Frank

Frank Herget
Just an update to say that as of Event Organiser 2.12.0 (to be released shortly) you can do the following:
[eo_fullcalendar author=<user-id>]
or
[eo_fullcalendar author_name=<user-nicename>]
to display a calendar of a particular user’s events.

Stephen Harris
Hello Stephen,
thanks a bunch for the update 😉 Comes in handy.
cheers
Frank

Frank Herget
Looks great,
I cannot seem to have it show the logged-in user events, does the author have to be hardcoded?
Thanks
Vlad

Vladislav Gherciu
That is the case currently. There are two ways around this. Define a shortcode which just a wrapper for [eo_fullcalendar]
, but sets the author ID as appropriate.
Alternatively (and perhaps preferably) is to use the shortcode_atts_*
filter (WP 3.6.0+):
add_filter( 'shortcode_atts_eo_fullcalendar', 'my_fullcalendar_filter', 10, 3 );
function my_fullcalendar_filter( $atts, $defaults, $provided_atts ){
//If you preferred, you could check $provided_atts['author'] for a
//placeholder, e.g. %current_user_id% and replace that with the current
//user ID. Then do [eo_fullcalendar author=%current_user_id%]
if( is_user_logged_in() ){
$atts['author'] = get_current_user_id();
}
return $atts;
}
I won’t rule out supporting this in a future update, but the above example shouldn’t cause any problems should a current user placeholder be introduced.

Stephen Harris
That is the case currently. There are two ways around this. Define a shortcode which just a wrapper for [eo_fullcalendar]
, but sets the author ID as appropriate.
Alternatively (and perhaps preferably) is to use the shortcode_atts_*
filter (WP 3.6.0+):
add_filter( 'shortcode_atts_eo_fullcalendar', 'my_fullcalendar_filter', 10, 3 );
function my_fullcalendar_filter( $atts, $defaults, $provided_atts ){
//If you preferred, you could check $provided_atts['author'] for a
//placeholder, e.g. %current_user_id% and replace that with the current
//user ID. Then do [eo_fullcalendar author=%current_user_id%]
if( is_user_logged_in() ){
$atts['author'] = get_current_user_id();
}
return $atts;
}
I won’t rule out supporting this in a future update, but the above example shouldn’t cause any problems should a current user placeholder be introduced.

Stephen Harris
Thanks Stephen, I used [eo_fullcalendar author=%current_user_id%] shortcode and it worked.

Vladislav Gherciu
Just one small clarification:
The snippet you inserted above, should It be added to the functions.php from the EO package?
Thanks
Vlad

Vladislav Gherciu
No, ideally a utility package, but a theme’s functions.php will work. (See this page for details).

Stephen Harris
Thanks Stephen, again very helpful =]
Managed to sort this one out
Vlad

Vladislav Gherciu