Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
How do I disable the PM feature by group?
Joined: Sep 2001
Posts: 64
Junior Member
Junior Member
Joined: Sep 2001
Posts: 64
This is a very good question. I'd like to know the answer as well. For instance, Administrators can send and receive PM's but members of the Users group cannot.
Joined: Sep 2001
Posts: 64
Junior Member
Junior Member
Joined: Sep 2001
Posts: 64
bump.....any of the programmers/hackers have any ideas on this one?
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
Yeah, where's the love man.
Someone must know how to do this.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
See if this attachment works for you.
Untested.
But if it works, let me know, and I'll clean it up and post it.
Attachments
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
Thank's I will try it, what if I want to restrict 2 groups, lets say group 3 and 4, I would change this right? ("/-3-/",$user['U_Groups'])) to maybe ("/-3-,-4-/",$user['U_Groups']))
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I'm not sure if that will work.
Group 4 is not logged in. That check is already in there that they must be logged in.
If it had to be another group, I would probably try something like this:
if (((strstr("/-3-/",$user['U_Groups'])) || (strstr("/-5-/",$user['U_Groups'])))&& (($user['U_Status'] != "Administrator") && ($user['U_Status'] != "Moderator"))) {
I'm not sure if I got all the parenthesis correct.
Basically the first part || is or and the last part && is and. So if they are in group 3 (users) and group 5 (first custom group) and they are NOT an Admin or Mod then they get intercepted.
But my parenthesis may be wacked. Maybe there's a more-proper way.
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Joined: Apr 2002
Posts: 1,768
Corrected use of strstr and simplified parentheses: if ((strstr($user['U_Groups'],'/-3-/') || strstr($user['U_Groups'],'/-5-/')) && $user['U_Status'] != 'Administrator' && $user['U_Status'] != 'Moderator') { Alternate way: $in_3 = strstr($user['U_Groups'],'/-3-/'); $in_5 = strstr($user['U_Groups'],'/-5-/'); $is_mod = $user['U_Status'] == 'Moderator'; $is_admin = $user['U_Status'] == 'Administrator'; if (($in_3 or $in_5) and !$is_admin and !$is_mod) {
Last edited by Dave_L; 04/23/2003 8:49 PM .
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thank you.
I knew you'd know.
I was seeing parentheses in my sleep.
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Joined: Apr 2002
Posts: 1,768
Sometimes it's worthwhile to use auxiliary variables to break up a complex expression like that. In PHP, though, you have to be careful about adding new variables, because of the limited variable scoping capabilities.
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
Just tested it and it didn't work, I think I am doing everything right
(I only need the one usergroup BTW) so that is the one I used, made sure test user was in group -5- then logged in as test user and could still send and recieve, any ideas?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
This user isn't an admin or mod? Just above the if statement you added, add this. This will output some info to the top of the screen, tell me what echo "Groups: $user['U_Groups']<br />"; That'll let you see what it's seeing the user's groups as.
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
[] This user isn't an admin or mod? [/] Nope []Just above the if statement you added [/] The if statement in sendprivate.php?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, whichever one you are testing. sendprivate.php is for new messages, the other is for replies.
I just want to see if it's seeing the groups. Maybe we need to add it to the authenticate function, although I thought it was standard.
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
I get this in sendprivate.php Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/1/blazer90/coloradok5.com/forums/sendprivate.php on line 62 Did I put it in the wrong spot?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Doah
sorry.
Try this:
echo "Groups: {$user['U_Groups']}<br />";
I may need to play with this hack a bit tonight and make sure it works.
I can't see why it doesn't, but I might be missing the mega-obvious.
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
It outputs another brake return but no text.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Try doing the mod I've attached to this post.
Attachments
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Joined: Jul 2001
Posts: 442
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Posts:
87
Joined: December 2001
Forums63
Topics37,575
Posts293,931
Members13,824
Most Online6,139Sep 21st, 2024
Currently Online
Topics Created
Posts Made
Users Online
Birthdays