#7001 closed defect (bug) (wontfix)
Notice: bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init()
| Reported by: | yawalkarm | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core | Version: | 1.7 |
| Severity: | normal | Keywords: | |
| Cc: | mhyawalkar@… |
Description
The error can be reproduced with WordPress default themes also. Just try is_user_logged_in() check in functions.php and you will get this notice.
The issue is still not fixed. Any help is appreciated.
Change History (3)
#2
@
10 years ago
- Keywords needs-patch removed
- Milestone 2.5.3
- Priority highest → normal
- Resolution → wontfix
- Severity major → normal
- Status new → closed
- Version 2.5.0 → 1.7
Thanks for the report, however you answered your own question:
Just try is_user_logged_in() check in functions.php and you will get this notice.
Using is_user_logged_in() in your theme's functions.php is too early. You should be running any type of user checks such as is_user_logged_in() on the 'set_current_user' hook or later.
Check out the action firing sequence in WordPress for more details:
https://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request
Here's an example you can use in your theme's functions.php without running into the bp_setup_current_user notice:
/** * Do your login check on the 'init' hook. */ function my_user_check() { // Do your login check here. if ( is_user_logged_in() ) { } } add_action( 'init', 'my_user_check' );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
There are a bunch of other tickets here with this same error.