Skip to:
Content

bbPress.org

Opened 7 years ago

Last modified 6 years ago

#2266 new defect

Profile not displayed for users with period in name

Reported by: kevinB Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.2.3
Component: Component - Users Keywords: needs-patch
Cc:

Description

The get_user_by retrieval fails because WP converts periods into dashes for user_nicename. You will need to do the same:

$bbp_user = get_user_by( 'slug', str_replace( '.', '-', $bbp_user ) );

Change History (4)

#1 @johnjamesjacoby
7 years ago

  • Component changed from General to Users
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Both places get_user_by() is used in this regard, are in response to user input, either via @ mentions, or the URL. Can you include more details on how to reproduce the bug you think you've found, and where in the code you've found it?

#2 @kevinB
6 years ago

In function bbp_parse_query(), the only occurrence of the code snippet I cited.

To reproduce, find or create a username with a period in it. Then click any of the user links which your default bbpress theme generates for that user (Profile, Topics Started, Replies Created, etc.)

#3 @johnjamesjacoby
6 years ago

  • Switched to singlesite installation (multisite installs already limit usernames to letters and numbers only).
  • Created a user with the username 'bob.bob'
  • Posted a topic in the forums.
  • Link to username is 'domain.com/forums/users/bob-bob/'
  • URL resolves correctly, and I see the users profile.
  • All subsequent profile links work correctly.

Basically, I'm not able to reproduce what you're seeing.

#4 @kevinB
6 years ago

It turns out I need to revise the steps to reproduce:

  • Create user with username bob.bob
  • Have bob.bob create a topic
  • Access a manually constructed forum user URL ( /forums/users/bob.bob )

At that point, your user profile displays Forum Role: Key Master, no Topics, no Replies. Under this condition, the other profile links (Topics Started, etc.) are not constructed correctly and simply link back to the invalid forum user profile screen.

Sorry, I thought this had come about through a clicked user link. Apparently, I was already viewing another user link, happened to know the user_login of someone I wanted to check on, and just changed the URL. So it's arguably not a bug, but maybe worth dealing with anyway. It definitely created some confusion and a (false) sense of bbPress failure.

The code snippet I mentioned forces these forum user profile screens to display correctly even if a user_login different from user slug is provided in the URL. I guess a redirect would be a cleaner solution if you cared to deal with this, but this was my quick workaround.

Last edited 6 years ago by kevinB (previous) (diff)
Note: See TracTickets for help on using tickets.