Opened 14 years ago
Closed 14 years ago
#1665 closed defect (bug) (fixed)
bbp_is_user_home() is returning true when not logged in
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 2.1 | Priority: | normal |
| Severity: | normal | Version: | 2.0 |
| Component: | Component - Users | Keywords: | |
| Cc: |
Description
I was looking at a users profile page on my local & live development environments while not logged to an account and bbp_is_user_home() is returning true. Therefore, it's saying 'You are not currently subscribed to any topics.' instead of 'This user is not currently subscribed to any topics.' And you can see the edit link next to the users profile.
I'm currently running a custom WP theme but bbPress is using the default theme for the forums, so I've not touched anything there. I also went as far as to reinstall bbPress and get a clean theme and core files in the mix and still nothing changes.
So this is the fix, there needs to be an
!is_user_logged_in()in the if statement and everything works as expected./** * Check if current page is the currently logged in users author page * * @since bbPress (r2688) * * @uses bbPres Checks if bbPress::displayed_user is set and if * bbPress::displayed_user::ID equals bbPress::current_user::ID * or not * @return bool True if it's the user's home, false if not */ function bbp_is_user_home() { global $bbp; if ( empty( $bbp->displayed_user ) || !is_user_logged_in() ) return false; return (bool) ( bbp_get_displayed_user_id() == bbp_get_current_user_id() ); }