Hello,

I would like to request to allow Admin the permission to send messages to any users even when the setting "Restrict Private Messaging to only related users" is set to "Allow sending messages only to confirmed relationships".

The reason I require Admin to override this is I would like Admin to be able to send messages to any user with 'updates' 'news' etc, but I still want all users of the site to only be able to message each other if they have a confirmed relationship.

Would this be a feature that is possible in the near future?
I really like privatemsg and would like to fully utilize its services.

Thank you

CommentFileSizeAuthor
#14 UR-Privatemsg.png24.83 KBBilmar
#13 role_exclusions.patch4.95 KBberdir

Comments

berdir’s picture

Status: Active » Closed (won't fix)

This setting is not controlled nor added by Privatemsg, it's added by the relationship module you are using. You need to open a feature request there or move this one to the correct issue queue.

I don't know which module you are using so I'm setting it to won't fixed, change the status back in case you are moving this.

robby.smith’s picture

Project: Privatemsg » User Relationships
Version: » 6.x-1.x-dev
Status: Closed (won't fix) » Active

As per Berdir's comment, moving to User Relationships queue. The setting I am looking at is the 'Private messages' fieldset setting at http://www.example.com/admin/user/relationships/settings

I would like to set it to 'Allow sending messages only to confirmed relationships' so that users on my site can only send messages to other users which they have confirmed a relationship with. This feature works great!

However, I would like Admin to be able to still send messages to any user for administrative purposes (sending updates, news etc). I confirmed that with this setting, Admin is also only able to send to users which Admin has a relationship to at the moment. Can this feature be expanded to give Admin special privileges?

Thank you

robby.smith’s picture

Another reason this feature is needed:

When there is an event Relationship has been Requested, Approved, Disapproved etc I have an action to 'Sent a Message' via privatemsg with the details.

With this 'Restrict Private Messaging to only related users' also applying to Admin, this message is not able to be sent.

Thank you

robby.smith’s picture

Title: Admin override for 'Restrict Private Messaging to only related users' » Admin exception for 'Restrict Private Messaging to only related users'

Changed title from 'override' to 'exception'
Also, found this thread about someone who had to make this exception with views. http://drupal.org/node/375462#comment-2420700

robby.smith’s picture

This feature is really cool making users only able to send message to one another if they have a relationship. But I think there should be a way to give exceptions for users such as admin.

What does everyone think?
Could someone people help implement this?

Thank you

YK85’s picture

+1 subscribing

Bilmar’s picture

+1 for an option to allow admin extra privileges.

Temporary solution:
Adding line "&& ($author->uid != '1')" into user_relationships_api.privatemsg.inc

foreach ($recipients as $recipient) {
    //block if user is only receiving pm's from his relationships, and author is not one of them
    if (
        (variable_get('user_relationships_restrict_privatemsg', 'all') == 'relationships' 
         || (variable_get('user_relationships_restrict_privatemsg', 'all') == 'all_overridable' 
             && $recipient->user_relationships_allow_private_message == 'on in relations')) 
        && !module_invoke_all('socnet_is_related', $author->uid, $recipient->uid)
        && ($author->uid != '1')
     ) {
      $blocked[] = array(
        'uid' => $recipient->uid,
        'message' => t('!name is not a friend of yours.', array('!name' => theme('username', $recipient)))
      );
    }
  }
robby.smith’s picture

Can someone help add this feature as a checkbox in the settings?
The risk of forgetting to manually add the line on each update of the module is high =/

Would the maintainer of the module be open to adding this feature?
Is there another method of allowing admin more privileges than the average user?

Thanks!

okday’s picture

subscribing

YK85’s picture

I was wondering if the maintainer could please consider adding this functionality?
Thanks!

sotiris’s picture

+1 for #10

robby.smith’s picture

kindly bumping

A feature to allow admin to add/remove the users to have an exception would be awesome as there may be more than one administrator that needs to have the exception.

Thanks!

berdir’s picture

Status: Active » Needs review
StatusFileSize
new4.95 KB

Ok, here is a first patch...

- uid 1 is always excluded from the check
- Additional roles can be configured to be excluded too.

If you want to test it but don't know how to use patch files, you can also click the downloud source button at http://github.com/Berdir/user_relationships/tree/678806, which will download the whole module with the changes already applied.

Bilmar’s picture

StatusFileSize
new24.83 KB

hey Berdir,

I tested the patch with admin (uid1), other users, different roles and it looks great!
Users with a role selected in Role Exclusion are able to see all usernames in the To: autocomplete and send to them.
This definitely beats my workaround of having to add the lines of code with uid numbers =)

Thanks!

robby.smith’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Berdir for adding this much needed feature!
Tested and works great
+1 for commit

YK85’s picture

Awesome! I added the patch to my site over the weekend.
+1 for commit

alex.k’s picture

Sorry for the hold-up. Will process this and other patches in the next days. Thanks much to Berdir and reviewers.

alex.k’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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