• Hi,

    I am currently evaluating Multilingual Press for a project and found a bug in the Pro version. Since there is no trac available, I’m pasting the patch here.

    The notices are displayed when MPPro is installed with e.g. BBPress or BuddyPress and debugging is enabled. They look like this:

    Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /var/www/html/wordpress2/wp-includes/functions.php on line 3547
    
    Notice: bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 1.7.) in /var/www/html/wordpress2/wp-includes/functions.php on line 3547

    The Bogo multilingual plugin had the same problem and it looks like the author fixed it by delaying obtaining the current user id until after_setup_theme fired. Following that approach, I created this patch:

    --- inc/pro/user-backend-language/Mlp_User_Backend_Language.php	2015-03-03 00:10:17.429693243 +0100
    +++ patched/inc/pro/user-backend-language/Mlp_User_Backend_Language.php	2015-03-03 00:10:12.449693100 +0100
    @@ -170,6 +170,9 @@
     		if ( ! $this->active )
     			return $locale;
    
    +		if ( ! did_action( 'after_setup_theme' ) )
    +			return $locale;
    +
     		return $this->get_user_language( get_current_user_id(), $locale );
     	}

    Best,
    Markus

    https://ww.wp.xz.cn/plugins/multilingual-press/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thank you! We want to rewrite that feature anyway, because it doesn’t play so nicely with the language selector introduced in WP 4.0.

    Our complete code is now on GitHub: https://github.com/inpsyde/multilingual-press/

    We cannot wait that long with our filter, because many themes, plugins and even WordPress load their language files earlier. The backend language would not be set to the user’s preferred language at all.

    Note the we don’t call bbp_setup_current_user() or bp_setup_current_user(). These plugins do that at their own hand. So we will not try to fix their bugs in our code, that would create a very fragile dependency.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Error notices in Pro admin panel, patch included’ is closed to new replies.