Stop Spammers Conflict With BBPress and Buddypress
Hi and great plugin. It worked great on my sites until I decided to use buddypress and bbpress.
I sandbox my development and have wp debug on and it started firing all sorts of notices.
Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init()
I looked up what was going on and Stop Spammers is calling the function is_user_logged_in() too early in the stack.
This can cause all sorts of weird errors and permission issues.
per this link…
quote”The debug notice is annoying, but invoking the current user that early in the stack is going to cause a myriad of other invisible issues with both BuddyPress and bbPress. Closing this as wontfix.”endquote.
I found the workaround here…
The fix is to call after the theme is loaded. Instead of bbp_loaded we use after_setup_theme because that is what triggers the notice.
Line 76 holds the setup_current_user() function for buddypress in
Line 142 holds the setup_current_user() for bbpress in
Neither plugin likes other plugins to call for user info too early in the stack. It causes too many untraceable issues (see above link).
I corrected by adding / replacing line 27 in stop-spammer-registrations.php
add_action('bbp_loaded','kpg_load_all_checks',99); // try hooking into bbpress loaded
add_action('after_setup_theme','kpg_load_all_checks',99); // try hooking into bbpress loaded
I corrected by adding / replacing line 59 in stop-spammer-registrations.php
remove_action('bbp_loaded','kpg_load_all_checks',99); // try hooking into bbpress loaded
remove_action('after_setup_theme','kpg_load_all_checks',99); // try hooking into bbpress loaded
So I changed lines 27 and 59 in stop-spammer-registrations.php and the notices stopped.
Hope it helps!
- The topic ‘Stop Spammers Conflict With BBPress and Buddypress’ is closed to new replies.