hi,
I am using the following snippet to try and display a buddypress users submitted events on their profile using a custom shortcode
function custom_shortcode(){
$user_id = get_the_author_meta( 'ID' ); //returns id of user profile
return do_shortcode( '[eo_events author='.$user_id.']' ); }
add_shortcode( 'eo_custom_shortcode', 'custom_shortcode' );
the shortcode is not accepting the author artribute and is instead showing all upcoming events. Is author a valid attribute for the eo_events shortcode?

Lukas Feddern
Yes it is, you may want to check that the $user_id
is what you expect it to be.

Stephen Harris
Yes I tried with a fixed user id and it worked, need to sort out get_author_meta() then.
Thanks for your help

Lukas Feddern
Ok got this to work, just one last question. I am trying to add an error message that displays when the shortcode returns no events:
function custom_shortcode() {
$user_id = bp_displayed_user_id();
$events = do_shortcode( '[eo_events author='.$user_id.']' );
if ( empty( $events ) ) {
$events = "sorry no events yet";
}
return $events;
}
add_shortcode( 'eo_custom_shortcode', 'custom_shortcode' );
The if statement is not working . So I assume that $event is not empty even when no events are returned. I tried doing !empty() and the message displays then so can only assume this is the case. Is there a event orgnaiser function to check if a variable contains any events. I looked through the codex but couldn’t find one.
Thanks, I should be done with my continous barrage of questions when I get the site up and running.

Lukas Feddern
do_shortcode()
will return the HTML of the specified shortcode, and if event there are no events, there maybe some markup.
The [eo_events]
has a “no events” option (see: http://docs.wp-event-organiser.com/shortcodes/events-list), but you may find it easier to edit the event list template (event-organiser/templates/event-list-shortcodephp
– move it to your theme first).

Stephen Harris