Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 10 years ago

#2057 closed defect (bug) (fixed)

'@' in username makes mentions not work...

Reported by: Zooney Owned by:
Milestone: 1.5 Priority: minor
Severity: Version:
Component: Core Keywords: commit has-patch
Cc: Zooney

Description

Having a username formatted like "smith.1@…" (i.e. a Shibboleth EPPN) makes the mention functionality not work...

Versions:
Wordpress 2.9.1
BuddyPress 1.2.1

Steps to reproduce:
1.)Create a user with name such as "smith.1@…"
2.)Attempt to mention this user using @smith.1@…

Mention will not be formatted as a link as it would be without the '@' in a username and mention will not work

Attachments (2)

2057-0.diff (547 bytes) - added by boonebgorges 10 years ago.
2057.patch (2.3 KB) - added by SergeyBiryukov 10 years ago.

Download all attachments as: .zip

Change History (13)

#1 @apeatling
11 years ago

  • Milestone changed from 1.2.3 to 1.2.2

#2 @apeatling
11 years ago

  • Milestone changed from 1.2.2 to 1.2.3

This is not a simple fix so I'm bumping it back to 1.2.3 to take a better look at it. @ symbols are actually not allowed in usernames unless you are using LDAP, so while it's important, the vast majority of users are not going to see the problem.

#3 @Zooney
10 years ago

  • Component set to Core

I think I have more information about this one...

If BuddyPress is using the user_nicename column when formatting links and creating the "@username" link functionality, the solution to my particular problem may be an issue with the shibboleth plugin I've been using the create user accounts.

It turns out that this plugin stores an unsanitized user_nicename, if BuddyPress uses the user_nicename field when creating links, and I can clean up the user_nicename column in my database this would become a non-issue.

#4 @Zooney
10 years ago

I've checked and unfortunately this problem still persists when using a sanitized user_nicename

#5 @boonebgorges
10 years ago

Andy says above that this is not an easy fix, but when I tested the attached patch 2057-0.diff, which simply adds an @ to the bp_activity_at_name_filter() filter regex, it seemed to work OK.

Could I ask others to test this patch and/or to pitch with info on why it won't work?

@boonebgorges
10 years ago

#6 @DJPaul
10 years ago

Will test later, but what about a scenario where there is a user "test", "@test" and you try to send a mention to @test, i.e. @@test?

#7 @boonebgorges
10 years ago

  • Keywords has-patch needs-testing added

#8 @boonebgorges
10 years ago

  • Keywords dev-feedback commit added; has-patch needs-testing removed
  • Priority changed from major to minor

That seems like more of an edge case than the original problem. (Can user_nicename start with '@' anyway?) My vote is to apply this patch and cross that bridge if we come to it.

#9 @DJPaul
10 years ago

  • Keywords needs-patch added; dev-feedback removed

I spent a few hours looking at this sort of issue the other day, and whilst the solution in the patch fixes the immediate problem, there are in some situations still problems with the links being parsed/added to the string in the activity stream content itself. Nothing stopping this going in for this specific issue, however.

This same regex is also used in a few other components, so probably better to keep them all consistent. Anyone fancy updating the patch? Easy props.

#10 @SergeyBiryukov
10 years ago

  • Keywords has-patch added; needs-patch removed

#11 @boonebgorges
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4118]) Modifies @-mention regex to better handle @ signs in usernames. Fixes #2057. Props boonebgorges and SergeyBiryukov

Note: See TracTickets for help on using tickets.