• Resolved jbarryweb

    (@jbarryweb)


    Using Events Manager 5.3 / WordPress 3.4.2

    I am receiving a 404 error on the events page of our website. I’ve read through many other posts on this issue and have not been able to find a solution. I’ve tried:

    – Creating a new events page
    – Adjusting Permalink Slugs
    – Ensuring that the event page is selected in EM settings
    – Resetting Permalinks in WordPress
    – Resetting Events Manager
    – Disabling all other Plugins
    – Reverting to the WordPress twenty eleven theme
    – Using “define(‘EM_DISABLE_PERMALINKS’,true);”

    Changing the permalinks setting in WordPress to default corrects the issue.

    Our website is hosted in a subdomain which may be causing the issue:
    https://journalmultimedia.com/petage/index.php/calendar-of-events/

    Any help on how to correct this is much appreciated!

    https://www.ads-software.com/extend/plugins/events-manager/

Viewing 14 replies - 16 through 29 (of 29 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Global tables are only relevant with regards to listing of events, if you create an event on a subsite, it’s still a post stored on the subsite, so you shouldn’t be seeing a 404 there.

    Have you tried creating a new event with your desired MS settings already in place and then visiting that?

    Since nobody else is getting this issue atm, I still have to chalk it down to a problem on your end somewhere, I reserve going in to check things out for pro users only unless it’s a bug many ppl are getting, so there’s not much more I can say to help here.

    Hi Marcus,
    I understand that you can’t give so much free support. Maybe I’m going to buy your PRO, but somewhere in the future, I don’t need the additional features by now.
    I don’t know which WP version and setups you’re using. Maybe it’s related to WP 3.5 that’s coming out soon – the most people will get that later. And who knows how many people use exactly this MU global mode with linking to subsite.
    So we (the thread owner and me) are the first ones and waiting…
    Thanks for your support so far.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    I’ve just tested this out with 3.5RC2 and it works fine for me.

    RC3 is out today but given you had the problem already, I’m not convinced it’s an EM or WP issue, would have to dig into a site with this problem to find out more.

    Hi Marcus,
    thanks for looking into it, I didn’t expect it.
    Just a question, that I could maybe find out more myself: Did you update your existing install or did you try it with a fresh install?

    I downloaded RC3 today and updated my fresh install from yesterday, but it didn’t change the issue. It’s hard for me to think of the cause outside of EM because I used complete new and untouched WP and EM download. If it’s not EM it must be a server, php or MySQL issue.

    I tried now a print_r(get_current_blog_id()); in different places of your plugin files (yes, touched them now again…), testing on the subsite. Sometimes the output is “1”, sometimes “2” (the correct blog_id of the subsite would be “2”).
    I don’t know why this is caused exactly, but I saw this already in working with other plugins and themes. In some places I had to work with global $current_blog and $current_blog->blog_id. I guess, this is needed in your plugin, too.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    I updated the site. I’ll keep this in mind and test this again asap.

    Since you’re persistently testing, let’s try some more ??

    Try modifying this in em-functions.php

    if( !function_exists('get_current_blog_id') ){
    	/**
    	 * Substitutes the original function in 3.1 onwards, for backwards compatability (only created if not previously defined)
    	 * @return int
    	 */
    	function get_current_blog_id(){
    		global $current_site;
    		if ( ! is_multisite() )
    			return 1;
    		if( !empty($current_site->blog_id) ){
    			return $current_site->blog_id;
    		}else{
    			return 1;
    		}
    	} //for < 3.1
    }

    search for the first line on the code above as that didn’t change.

    Also, where does it output 1 and when does it output 2 (i.e. what parts of a page, event widget, list etc.)?

    Hi Marcus,
    tried this, no changes. I also tried the same with $current_blog instead of $current_site, and I even tried to force id 2 with

    function get_current_blog_id(){
    	return 2;
    }

    Then I tried it more risky and searched through all your files and replaced the get_current_blog_id() with $current_blog->blog_id, of course with calling the global before. Nothing changes! So this was not the right suggestion from me.
    Now I cleaned it with replacing all EM files with the downloaded 5.3.1 version and tried the print_r again.

    Testing on the events page (list):

    – /templates/templates/events-list.php:
    before em_locate_template(‘templates/events-search.php’,true); -> 2
    after em_locate_template(‘templates/events-search.php’,true); -> 1

    – /templates/templates/events-search.php:
    before (line 49) EM_Object::ms_global_switch(); -> 2
    after (line 49) EM_Object::ms_global_switch(); -> 1
    after (line 51) EM_Object::ms_global_switch_back(); -> 1 (stays on 1 here!)
    this is inside the categories call

    -/classes/em-object.php function ms_global_switch_back()
    taken out !is_main_site() (because we are now virtually on 1 == main_site)

    if( EM_MS_GLOBAL ){
    	restore_current_blog();
    }

    voilà: The blog_id is correctly switched back to 2, content displays correctly on the events list.
    Adding new events works correctly now.
    The 404 is still on the details page for the previous added events, but the now added event shows correctly.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Probably won’t get to it today but will test out the latest RC tomorrow on clean MS to make sure.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    OK, I’ve set up a new blank install and tested it out… you’re right!

    Thanks for your patience & persistence on this, just to let you know I’ve reproduced this so a fix should be out very soon, will let you know when it is.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Turns out this is exactly the problem and your solution is correct too. Thanks for testing and figuring this out! We’ve released 5.3.2 with the fix (it’s the only change to the plugin this time round :))

    Thanks Marcus for your wonderful plugin, I really love it and appreciate your always very fast (and most times here free!) support! It’s one of the best WordPress plugins ever ??

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Great to hear, thx again!

    Hi Marcus,
    today I recognized (with newest version 5.3.3), that the same has to be done with ms_global_switch(). Please remove the !is_main_site() here, too.

    function ms_global_switch(){
    	if( EM_MS_GLOBAL ){
    		//If in multisite global, then get the main blog categories
    		global $current_site;
    		switch_to_blog($current_site->blog_id);
    	}
    }

    If you want to reproduce it first: Try saving an event on a subsite with some sitewide categories checked. You are redirected to posts. Going back to the event edit page and removing the categories, saving: You are redirected again, the post is saved twice. On Frontend you get the same layout issues as mentioned earlier this thread.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Thanks, we have a few MS fixes to make so will test this out asap and make sure it’s in the next update (we’re on 5.3.5 now btw).

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘404 Error on Events Page caused by Permalinks’ is closed to new replies.