evanhgh
Forum Replies Created
-
Hello just checking in for an update on this, have you been able to reproduce this bug?
Hey just checking in, have we made any progress on the issue of mentioning users with emails as their username?
The problem seems to be how the plugin is parsing usernames. It’s assuming that usernames are simple alphanumeric strings, and thus it’s interpreting any “@” sign as the beginning of a mention. If a username has an “@” sign in it (as in an email address), it incorrectly breaks the mention.
Could we solve this problem by changing the username pattern that we match when searching for mentions. Instead of treating every “@” sign as the start of a mention, we could first check if it’s not already part of an email address?
Specifically, in the class-comment-mention.php filepublic static function cmt_mntn_find_mentions( $content ) { $pattern = '/[@]+([A-Za-z0-9-_\.@]+)\b/'; preg_match_all( $pattern, $content, $usernames ); //rest of code
to
public static function cmt_mntn_find_mentions( $content ) { // Do not consider email addresses as mentions $pattern = '/(?<![A-Za-z0-9-_.])[.@]([A-Za-z0-9-_\.@]+)\b/'; preg_match_all( $pattern, $content, $usernames ); // rest of code
This change to the regular expression MIGHT ensure that an “@” character isn’t treated as a mention if it’s preceded by an alphanumeric character, hyphen, underscore, or period – (the valid characters in an email username)
the addition of this negative-lookbehind-assertion would be more precise because it tries to exclude matches that are part of an email address. This is useful when trying to ignore email addresses when searching for “mentions” and only want to capture instances where usernames are mentioned with a preceding @ symbol.I have not familiarized myself with the rest of the code so this could very well break it more. no idea.
EDIT:
Nevermind that didnt work in my staging site, please ignore the suggestion lol- This reply was modified 1 year, 9 months ago by evanhgh.
Hi Bunty,
Unfortunately, this is still an issue.
If a user has an “@” symbol in their username it is not possible to mention them.
Forum: Plugins
In reply to: [Comment Mention] Dropdown function suddenly stop workingIt seems that the update has broken the functionality entirely.
Now there is no dropdown in bbpress when using the @ symbol