• Resolved jeffturcotte

    (@jeffturcotte)


    This is a bug report with a potential fix.

    In my multisite configuration, when attempting to set the Language (or any field) under the MultilingualPress tab within Network Admin > Sites > Edit Site, the behavior appears broken. Upon clicking “Save Changes,” the fields are always changed on the “main/first” site with an id of 1 and not the site actually being edited.

    I tracked this down to code within Mlp_Network_Site_Settings_Controller. The function get_blog_id() only gets the correct blog id with GET requests while updating site settings happens with a POST with no query params to /wp-admin/admin-post.php. When no site id is found, the function defaults to get_current_blog_id(), which in the Network Admin panel, is almost always 1.

    I fixed this issue with the following patch to Mlp_Network_Site_Settings_Controller.

    	
    /**
     * @return int
     */
    private function get_blog_id() {
    
    	$blog_id = absint( filter_input( INPUT_GET, 'id' ) );
    
    	if ($blog_id === 0) {
    		$blog_id = absint( filter_input( INPUT_POST, 'id' ) );
    	}
    
    	return $blog_id ? $blog_id : get_current_blog_id();
    }
    

    If the site id doesn’t exist within GET, it will look in the POST.

    Thanks.

    • This topic was modified 7 years, 6 months ago by jeffturcotte.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support dinamiko

    (@dinamiko)

    Hi jeffturcotte,

    Thanks for reporting about the issue. I’m able to reproduce it, we’ll release the fix ASAP.

    Cheers,
    Emili

    Hallo,
    wenn ich alles richtig übersetzt habe, dann habe ich das gleiche Problem.
    Multisite mit Unterverzeichnissen und Domainmapping.
    Webseite 1: meineseite.de
    Webseite 2: mysite.com
    Wenn ich in der Netzwerkverwaltung bei Website bearbeiten im Reiter MulilingualPress die Sprache der ersten (Haupt-) Webseite die Sprache auf Deutsch stelle … funktioniert.
    Wenn ich die bei der 2. Webseite (mysite.com) die Sprache auf Englisch stelle und speichere, dann ändert sich die Spracheinstellung bei der 1. Webseite (meineseite.de) in Englisch. Bei der 2. Webseite springt es wieder auf „Sprache wählen“.

    Hi there,

    we just fixed this, and a release will follow soonish.

    Thanks for reporting this!

    Cheers,
    Thorsten

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot set language in Edit Site view’ is closed to new replies.