private message from buddy only by default


  -----  
Author Message

panther
Member

Fri Oct 19, 2007 6:59 pm   Post subject: private message from buddy only by default
hi,

thank you very much for this excellent mod!

i have it working fine on my site, i would have only one little hack question:

is it possible to receive private messages ONLY from membres on buddy list. none other.

i can't find out how to do it.

i'm sure with a little modification to the code, it is possible to set this as default; if not a "buddy", do not send PM.

thank you very much for your help!
 

Thoul
Administrator

Wed Oct 24, 2007 8:14 am   Post subject: Re: private message from buddy only by default
In privmsg.php, replace this code:

Code:

      if( $to_userdata['user_id'] )
      {
         if( $contact_list->check_user($to_userdata['user_id'], $userdata['user_id'], 'ignore') )
         {
            $error = TRUE;
            $error_msg = $lang['User_ignoring_you'];
         }
         elseif( $contact_list->check_user($to_userdata['user_id'], $userdata['user_id'], 'disallow') )
         {
            $error = TRUE;
            $error_msg = $lang['User_not_want_contact'];
         }
      }


With this:

Code:

      if( $to_userdata['user_id'] )
      {
         if( !$contact_list->check_user($to_userdata['user_id'], $userdata['user_id'], 'buddy') )
         {
            $error = TRUE;
            $error_msg = 'This person has not added you to their buddy list. You cannot send them a PM.';
         }
      }
 

panther
Member

Wed Oct 24, 2007 10:05 am   Post subject: thank you
thank you very much for your help!!!

it works like a charm

if i may, is it possible to keep allowing PM's to admin and moderators despite this mod?

thank you!
 

Thoul
Administrator

Wed Oct 24, 2007 7:41 pm   Post subject: Re: private message from buddy only by default
Sure. In privmsg.php, find this line:

Code:

         $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active


At the end of it, add , user_level. It should look like:

Code:

         $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active, user_level


Then change this line:

Code:

if( $to_userdata['user_id'] )


To this:

Code:

if( $to_userdata['user_id'] && $to_userdata['user_level'] == USER )
 

panther
Member

Wed Oct 24, 2007 9:04 pm   Post subject: thank you
thank you very much for this, it works very well

it would be so nice if as ADMIN or MODERATOR i could send PM's to users.

i tried playing around with the code but i just can't get it done....

thank you again for your help!
 

Thoul
Administrator

Thu Oct 25, 2007 8:01 am   Post subject: Re: private message from buddy only by default
Change that last line I gave you to this:

Code:

if( $to_userdata['user_id'] && $to_userdata['user_level'] == USER && $userdata['user_level'] == USER )
 

panther
Member

Thu Oct 25, 2007 8:29 am   Post subject: thank you
thank you very much; i think i can say it now: this mod is perfect for me!

i really appreciate all the help you have given me!

take care.
 

Page 1 of 1
Display posts from previous: