Document hook_privatemsg_name_lookup()

michtoen - April 18, 2009 - 14:27
Project:Privatemsg
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed
Description

This is an interesting small glitch, even it don't will appear for the "normal" drupal user.
Thats why i set it to minor.

I am uneasy its worth a code fix, perhaps a note in the readme would be enough.

Let me explain what we found:

At www.daimonin.org we imported an already existing community from another CMS/forum to drupal.

The format of user names was there different, so i had to change the names a bit.
I also don't want gigantic user names, it will break the web 2.0 like site.

So i patched the user length in user.module to 15 bytes.
Means new user can't register a name longer as 15 bytes.

Now, we had old names from the old CMS longer as 15 in the DB. Drupal itself has no problem with it.

But as one of this now "to long" (18 bytes) guys tried to PM me, i was not able to answer his PM.
The user was able to PM other people but when you tried to PM him, the PM module tells you
"you need one recipent to answer".

Also a direct PM don't works, the module is removing him from the recipents list and telling you its not there.
If you use a multi recipents PM, only the valid users get PMed.

Not sure how this is to handle, i patched drupal so the general user length is big enough but new users still can't
register longer names as 15 bytes (and i also think this kind of settings should be part of the core user admin settings).

#1

nbz - April 18, 2009 - 15:23

Yes this is a problem with the callback to check if the username has been validated through user_validate_name. This has has also caused me problems before too, so I can see where the problem may arise.

http://api.drupal.org/api/function/user_validate_name/6

It probably does need to be looked at.

#2

nbz - April 18, 2009 - 15:25
Title:Small user length glitch» Glitch with use of user_validate_name

#3

Berdir - October 25, 2009 - 23:44
Title:Glitch with use of user_validate_name» Document hook_privatemsg_name_lookup()

The call has been removed from the autocomplete function and the username lookup can now easily be overriden by adding a privatemsg_name_lookup() hook.

I'd wanted to set this to fixed but I notices that the hook isn't documented, so I'm changing the scope of this issue.

#4

Berdir - October 26, 2009 - 15:20
Status:active» needs work

Not sure if that is clear, please tell if not :)

AttachmentSize
privatemsg.document_hook.patch 1.02 KB

#5

Berdir - October 27, 2009 - 11:19
Status:needs work» needs review

Setting correct status.

#6

nbz - October 27, 2009 - 12:25
Status:needs review» reviewed & tested by the community

makes sense.

#7

Berdir - October 27, 2009 - 13:52
Version:6.x-1.x-dev» 7.x-1.x-dev
Status:reviewed & tested by the community» fixed

Added to 6.x-1.x-dev and 7.x-1.x-dev.

#8

System Message - November 10, 2009 - 14:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.