WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] 'No events' error, on mobile browser only (18 posts)

  1. namwen
    Member
    Posted 1 year ago #

    I'm developing a custom mobile wordpress theme, using events manager to, well, manage events. When testing on the desktop, I get the events I'm requesting fine but on the iPhone I get the "no events" error.

    I'm using ajax to retrieve the events and then I append them where they;re supposed to go.

    my retrieval function looks like this:

    if (class_exists('EM_Events')) {
        return  EM_Events::output( array('scope'=>'future', 'array'=>false) );
    }

    This is really driving me crazy, any help would be appreciated.

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

  2. agelonwl
    Member
    Posted 1 year ago #

    did you try to use php print_r to see if it's returning any events ?

    maybe this will help - http://wp-events-plugin.com/documentation/advanced-usage/

  3. namwen
    Member
    Posted 1 year ago #

    Yeah, as I said, the events are returned when I'm using a desktop browser. It's when I'm viewing the site through mobile Safari that I get the no events error.

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    could it be you have some sort of plugin or similar that shows different content to mobile? as far as EM iis concerned, the same info is output to any request from any device

  5. namwen
    Member
    Posted 1 year ago #

    Events manager is the only active plugin. I was using a theme switcher to use the mobile theme for mobile devices, but I deactivated that and I'm using only the mobile theme right now.
    I'm really at a loss here. What's strange is that the plugin itself is working fine with my javascript and php. The ajax sends the request, the php performs the action, and the javascript is returned a value. But the value of course is "no events". So somewhere along the way, Events Manager is getting confused and not finding any of the events.

    EDIT:

    Ok, I just realized it's a permission issue. I've been logged in on the desktop ( where I can see the events ) , and not on the mobile. I can't figure out where in the settings I make all events visible? They're all set to public in the post editor.

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    if they're set to public, I'm not sure why it's hidden for guests, but at least we have something to go on now...

    can you view a single events page when not logged in? you'd be manually inputting the url here.

  7. namwen
    Member
    Posted 1 year ago #

    Yep, I can see single events on their own just fine.

  8. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    try resaving your events maybe?

    alternatively, try goig to Events > Settings > Pages > Events List/Archives > Override with Formats and setting it to 'no', does that help?

  9. namwen
    Member
    Posted 1 year ago #

    Nope. Still nothing. My Events aren't being displayed on a page anywhere; I'm just grabbing them through the EM_Events::output function and displaying them with javascript. It definitely seems to me like It's just a simple setting somewhere that we're missing...

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    looking through this thread, I'm thinking your problem must lie somwehere with the fact that something is going wrong when using your iphone compared to the desktop.

    I don't think this will be related to any EM settings since it works on desktop but not your phone. One thing that may be key... are you logged in/out on both?

    I'd also check what parameters are being sent on your iphone, maybe the search variables are getting lost/modified along the way causing no events to be found

  11. namwen
    Member
    Posted 1 year ago #

    I'm actually 99% sure the issue isn't related to the iPhone but is instead a permissions issue. I wasn't logged in when using the phone and when I logged in they appeared. Then I logged out on the desktop and they disappeared.

    I've gone through every setting in EM that could possibly be related to post permissions and haven't found anything. I've checked the formatting options and there's nothing there that would display posts based on someone logged in or out.

    I've made new posts, changed the permissions on them back and forth and still can't figure this out.

  12. namwen
    Member
    Posted 1 year ago #

    I should also note that I can see the events just fine on my desktop theme which is set up through the page feature of Events Manager, rather than a custom function. The custom function I'm using hooks into the WordPress wp_ajax_nopriv ; I wonder if that has something to do with it.

  13. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    you need both versions e.g. with and without nopriv otherwise yes only logged in users can acces ajax.

    http://codex.wordpress.org/AJAX_in_Plugins#Ajax_on_the_Viewer-Facing_Side

    I was thinking you must have reached the right script if it returned no events message but then if your JS is set to do that, then that explains it.

  14. namwen
    Member
    Posted 1 year ago #

    Yeah, I'm using both hooks. Which is what's so strange really, seeing that all the other functions that are hooking in have no problems, logged in or out.

  15. namwen
    Member
    Posted 1 year ago #

    It seems like the function doesn't have permission to execute from functions.php when a non-privileged user fires it. The function is obviously executing just fine as it doesn't throw an error, but the results it's returning are empty. That tells me that it's an issue with the permissions of the Event post-type.
    Any idea if it's possible that WordPress is blocking the function from accessing the events?

  16. namwen
    Member
    Posted 1 year ago #

    Making some progress:
    I've been digging through the class files trying to figure out where the issue is occurring and I've tracked it down to this chunk of code inside the output function in the EM_Events class :

    }else{
    			//Firstly, let's check for a limit/offset here, because if there is we need to remove it and manually do this
    			$args = apply_filters('em_events_output_args', self::get_default_search($args) );
    			$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
    			$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
    			$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:$page;
    			$args_count = $args;
    			$args_count['limit'] = false;
    			$args_count['offset'] = false;
    			$args_count['page'] = false;
    			$events_count = self::count($args_count);
    			$events = self::get( $args );
    		}

    I noticed though that if I specify the event owner in the arguments to 1 or false, I will receive those arguments no problem. This may work so long as I'm receiving all events that exist and not just events created by the administrator.

  17. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    pretty sure it's not an EM issue, because others would be having this problem too, events are by default read by anyone logged in or out, otherwise things like our demo site wouldn't work either.

  18. dradovic
    Member
    Posted 1 year ago #

    Actually specifying 'owner'=>false fixed the problem for me. However, in my case the problem only occurred when I tried to fetch the event using AJAX.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic