Skip to:
Content

bbPress.org

Opened 13 years ago

Closed 13 years ago

#1665 closed defect (bug) (fixed)

bbp_is_user_home() is returning true when not logged in

Reported by: valendesigns's profile valendesigns 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.

Change History (4)

#1 @valendesigns
13 years ago

  • Summary changed from bbp_is_user_home() is returning true when not logged out to bbp_is_user_home() is returning true when not logged in

#2 @valendesigns
13 years ago

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() );
}

#3 @johnjamesjacoby
13 years ago

  • Milestone changed from Awaiting Review to 2.0.1

#4 @johnjamesjacoby
13 years ago

  • Milestone changed from 2.0.1 to 2.1
  • Resolution set to fixed
  • Status changed from new to closed

(In [3554]) Add is_user_logged_in() check to bbp_is_user_home(). Fixes #1655, props valendesigns. (plugin)

Note: See TracTickets for help on using tickets.