Are you, by chance, using the following configuration setting?
`define( ‘BP_ENABLE_USERNAME_COMPATIBILITY_MODE’, true );`
It would be in your wp-config.php file, or perhaps bp-custom.php.
Thanks for the reply!
No such luck, Boone. I tried adding that to my custom-functions.php and didn’t see any change.
Also, I’ve noticed it’s not just my handle causing problems. There was some bug previously that caused some usernames to be appended with ‘-2’ … e.g. /members/ragnar-2/ … Now, when I try to access that user’s page, I get the same (404) error, and similarly must remove the ‘-2’ (/members/ragnar/) to access their profile.
I appreciate any leads the community has to offer to help me track down the source of this!
Digging a bit more, I found a discrepancy on my test site’s activity page between the link on my avatar and that of the activity meta. The latter seems to reference `user_url` according to the WP Cache Inspect plugin — and we’re using W3TC for caching on both production and dev sites. Before you ask, yes, I frequently clear the cache — just about every time I make another change.
avatar link (`bp_activity_user_link()`): http://mysite.com/members/alex-weber/
activity-meta link (`bp_activiy_action()`): http://mysite.com/members/alex-weber-2-2/ — which is what it used to be, before I modified the record in the db.
NB: neither of these links work to access my profile. I’m not even sure if this is relevant, tbh, but it’s all I have to go on right now.
Not sure where to start with this, but the `-2-2` problem reminds me of https://buddypress.trac.wordpress.org/ticket/2642. Note that that ticket had to do with a very specific problem which is, I think, different from yours in the details, but may have the same root issue. As an experiment, try commenting out the following line in `bp-members/bp-members-functions.php`:
`add_action( ‘pre_user_login’, ‘bp_core_strip_username_spaces’ );`
Thanks for the info again, Boone!
The ticket you linked does seem somewhat similar — my user login was registered /before/ we installed BP, and has spaces in the login. It’s entirely likely that I changed my pw or something (using wp-admin) and that appended the -2s to my username. So with that said, let’s ignore the -2 issue as that seems to be in the past and I can easily URL-rewrite around it.
As per the experiment you suggested: I commented out that line, and cleared W3 cache. accessing http://mysite.com/members/alex-weber%5B/anything%5D still doesn’t work.
Thank you again. I really can’t say it enough!
I don’t think we can just ignore the -2 issue, because I think that it points to a larger confusion between `user_nicename` and `user_login` on your installation. I’m not sure what kind of further debugging can be easily done at this point, though, without direct access to your system. I guess I would check a couple of things if this were my system:
– Drop some debug `var_dump()`s around https://buddypress.trac.wordpress.org/browser/tags/1.5.4/bp-core/bp-core-catchuri.php#L239, to see how BP is determining your displayed user ID
– Check directly in your database to see if there is some strangeness in the way that your user_nicename is defined in wp_users. The nicename should not contain capital letters or spaces, though user_login can.
Okay! Did some troubleshooting as you suggested, Boone, and here’s what I’ve found that seems relevant:
By default on my install, BP_ENABLE_USERNAME_COMPATIBILITY_MODE was “true”. I’m not sure why. When I explicitly defined it to “false”, MY user profile page worked:
mysite.com/members/alex-weber/ — and /members/alex-weber-2-2/ did not (more on that in a second)
also, mysite.com/members/ragnar/ (previously working) does NOT work with compatibility mode = false.
here’s the relevant fields from the db, maybe this will shed more light…
`mysql> select user_login, user_nicename, user_url from wp_users where user_nicename like “ragnar%”;
+
+
+
+
| user_login | user_nicename | user_url |
+
+
+
+
| ragnar | ragnar-2 |
http://mysite.com/members/ragnar-2/ |
+
+
+
+
1 row in set (0.00 sec)
mysql> select user_login, user_nicename, user_url from wp_users where user_nicename like “alex-%”;
+
+
+
+
| user_login | user_nicename | user_url |
+
+
+
+
| Alex Weber | alex-weber |
http://mysite.com/members/alex-weber-2-2/ |
+
+
+
+
1 row in set (0.00 sec)`
NB: I manually edited the user_nicename with SQL for Alex Weber to remove the -2-2.
> By default on my install, BP_ENABLE_USERNAME_COMPATIBILITY_MODE was “true”. I’m not sure why.
I’m not sure why either. By default, BP does not define it at all, much less to `true`. It sounds like setting it to `false` has solved your problem. (In brief, when `BP_ENABLE_USERNAME_COMPATIBILITY_MODE` is true, BP uses the `user_login` to create URLs; otherwise it uses `user_nicename`.)
The reason the `/ragnar/` URL is not working is because, as you can see in the first query above, the user_nicename has been changed to `ragnar-2`. You’ll want to change it back manually, in this case and in any other case where changes have occurred.
There does appear to be a bug somewhere here. I opened a Trac ticket: https://buddypress.trac.wordpress.org/ticket/4101 Thanks for your help debugging – feel free to follow along there.
Yay, my first bug! I’m so proud. Luckily I should be able to batch-update al the user_nicename and user_url that have -2 in them…
Hey Fella’s I’m having the same issue as described by mralexweber. But I’m unsure about where I can find this setting..
define( ‘BP_ENABLE_USERNAME_COMPATIBILITY_MODE’, true );
It’s not in wp-config and I can’t seem to find bp-custom.php in the BP plugin folder. Any direction? Thanks!
Going on what I could find in the Buddypress customization guide.. https://codex.buddypress.org/extending-buddypress/bp-custom-php/
I created my own bp-custom.php and placed the code
`define( ‘BP_ENABLE_USERNAME_COMPATIBILITY_MODE’, true );` into the file, now my profile’s edit link works like a charm. Thanks for posting this issue a while back.