[buddypress-trac] [BuddyPress] #1860: Valid characters in Wordpress usernames cause issues in BuddyPress

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Wed Mar 3 17:30:16 UTC 2010

#1860: Valid characters in Wordpress usernames cause issues in BuddyPress
  Reporter:  Zooney  |       Owner:                                           
      Type:  defect  |      Status:  reopened                                 
  Priority:  major   |   Milestone:  1.2                                      
Resolution:          |    Keywords:  usernames, special characters, characters
Changes (by timnicholson):

  * status:  closed => reopened
  * resolution:  worksforme =>


 Setting BP_ENABLE_USERNAME_COMPATIBILITY_MODE does not fix all the issues
 in BP v1.2.1 member profile URL's. While it does change the URL's in the
 member directory and the URL's that are linked to that member's avatar, it
 does NOT change the URL's for the user that display in the activity stream
 (blue box by default). For some reason the URL in the activity stream uses
 the display name (or what BP calls the fullname, but its kept in sync with
 the WP display_name field).

 Further, the BP logic to catch the URL and display the member page makes a
 very bad assumption that the user's name (nicename by default unless
 BP_ENABLE_USERNAME_COMPATIBILITY_MODE is set) is exactly the same as their
 user login. While defining this variable does fix that issue by forcing BP
 to use the login name, in the default configuration its a problem.

 Also, the BP catch logic makes the very bad assumption that there will be
 no spaces orther unusual characters in the user's nicename. Again defining
 the compatibility mode variable eliminates this issue, but its an easy fix
 using urldecode() before looking up the user name.

 Let's face it, people set their nicename to what they want displayed and
 we shouldn't have to force BP to use their often times ugly login names.

 I have fixed these last two issues with some help in the forums and some
 experimentation, but I can't for the life of me figure out why the user
 profile links in the activity stream are still using the display name.

 Here is my code. If this gets rolled into core, you'll want to also fix
 the scenario where BP_ENABLE_ROOT_PROFILES is set as I didn't bother
 handling that.

 In the function bp_core_set_uri_globals() in /bp-core/bp-core-catchuri.php
 replace the code around the member profile URL's with this. Deleted lines
 are commented out with //DEL and added line have //ADD at the end of them.
 The other lines are untouched.

         /* Catch a member page and set the current member ID */
         if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) ) {
                 if ( ( $bp_uri[0] == BP_MEMBERS_SLUG && !empty( $bp_uri[1]
 ) ) || in_array( 'wp-load.php', $bp_uri ) ) {
                         // We are within a member page, set up user id

                         //DEL $displayed_user_id =
 bp_core_get_displayed_userid( $bp_uri[1] );
                         if ( defined(
                              $displayed_user_id =
 bp_core_get_displayed_userid( urldecode($bp_uri[1]) );
                         } else { //ADD
                              $user_temp = get_user_by('slug',
 urldecode($bp_uri[1]) ); //ADD
                              $displayed_user_id = $user_temp->ID; //ADD
                         } //ADD


Ticket URL: <http://trac.buddypress.org/ticket/1860#comment:17>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list