WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Problems filtering events with calendar shortcode (9 posts)

  1. kmhanser
    Member
    Posted 1 year ago #

    Hello,
    I am trying to display a calendar of events that are only related to a specific group (BP).

    I looked at the docs, and it seems to indicate that I can use:
    group
    Limit search to events belonging to a specific group id (BuddyPress only). Using 'my' will show events belonging to groups the logged in user is a member of.

    So I have a shortcode like this:
    [events_calendar full="1" long_events="1" group="17"]
    but I'm still getting a calendar that includes all events... I tried group_id="17" instead, and that didn't work either.

    Just for fun, I tried to limit to a specific post id using the shortcode:
    [events_calendar full="1" long_events="1" post_id="895"]
    And I'm _still_ getting a full list of events!

    What am I doing wrong? Do I need to use a direct call to the function instead of the shortcode to do what I need, or am I using the shortcode atts incorrectly?

    Thanks!

    http://wordpress.org/extend/plugins/events-manager/

  2. kmhanser
    Member
    Posted 1 year ago #

    This post follow-up edited because the comment I had made here was incorrect, and there doesn't appear to be a way to delete a post :)

    Still having trouble with the filtering though...

  3. agelonwl
    Member
    Posted 1 year ago #

    how about if you try [events_calendar full="1" long_events="1" group="my"] ?

  4. kmhanser
    Member
    Posted 1 year ago #

    Seems to have the same result, shows me all events...

  5. agelonwl
    Member
    Posted 1 year ago #

    this seems to worked fine with my test site; also, how about using http://wordpress.org/extend/plugins/wp-fullcalendar/ ?

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    what about when viewing it with another user, or a guest? it could be that you are viewing it with a user that is a member of all groups.

    btw, post_id isn't correct, you want post="895" i believe

  7. kmhanser
    Member
    Posted 1 year ago #

    I believe the user I was viewing it as was only a member of a couple groups. The problem was it was showing events that weren't associated with any group at all as well (group_id=0).

    And I'm not sure if the shortcode would support what I really wanted to do either... what I really needed was the ability to show only events that had group_id!=0 (ie, only show group events in the calendar).

    I ended up getting it working though by copying the EM_Calendar->output function into my functions.php for my site/theme, extending the EM_Calendar class with a renamed output function called output_grouponly, and then modifying it so it only outputs events that have a group_id.

    Seems to be working for what I need it to do.

    Thanks for the suggestions and assistance thought!

  8. mazzamuz
    Member
    Posted 1 year ago #

    Hi there - same issue here...would love a calendar specific to BP groups.

    so i inspected the classes

    The EM_Calendar::output() calls self::get($args);
    which then calls self::get_default_search($args);

    As per the documentation (which is a bit missleading)
    http://wp-events-plugin.com/documentation/event-search-attributes/ the documentation says EM_Calendar::output() only accepts two attributes..100% correct by get default search seems to extend this

    Now EM_Events::output(); works with group=my it also goes to self::get_default_search($args); so i just replace the self::get_default_search($args); in em-calender nad viola it worked

    $defaults = array(
    			'orderby' => get_option('dbem_events_default_orderby'),
    			'order' => get_option('dbem_events_default_order'),
    			'bookings' => false, //if set to true, only events with bookings enabled are returned
    			'status' => 1, //approved events only
    			'format_header' => '', //events can have custom html above the list
    			'format_footer' => '', //events can have custom html below the list
    			'town' => false,
    			'state' => false,
    			'country' => false,
    			'region' => false,
    			'blog' => get_current_blog_id(),
    			'private' => current_user_can('read_private_events'),
    			'private_only' => false,
    			'post_id' => false
    		);
    		if( EM_MS_GLOBAL && !is_admin() ){
    			if( empty($array['blog']) && is_main_site() && get_site_option('dbem_ms_global_events') ){
    			    $array['blog'] = false;
    			}
    		}
    		if( is_admin() ){
    			//figure out default owning permissions
    			$defaults['owner'] = !current_user_can('edit_others_events') ? get_current_user_id() : false;
    			if( !array_key_exists('status', $array) && current_user_can('edit_others_events') ){
    				$defaults['status'] = false; //by default, admins see pending and live events
    			}
    		}
    		//$atts = parent::get_default_search($defaults, $array);
    		$defaults['full'] = ($atts['full']==true) ? 1:0;
    		$defaults['long_events'] = ($atts['long_events']==true) ? 1:0;
    		return apply_filters('em_events_get_default_search', parent::get_default_search($defaults,$array), $array, $defaults);
  9. kingkong954
    Member
    Posted 7 months ago #

    Can confirm doing the same thing... for both EM_Class function and em_events_admin

    ...both are nuking the group ID in an attempt to set defaults?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic