Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
minx
Client



Joined: Dec 25, 2003
Posts: 16

PostPosted: Sun Feb 08, 2004 12:05 am Reply with quote

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:)
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Feb 08, 2004 2:39 am Reply with quote

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 Smile
Raven


Last edited by Raven on Sun Feb 08, 2004 10:29 pm; edited 5 times in total 
View user's profile Send private message
minx







PostPosted: Sun Feb 08, 2004 9:09 pm Reply with quote

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? Embarassed Crying or Very sad
 
Raven







PostPosted: Sun Feb 08, 2004 9:26 pm Reply with quote

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







PostPosted: Sun Feb 08, 2004 10:16 pm Reply with quote

OK, I modified the code in my above posts and you have confirmed it now works Smile Thanks!
 
minx







PostPosted: Tue Feb 10, 2004 1:04 am Reply with quote

Works brilliantly and means a lot less work for me-cheers Raven!! Very Happy
 
Raven







PostPosted: Tue Feb 10, 2004 6:52 am Reply with quote

I'm going to make this into an Admin mod with some extras.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©