Skip to content

wordpress for seo conflicts with bbpress for wordpress. #565

Closed
inetbiz opened this Issue Jan 13, 2014 · 21 comments

3 participants

@inetbiz
inetbiz commented Jan 13, 2014

bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). is the error I get while having akismet, bbpress, developer plugins active from the network and testing with theme twentytwelve.

From #wordpress on freenode.net jjj is the founder of bbpress.org

[14:34] * BdNp (~BdNp@ool-18bd1234.dyn.optonline.net) has joined #wordpress
[14:35] * karmatosed (~karmatose@host81-129-131-37.range81-129.btcentralplus.com) Quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
[14:37] <tw2113> sounds like a bbpress bug
[14:38] * HariboPenguin|Of is now known as HariboPenguin
[14:38] * rootshift (~rootshift@2.26.148.242) has joined #wordpress
[14:38] * parduse (~parduse@unaffiliated/parduse) Quit (Read error: Connection reset by peer)
[14:39] * jimmyzbrb (jimmyz@2e40b2c5.skybroadband.com) Quit
[14:39] * parduse (~parduse@unaffiliated/parduse) has joined #wordpress
[14:40] * tonesfrommars (~tones_@162-239-140-57.lightspeed.irvnca.sbcglobal.net) has joined #wordpress
[14:42] <jjj> tw2113: not a bbPress bug
[14:42] <tw2113> ok
[14:42] <jjj> dprophit: some plugin is initializing the current user too soon.
[14:42] * mzki (~koza@87-207-54-178.dynamic.chello.pl) has joined #wordpress
[14:42] * cassio (~textual@24-240-74-46.dhcp.mdsn.wi.charter.com) Quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
[14:43] <jjj> Usually it comes from is_user_logged_in() or is_super_admin() or current_user_can() being called before $wp->init()
@jrfnl
jrfnl commented Jan 13, 2014

And what has this got to do with WPSEO ?

@inetbiz
inetbiz commented Jan 13, 2014

@jrfnl I don't see that you own this repo. So I'll wait to hear from them. bbpress is ten times more popular than this plugin and quite essential to content management. Sorry.

@inetbiz
inetbiz commented Jan 13, 2014

oh just in case, http://www.bbpress.org You can also find them in the footer of wordpress.org.

@inetbiz
inetbiz commented Jan 13, 2014

@jrfnl OH I see that bloody markdown hacked out all the IRC names prefaced on each line. jjj on #bbpress channel is the maintainer of bbpress plugin for wordpress. So popular that it's mentioned in the footer of wordpress.org. What jjj was saying is that this plugin calls init too soon. When the bbpress plugin also tries, it fails because wordpress for seo already called init.

@jrfnl
jrfnl commented Jan 13, 2014

@inetbiz A proper bug report would be appreciated. The current one is too sparse to do anything with. It has no indication as to what is going wrong, where it is going wrong, what the (negative) effect is of the issue or how to reproduce the supposed bug. Let alone, any indication that the issue is caused by WP SEO. Your theme or any of the other plugins installed might just as well be the cause (based on the current extremely sparse info).

Oh and if you want to post things like IRC transcripts, wrapping them in backticks (like I've now done for you) makes sure that essential info is shown. Also: it would be helpful to only have the relevant bits.

I don't see that you own this repo. So I'll wait to hear from them. bbpress is ten times more popular than this plugin and quite essential to content management. Sorry.

That's completely irrelevant.

@inetbiz
inetbiz commented Jan 13, 2014

Yes I could have used 3 backticks or hello I simply wasn't thinking. Irrelevancy is your opinion, of course. 👍 this issue.

@jrfnl
jrfnl commented Jan 14, 2014

@inetbiz I repeat:

A proper bug report would be appreciated. The current one is too sparse to do anything with. It has no indication as to what is going wrong, where it is going wrong, what the (negative) effect is of the issue or how to reproduce the supposed bug. Let alone, any indication that the issue is caused by WP SEO. Your theme or any of the other plugins installed might just as well be the cause (based on the current extremely sparse info).

With the current information, this issue should be closed as invalid/too little information.

@inetbiz
inetbiz commented Jan 14, 2014

@jrfnl I think you are just being biased from your very first post to issue #565 . I've uninstalled every plugin I have aside from akismet, bbpress and developer using theme twentytwelve. The minute I network activate THIS plugin, there is a conflict between bbpress and wordpress for SEO.

@jrfnl
jrfnl commented Jan 14, 2014

@inetbiz You can keep your personal attacks to yourself. You've been derogative towards me twice now. Please show some respect for people or at least have the decency to be courteous.

In the mean time, please answer the questions I have posted twice before.

"there is a conflict between bbpress and wordpress for SEO" is not a useful description of a problem and not helpful if you want to get this fixed.

@inetbiz
inetbiz commented Jan 14, 2014

Maybe I took your initial post as disrespectful? I've modified the issue. I am NOT a wordpress developer. IF you want to attempt to replicate the issue, install bbpress. Leave wordpress for seo inactive and try to replicate the error by installing developer and deprecated log messages. See https://bbpress.trac.wordpress.org/ticket/2309 I'm JUST stating that AFTER activating THIS module that I THEN started getting THAT error message.

@jrfnl
jrfnl commented Jan 14, 2014

Maybe I took your initial post as disrespectful?

@inetbiz It was only a question. How you took it, says something about you, not me.

I've modified the issue.

How ? I don't see any modification.

See https://bbpress.trac.wordpress.org/ticket/2309 I'm JUST stating that AFTER activating THIS module that I THEN started getting THAT error message.

At long last some useful information, even though you still don't actually give the information, but make me work for it, reading all the related linked docs.

Anyway, what it comes down to is that bbPress is showing the following error notice when WP_DEBUG is on:
Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init().

In the main thread it is basically said that bbPress is being too restrictive with this error notice and that it should be adjusted (i.e. issue with bbPress).

The notice is supposedly caused by a current user related function being called before the init action hook.

I've just searched through the whole codebase of the current WPSEO version (1.4.23) for a number of current user related functions (see list below) and have not found any which are used in functions hooked in before the init action.
This search was not exhaustive (i.e. I might have missed some functions), but so far I can't find where the issue would be coming from.

The only place where I'm not sure whether the function is called before or after the init action, is when building the sitemap, but if that's the case, then this is a non-issue as the xml sitemap is meant for robots, not humans.

All in all, my tentative conclusion is that this is a case of the bbPress warning message being too invasive.

Also, the user has not provided any real issues being caused by this. No examples at all of things not working as they should in the website. Just having the warning message show when WP_DEBUG is on, is not an issue. So it sounds like much ado about nothing.

Unless someone can give some examples of things actually going wrong and what in WP SEO might be causing this, I suggest we close this issue as invalid.

is_user_logged_in();
get_current_user_id();
get_currentuserinfo();
wp_get_current_user();
current_user_can();
current_user_can_for_blog();
get_userdata();
get_user_by();
@tobylewis

Hi, I'm also getting this error since upgrading to WPSEO 1.5.0 which occurs in the admin environment not in the front end. I realise this is low priority and is more of an annoyance than a show stopper, but it would be great to get rid of the warning.

It appears to be caused by current_user_can() in wpseo_admin_init() in /wordpress-seo/wp-seo-main.php line 262 which executes on "plugins_loaded" which comes before the "init" hook.

if ( current_user_can( 'manage_options' ) && ( $options['tracking_popup_done'] === false || $options['ignore_tour'] === false ) ) {
    add_action( 'admin_enqueue_scripts', array( 'WPSEO_Pointers', 'get_instance' ) );
}

HTH

Toby

@jrfnl
jrfnl commented Mar 11, 2014

@tobylewis Thank you for your help. I'll be sending in a pull request to fix that part. However, I'm doubtful that this is the only cause of the message as the logic was different in v1.4.23 (current_user_can() was only tested on admin_enqueue_scripts at the time) and the issue still occurred.

@jrfnl jrfnl added a commit to jrfnl/wordpress-seo that referenced this issue Mar 11, 2014
@jrfnl jrfnl Potentially fix issue #565 8f737f1
@jrfnl jrfnl added a commit to jrfnl/wordpress-seo that referenced this issue Mar 11, 2014
@jrfnl jrfnl Potentially fix issue #565, bbpress warning 62c6828
@tobylewis

Ths edit fixed the problem for bbpress and BuddyPress for me. I just moved the lines cited befor into their own function and called it from the init hook. Here is the code from line 262. It does fix it.


/*
    if ( current_user_can( 'manage_options' ) && ( $options['tracking_popup_done'] === false || $options['ignore_tour'] === false ) ) {
        add_action( 'admin_enqueue_scripts', array( 'WPSEO_Pointers', 'get_instance' ) );
    }
*/

    if ( $options['enablexmlsitemap'] === true ) {
        $GLOBALS['wpseo_sitemaps_admin'] = new WPSEO_Sitemaps_Admin;
    }
}

add_action( 'plugins_loaded', 'wpseo_init', 14 );

/*
    fix for bbpress conflict
*/
function wpseo_admin_init_pointers() {
    $options = WPSEO_Options::get_all();
    if ( current_user_can( 'manage_options' ) && ( $options['tracking_popup_done'] === false || $options['ignore_tour'] === false ) ) {
        add_action( 'admin_enqueue_scripts', array( 'WPSEO_Pointers', 'get_instance' ) );
    }

}


if ( is_admin() ) {
    if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
        require_once( WPSEO_PATH . 'admin/ajax.php' );
    }
    else {
        add_action( 'plugins_loaded', 'wpseo_admin_init', 15 );
        add_action( 'init', 'wpseo_admin_init_pointers', 14 );
    }
}
else {
    add_action( 'plugins_loaded', 'wpseo_frontend_init', 15 );
}
@jrfnl
jrfnl commented Mar 12, 2014

@tobylewis My fix is now merged into master. If you like you can test it. Should work just as well as your suggestion.

@tobylewis

Loaded and tested, all working fine now. Nice solution. Thanks for the quick action!

@jrfnl
jrfnl commented Mar 12, 2014

@tobylewis You're welcome ;-)

@jrfnl
jrfnl commented Mar 12, 2014

@inetbiz Does this also solve the original issue you reported or do you still get warnings ? If all is ok, please close the issue.

@inetbiz
inetbiz commented Mar 12, 2014

@jrfnl are you asking me to download the master to replace the plugin and test?

@inetbiz
inetbiz commented Mar 12, 2014

@jrfnl and @tobylewis resolved.

@inetbiz inetbiz closed this Mar 12, 2014
@jrfnl
jrfnl commented Mar 12, 2014

@inetbiz Glad to hear it. The fix was included in v1.5.2.1

@jrfnl jrfnl added a commit to jrfnl/wordpress-seo that referenced this issue Mar 21, 2014
@jrfnl jrfnl `current_user_can()` was being called too early
Related issues #881, #565
bdb777b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.