WordPress.org

Ready to get started?Download WordPress

Forums

Custom Background Extended
Breaking bbPress (2.6dev) (2 posts)

  1. dimitrov.adrian
    Member
    Posted 5 months ago #

    Plugin is working at all on 3.8, but when is enabled bbPress plugin stop working and error appeared

    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/tests/wpcebp3x/wp-includes/functions.php on line 3049

    When I disable the plugin, bbPress is working as expect

    https://wordpress.org/plugins/custom-background-extended/

  2. dimitrov.adrian
    Member
    Posted 5 months ago #

    I make a patch that fix that.

    custom-background-extended/admin/class-custom-backgrounds-admin.php

    We need to hook on admin_init becase the message, so need to add one more callback.

    public function __construct() {
    
    		/* Custom meta for plugin on the plugins admin screen. */
    		add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
    
    		/* If the current user can't edit custom backgrounds, bail early. */
    		if ( !current_user_can( 'cbe_edit_background' ) && !current_user_can( 'edit_theme_options' ) )
    			return;
    
    		/* Only load on the edit post screen. */
    		add_action( 'load-post.php',     array( $this, 'load_post' ) );
    		add_action( 'load-post-new.php', array( $this, 'load_post' ) );
    	}

    to

    public function __construct() {
    
    		/* Custom meta for plugin on the plugins admin screen. */
    		add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
    
    		add_action( 'admin_init', array( $this, 'attach_load_post_events' ) );
        }
    
    public function attach_load_post_events() {
    		/* If the current user can't edit custom backgrounds, bail early. */
    		if ( !current_user_can( 'cbe_edit_background' ) && !current_user_can( 'edit_theme_options' ) )
    		        return;
    
    		/* Only load on the edit post screen. */
    		add_action( 'load-post.php',     array( $this, 'load_post' ) );
    		add_action( 'load-post-new.php', array( $this, 'load_post' ) );
        }

Reply

You must log in to post.

About this Plugin

About this Topic

Tags