Hi guys,
not sure how plausible this idea is but gonna have a go at explaining it...

would it be possible to show an 'alternative' field for the recipient to: input instead of the user name.
an example would be to select a different cck field (possibly from content_profile) which shows the user's full name.
Then the recipient field UI would be much friendlier to the user as they are inputing the actual name's of people they want to message instead of having to remember a user name. The field to complete on could be chosen through an admin UI page, and if none selected it falls back onto the default username implementation.

problems here obviously occur that a prospective full name field may not necessarily be unique in the database (e.g. 2 people could have the name's joe bloggs).

as well as autocompleting the field would it be a better idea to also have a hidden field on the form, which keeps track of the corresponding username or UID for the names autocompleted in the to: textbox??

obviously this would require a bit of extra legwork in the privatemsg_new() function which builds the form, and also other corresponding functions.

thoughts?

Comments

berdir’s picture

Status: Active » Closed (duplicate)

Have a look at #445404: Integration with RealName and the linked issues.

tayzlor’s picture

@Berdir,

I have successfully managed to get the autocomplete dropdown to display the full name when the user is typing in the to: field. When the user clicks on the name however, it inserts it into the field as the $user->name and not the fullname. I could not see anything in the issues / patches above to deal with this?
This is because the key of the array i am returning from the autocomplete function is still the $user->name as it needs to be for PM to work properly. If i returned the fullname then pm_send_validate() would not validate the name and the message would not be sent.

If the name entered was the fullname and not the $user->name it would involve altering the pm_send_validate() function to find the $user->name from the full name entered validate it and pass it on to pm_send() properly (ie as $user->name and not full name).

correct me if i'm wrong?

naheemsays’s picture

you are right, but at the same time I think the full name does NOT have to be unique, so matching from that may not be teh best idea.

If you have a snippet that works appropriately, it might be a good idea to post it here/in the other thread for others to use too. (or it might be a bad idea if it works "wrong" and no one fixes it)