I would like users to be able to send messages to all users but only see users from their established relationships (2 way relationships) in the autocomplete suggestion of the "New Message" form.

So I have the following settings:
* Restrict Private Messaging to only related users: Allow sending messages to all users
* Suggest only relationships in To: field (checked)

I was not getting any filter for users so I went to code and found out in "user_relationships_api_privatemsg_sql_autocomplete_alter" function:

// Check if $author needs to be restricted.
if (!variable_get('user_relationships_privatemsg_autocomplete_alter', 0) || !user_relationships_api_privatemsg_restrict($user)) {
return;
}

As far as I understood, the filtering is just applied if users check "Suggest only relationships" option is checked and if they are not allowed to send messages to everyone. So, I patched it to:

if (!variable_get('user_relationships_privatemsg_autocomplete_alter', 0))

and I get the functionality I was looking for. I know this patch is not perfect but it was the way I achieved my functionality. I wonder if this code doesn't need some refactoring to include the possibility I presented.

Comments

un11imig’s picture

Category: support » bug

For me the same.
It does not work if only check "Suggest only relationships in To: field"

Regards,

mrf’s picture

Category: bug » feature
mrf’s picture

Component: Code » Privatemsg
Status: Active » Postponed

I am postponing any 6.x feature requests that don't have a current applicable patch to help sort the large list of open features.

Please feel free to set to 'needs review' once a patch is included.