Opened 14 years ago
Closed 13 years ago
#4779 closed defect (bug) (fixed)
messge compose autocompletefb.js splitting user name wrongly
| Reported by: | mort3n | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.8 |
| Component: | Messages | Version: | 1.6.1 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: |
Description
In
/bp-messages/js/autocomplete/jquery.autocompletefb.js
the user should be removed by
removeUsername: function(o){
var newID = o.parentNode.id.split('-');
jQuery('#send-to-usernames').removeClass(newID[1]);
The id being split contains the string 'un-user_name'. The code works great when 'user_name' contains no '-'. However, with
user_name = 'john-doe'
the code tries to remove class
john
which fails.
Using a
-
seems to be valid in user names
http://codex.wordpress.org/Function_Reference/sanitize_user
A fix is
removeUsername: function(o){
var newID = o.parentNode.id.substr(3);
jQuery('#send-to-usernames').removeClass(newID);
Another fix is
removeUsername: function(o){
var newID = o.parentNode.id.substr((o.parentNode.id.indexof('-'));
jQuery('#send-to-usernames').removeClass(newID);
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Good catch. Ideally I'd like to see us stop using jquery.autocompletefb.js and use something that comes with WP (or is at least not crummy); see #4580. However, this seems like a straightforward fix if we keep the fb version for a few more releases.