| Author |
Message |
minx Client

Joined: Dec 25, 2003 Posts: 16
|
Posted:
Sun Feb 08, 2004 12:05 am |
|
I'm running a messageboard and have had occasion to suspend a user.
If I put the user as inactive in forums admin they cant see the site or access PMs.
To get round this I created usegroups and add all members to the 'normal' group to allow them to post.
If I have to suspend anyone I remove from from the group, this way they can still read forums and PMs.
The problem with this is that if any new user joins they have to wait till I am on site to add them to user group before they can post.
Is there any other means by which I can suspend a user from posting, but allow him to view site/PMs?
Cheers:) |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 15311 Location: Kansas
|
Posted:
Sun Feb 08, 2004 2:39 am |
|
Minx,
I just threw together some code but it seems to work. Try this.
In modules/Forums/posting.php, on or about line 372 you should see these comment lines | Code: | //
// The user is not authed, if they're not logged in then redirect
// them, else show them an error message
// | Place this code right ahead of those comments | Code: | /*****************************************************/
$groupToSuspend = 33;
$sqlSuspended = 'SELECT * FROM '.$prefix.'_bbuser_group WHERE user_id='.$userdata['user_id'].' AND group_id=$groupToSuspend';
$resultSuspended = $db->sql_query($sqlSuspended);
if (@sql_num_rows($resultSuspended)) {
message_die(GENERAL_MESSAGE, '<b>'.$userdata['username'].', you have been temporarily restricted from posting in this forum.<br /><br />If you feel this is a mistake, please contact the Forum Admin.</b>');
}
/*****************************************************/ | Here is what you need to do now.
- Create a group to hold these 'banned' user(s).
- Add the banned users to this group.
- Use phpMyAdmin to get the Group_id of the newly created group.
- Modify the $groupToSupend = 33; to be whatever the New Group Id is.
I think I will spruce this up a bit and make it controlled in the Admin panel. I will work on that, but for now, this manual intervention should work just fine
Raven |
Last edited by Raven on Sun Feb 08, 2004 10:29 pm; edited 5 times in total |
|
|
 |
minx Client

Joined: Dec 25, 2003 Posts: 16
|
Posted:
Sun Feb 08, 2004 9:09 pm |
|
Lol!! As per I've got it wrong. I tried to do what you said, added a user to the banned group as a test and she could still post!
I added the code, stars and all, just above where you said.
Then I went to admin forums and created a 'banned' group.
In phpmy admin I clicked on groups, then ticked group id and clicked browse.
On the new page it said group id for banned was 17
I then modified Modify the $groupToSupend = 33; using 17 instead of 33.
And it didnt work for me, where did I go wrong?  |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 15311 Location: Kansas
|
Posted:
Sun Feb 08, 2004 9:26 pm |
|
I'll check on it because it worked for me so you probably have a little different setup. I'll get back to you soon .... |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 15311 Location: Kansas
|
Posted:
Sun Feb 08, 2004 10:16 pm |
|
OK, I modified the code in my above posts and you have confirmed it now works Thanks! |
|
|
|
 |
minx Client

Joined: Dec 25, 2003 Posts: 16
|
Posted:
Tue Feb 10, 2004 1:04 am |
|
Works brilliantly and means a lot less work for me-cheers Raven!!  |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 15311 Location: Kansas
|
Posted:
Tue Feb 10, 2004 6:52 am |
|
I'm going to make this into an Admin mod with some extras. |
|
|
|
 |
|
|
|
|