View Full Version : Moderators Functions - Ban Users from a Thread
MoMan
03-08-2011, 10:00 PM
This is a modification of AcidX's original "Ban Threads User" plugin (https://vborg.vbsupport.ru/showthread.php?t=259017) for vBulletin 3.7. It has been for the most part rewritten with a focus on performance. Major changes include:
### VERSION HISTORY ###
1.0 (Initial Release)
1.1 (Added mod log actions, now fully phrased)
### FEATURES ###
This plugin allows moderators to ban users from individual threads. To ban a user, the appropriate option should be selected from the dropdown menu within the post. To unban, either clear all thread bans from the moderation tools menu, unban the user through the dropdown, or click on the username at the top of the thread.
Whenever you're viewing a thread from which users have been banned, a list of usernames will be shown at the top of the thread.
This plugin supports permanent bans as well as n-day bans. Valid durations for temporary bans are between 0 and 364 days. The default duration may be set in the "User Banning Options" page, but you can assign custom values by editing the actual ban url and pasting it in your browser.
Moderators will ONLY be able to use this feature in forums for which they can_moderate(). Super mods and admins will be able to use it in all forums.
### HOW THIS DIFFERS FROM THE ORIGINAL ###
*Big-board friendly: does not add any additional queries to showthread, doesn't do unnecessary computation, and stores ban data individually for each thread instead of globally in the datastore. Queries are only made when a user is being banned or unbanned; unserialization is only done if there are any bans within the thread.
*Support for expiring bans: you can choose to ban users permanently or for n days (default # of days is configurable via User Banning Options)
*Easy to oversee: banned usernames are shown at the top of the thread to moderators
*Flexible permissions: any moderator with permissions in a particular forum can use this facility. Not limited to admins or super mods.
*Removed the ability to clear all bans from all threads. If you really need to do this, simply uninstall and reinstall the plugin.
*Removed: global view of all thread bans. Not needed.
### INSTALLATION ###
-Import one product file
-Make 3 template edits
Tested on vBulletin 3.8.7, likely compatible with 3.6.x+, or 4.x with slight code changes.
Installation instructions are attached. Enjoy!
sulasno
03-09-2011, 05:30 AM
will you consider releasing one for vB 4.x.x ?
can I assume that all previous posts made by the banned member will not be removed ?
Zylantex
03-09-2011, 12:32 PM
Do you plan a modification of this code to ban users from a single forum?
That would be a brilliant mod.
MoMan
03-09-2011, 05:50 PM
Do you plan a modification of this code to ban users from a single forum?
That would be a brilliant mod.
This is already supported by vBulletin - just edit the user and disallow access to a forum via access masks :)
MoMan
03-09-2011, 05:52 PM
will you consider releasing one for vB 4.x.x ?
can I assume that all previous posts made by the banned member will not be removed ?
You can try installing this on 4.x- it might work, but I haven't tested it.
All this mod does is prevent the banned user from viewing the thread or replying to it. Therefore, you're right- their posts are never modified.
xorex
03-09-2011, 09:10 PM
install and make template modifications, but i dont see link for ban user :(
tfw2005
03-10-2011, 03:13 PM
In the instructions, the code you say to place in postbit legacy is missing a final </if>. Saving template throws an if/then parsing error. Adding an additional </if> to the end of your new code block fixes it.
tfw2005
03-10-2011, 03:19 PM
Seems to be working otherwise. Thanks for hooking this up for 3.8x, and the addressing performance issues.
inciarco
03-10-2011, 05:36 PM
Is it Possible to Include an Option to Ban Usergroups From a Thread? :confused:
Sometimes in a Forum that All UserGroups (or Some Usergroups) can Access would be Great to be able to Ban an Entire Usergroup from Viewing the Content of Certain Thread or Threads in Particular. ;)
I Hope that Additional Option can be Possible to be Included in an Update. :up:
Thank You Very Much For Sharing this Updated Version of this Great Mod for vB3.8x. :up:
My Best Regards.
:)
klaush
03-10-2011, 07:12 PM
Same here; any idea?
Where have we to put the code in the navbar template?
Thanks for helping!
install and make template modifications, but i dont see link for ban user :(
klaush
03-10-2011, 08:16 PM
Forget my my post; i forgot to edit one template. It´s just working fine!
Thanks for that stuff!
MoMan
03-10-2011, 10:23 PM
In the instructions, the code you say to place in postbit legacy is missing a final </if>. Saving template throws an if/then parsing error. Adding an additional </if> to the end of your new code block fixes it.
Great catch- I've now updated the readme!
MoMan
03-10-2011, 10:29 PM
Is it Possible to Include an Option to Ban Usergroups From a Thread? :confused:
Sometimes in a Forum that All UserGroups (or Some Usergroups) can Access would be Great to be able to Ban an Entire Usergroup from Viewing the Content of Certain Thread or Threads in Particular. ;)
I Hope that Additional Option can be Possible to be Included in an Update. :up:
Thank You Very Much For Sharing this Updated Version of this Great Mod for vB3.8x. :up:
My Best Regards.
:)
I don't plan on implementing such a feature. My philosophy is to implement just one feature per product, but to do it well and with no performance overhead.
With that said, it would only take a few extra lines of code to implement it, but you'd have to add some conditionals to check whether or not a key in $btu represents a userid or a usergroup.
xorex
03-26-2011, 01:35 PM
In the instructions, the code you say to place in postbit legacy is missing a final </if>. Saving template throws an if/then parsing error. Adding an additional </if> to the end of your new code block fixes it.
thanks, now work fine
mary_rose082198
03-29-2011, 04:47 AM
very nice mod ty :)
boggseric
03-29-2011, 04:53 PM
Tagged, does this mod make it easy to see who created the thread ban? I am using AcidX's version currently but as far as I can tell there is no way to see who thread banned a user. Is that possible with this mod?
MoMan
03-29-2011, 08:14 PM
I have written a version 1.1 of this mod which logs who performs the ban using the standard modlog. It has not yet been released, however.
boggseric
03-30-2011, 11:21 AM
I have written a version 1.1 of this mod which logs who performs the ban using the standard modlog. It has not yet been released, however.
Understood, I will watch for that version. Also, if there was an option to enter a reason and notify the user with that info that would be great. The logging however is a great option and is really needed for big boards. Thanks
MoMan
03-30-2011, 05:31 PM
It's pretty much ready to go- I just have to package it. I'll release it when I have some extra time in the very near future.
I'm not planning on adding ban reasons, but you're welcome to re-use the code to implement the feature. The easiest way to do it would be to trigger an AJAX popup before submitting the request to ban the user, and then POST the data to the inlinemod script.
MoMan
04-05-2011, 12:33 AM
New version posted!
nlwin
04-05-2011, 07:20 PM
hi there, is there a upgrade instruction from v1.0 to v1.1?
Also, it is possible to add forum ban option as well? I am a PHP Developer, and if I can get hints, I can code vB plugin.
Thanks.
MoMan
04-06-2011, 11:46 PM
The upgrade instructions are the same as the install instructions :)
Forum bans are already built into vbulletin. Just go your your user editor and modify a user's access masks so that they cannot view the forums you want to ban them from.
GotWalked
04-24-2011, 06:15 PM
I've installed and it doesn't work. All installation instructions have been followed.
GotWalked
04-24-2011, 06:29 PM
The only thing questionable is the last instructions: Open Navbar and append: ect.
Is there a specific place to "append"?? I get NO errors; but I also get nothing from this installation; no erros; failures, ect. Just nothing happens. the options to ban are not there.
HondaStreetCult
04-27-2011, 07:49 PM
I am on the same boat...
Append is to add to the end of something so i thought just add it at the end of the code already in the Navbar section but i get nothing....
The only thing questionable is the last instructions: Open Navbar and append: ect.
Is there a specific place to "append"?? I get NO errors; but I also get nothing from this installation; no erros; failures, ect. Just nothing happens. the options to ban are not there.
GotWalked
04-28-2011, 12:43 AM
I am on the same boat...
Append is to add to the end of something so i thought just add it at the end of the code already in the Navbar section but i get nothing....
I mean, I know what append means and all that...but that is literally the only part of the instructions left open for interpretation... so maybe I'm just a noob and missing something? I've installed every other hack on my forums, I just don't understand why this one is giving me a hard time. Thanks for the reply on the subject. Hopefully it will GET OP's attention and help us out.
HondaStreetCult
04-28-2011, 03:20 AM
I have redone mine like 18 times already and nothing.
GotWalked
04-28-2011, 04:06 AM
Me too. Literally. I've tried everything I personally know and am skilled at;;;which isn't much... but yeah..
c'mon OP
MoMan
05-12-2011, 09:05 PM
If you can't see the options, you must have put the postbit edit in the wrong place. Make sure you double-check that one.
Also, this might sound trivial, but you have to have moderating permissions in the forum you're trying to use this in.
cstreater
07-19-2011, 09:57 PM
I marked this as installed, but there's a big issue in my forums at AndroidCentral. Tapatalk users can still post.
MoMan
07-24-2011, 01:19 PM
I guess you will have to open the php file in tapatalk responsible for adding new posts, and add a call to the newreply_start hook.
I knew that tapatalk was insecure, despite their claims that they go through the vb framework!
MoMan
07-24-2011, 01:25 PM
I just checked reply_post.php in tapatalk and they conveniently have the hook commented out on line 190...
Add this code if you want thread bans to work:
if (!empty($threadinfo['threadbans']))
{
$btu = unserialize($threadinfo['threadbans']);
if (isset($btu[$vbulletin->userinfo['userid']]))
{
if ($btu[$vbulletin->userinfo['userid']][1] == 0)
{
$return = array(6,'invalid thread id');
return return_fault($return);
}
elseif ($btu[$vbulletin->userinfo['userid']][1] > TIMENOW)
{
$return = array(6,'invalid thread id');
return return_fault($return);
}
else
{
unset($btu[$vbulletin->userinfo['userid']]);
$vbulletin->db->query_write('UPDATE ' . TABLE_PREFIX . 'thread SET threadbans = \'' . $vbulletin->db->escape_string(serialize($btu)) . '\' WHERE threadid = ' . $threadinfo['threadid']);
}
}
}
MajorFm.com
07-25-2011, 06:46 AM
I want something similar to this... but
I need a mod that:
1. Doesn't allow any members from usergroup x to see any threads on the forum accept ones from x forum
2. I want a mod that allows an admin to add users to specific threads through thread tools, only then can those users view those threads.
I know in edit permissions or permission masks, you can edit permissions on specific forums but i want this done through the forum and on threads, not forums.
Can someone help with this?
Konstantinos
07-25-2011, 07:26 PM
nice but a global list of all users who have been banned from all threads is usefull, not the way the original mod used to display them.
but maybe in the Admin CP -> View Banned Thread Users or something similar
MoMan
07-25-2011, 08:27 PM
nice but a global list of all users who have been banned from all threads is usefull, not the way the original mod used to dispay them.
but maybe in the Admin CP -> View Banned Thread Users or something similar
It's not a feature that's part of this mod, but there's a relatively efficient way of doing it- just use a query like this:
SELECT threadid, title, threadbans FROM " . TABLE_PREFIX . "thread WHERE threadbans != ''"
And then unserialize threadbans.
cstreater
07-30-2011, 03:50 AM
MoMan -- thanks so much!! My mods were so excited when I installed this and were so upset when I uninstalled it. Now all will be good again :)
Hornstar
08-23-2011, 06:58 AM
How do I make it so only admins can ban users from a thread?
MoMan
08-30-2011, 12:31 AM
In the threadmanage_start hook, change
if (!can_moderate($forumid))
{
print_no_permission();
}
to
if (!is_member_of($vbulletin->userinfo, 6))
{
print_no_permission();
}
viper357
07-04-2013, 07:27 AM
I just checked reply_post.php in tapatalk and they conveniently have the hook commented out on line 190...
Add this code if you want thread bans to work:
if (!empty($threadinfo['threadbans']))
{
$btu = unserialize($threadinfo['threadbans']);
if (isset($btu[$vbulletin->userinfo['userid']]))
{
if ($btu[$vbulletin->userinfo['userid']][1] == 0)
{
$return = array(6,'invalid thread id');
return return_fault($return);
}
elseif ($btu[$vbulletin->userinfo['userid']][1] > TIMENOW)
{
$return = array(6,'invalid thread id');
return return_fault($return);
}
else
{
unset($btu[$vbulletin->userinfo['userid']]);
$vbulletin->db->query_write('UPDATE ' . TABLE_PREFIX . 'thread SET threadbans = \'' . $vbulletin->db->escape_string(serialize($btu)) . '\' WHERE threadid = ' . $threadinfo['threadid']);
}
}
}
Thanks for this. Where must this code be placed? Anywhere in the file? Thanks.
Donkey11
08-04-2013, 08:32 PM
And how can you make a lock to be able to read this topic, but could not write with the withdrawal of the notification banning.???
Help
I can't ban category moderators from other topics
When I'm banned, it warns category moderators like this
"Moderators or Administrators Cannot Be Banned."
Is there a solution to this
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.