Firefox PHP

Module: Block User

Posted by Thomas Seifert 
All files from this thread

File Name File Size   Posted by Date  
block_user-v1.0.0.zip 5.5 KB open | download Thomas Seifert 01/30/2011 Read message
block_user-v1.0.0.tar.gz 3.6 KB open | download Thomas Seifert 01/30/2011 Read message
Module: Block User
January 30, 2011 02:08PM
Module  : Block User
Author  : Thomas Seifert

Allows administrators to handle misbehaving or spammy users by:
- blocking them in a specific (sub-)forum (no post possible)
- blocking them in the whole phorum (no post possible)
- disabling them (no login possible)

- deleting all their posts

That action can be done by clicking a link in the user profile and selecting
the options on the followup page.


Installation:
-------------

- Unpack the archive;

- Move the directory "block_user" to the directory "mods"
  within your Phorum installation;

- Login as administrator in Phorum's administrative interface and
  go to the "Modules" section;

- Enable the module "Block User".


Notes:
------

As deleting all messages of a user is a time consuming task in the database 
the deletion is only done up to 100 messages for the user. Usually spam users
don't have that many messages (yet).


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Attachments:
open | download - block_user-v1.0.0.zip (5.5 KB)
open | download - block_user-v1.0.0.tar.gz (3.6 KB)
Re: Module: Block User
September 11, 2011 01:56AM
This did not work for me. array_keys() seems to be returning index values, not message ids as keys. I have to suspect it is a problem with phorum_db_search. It also seems (to me) that the first value in the array for a message is the message id (I'm not a phorum expert by any means). So I use reset() to grab it and pass it to the delete function call.

I modified the delete loop as follows (sorry but the code indents got lost in my copy/paste):

original code (in this mod):

if(!empty($_POST['delete_posts'])) {
$userposts = phorum_db_search('', $uid, false, 0, 100, 'USER_ID', 0, 'ALL');
$message_ids = array_keys($userposts['rows']);
$deleted=0;
foreach($message_ids as $mid) {
//phorum_db_delete_message($mid,PHORUM_DELETE_MESSAGE);
$deleted++;
}
$okmsgs[]=str_replace('%postcount%',$deleted,$PHORUM["DATA"]["LANG"]["mod_block_user"]['MsgDeletePosts']);
}



my corrected code:


if(!empty($_POST['delete_posts'])) {
$userposts = phorum_db_search('', $uid, false, 0, 100, 'USER_ID', 0, 'ALL');
$usermessages = $userposts['rows'];
$deleted=0;
foreach($usermessages as $usermessage) {
$mid = reset($usermessage);
phorum_db_delete_message($mid,PHORUM_DELETE_MESSAGE);
$deleted++;
}
$okmsgs[]=str_replace('%postcount%',$deleted,$PHORUM["DATA"]["LANG"]["mod_block_user"]['MsgDeletePosts']);
}

Paul
Re: Module: Block User
September 11, 2011 09:41AM
what phorum version are you using?


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: Block User
September 11, 2011 03:55PM
whoops, i forgot to mention that. 5.2.7
Re: Module: Block User
September 11, 2011 05:15PM
Upgrade to a recent version and you won't have to modify the module - beside fixing other issues.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: Block User
March 27, 2012 01:18PM
Dear Thomas,
thank you for the mod, but what to do to activate theese panished users again?

Or maybe to deactivate them just for some time: a week or month?



Edited 1 time(s). Last edit at 03/27/2012 02:27PM by Svirvic.
Re: Module: Block User
March 27, 2012 10:55PM
you will have to do that in the admin - edit users panel.
no timeframe for banning is implemented as it was merely thought for handling spam more quickly.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: Block User
March 28, 2012 08:39AM
Thank You, Thomas for your early reply.

Really, smart mod. Suppose it would be useful to make the mod accessible not only for admins, but for moderators also. In that case what should I do to make it possible? I think it's not too complicated, but have not found yet solution for the problem.

That's the first question, the second one is:
if so, isn't it possible to give the moderators some tool for forgiving poor punished user?

Thank You, very much
Re: Module: Block User
March 29, 2012 07:50AM
Everything is possible but its implemented for some use case and I have no current plans (or time) to develop it further. Everyone can continue that though.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Sorry, only registered users may post in this forum.

Click here to login