Temp Ban

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply

Rating:

Excellent!
16
84%
Very Good
2
11%
Good
0
No votes
Fair
0
No votes
Poor
1
5%
 
Total votes: 19

Extensions Robot
Extensions Robot
Extensions Robot
Posts: 28012
Joined: Sat Aug 16, 2003 7:36 am

Temp Ban

Post by Extensions Robot » Mon Aug 21, 2006 6:45 pm

Modification name: Temp Ban
Author: eviL<3
Modification description: This MOD adds the option of temporary user, ip, and email bans.
Modification version: 1.1.5
Tested on phpBB version: 2.0.22

Download file: tempban_1_1_5.zi
File size: 66136 Bytes

Modification overview page: View


Selected tags:
  1. category
    1. Admin Tools
  2. phpbb
    1. 2.0.21
    2. 2.0.22
Support for this modification needs to be asked within this topic. The phpBB Team is not responsible or required to give anyone support for this modification. By installing this MOD, you acknowledge that the phpBB Support Team or phpBB MODifications Team may not be able to provide support.

This MOD has only been tested by the phpBB MOD Team with the phpBB version listed in the topic. It may not work in any other versions of phpBB.
Last edited by Extensions Robot on Mon Jul 02, 2007 6:51 pm, edited 2 times in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Sat Sep 09, 2006 12:03 pm

MOD Validated/Released

Notes:
This MOD allows admins to perform temporary ban with a configurable time frame.

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Sat Sep 09, 2006 12:19 pm

Thanks for the validation ycl6!

Demo:
Image

Notes:
Upgraders from 1.0.1
Last edited by igorw on Wed Nov 15, 2006 1:05 pm, edited 2 times in total.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

hemar
Registered User
Posts: 4
Joined: Sat Jan 17, 2004 12:24 am

Post by hemar » Sun Sep 17, 2006 10:52 am

CooL :] and works.

seantheman
Registered User
Posts: 20
Joined: Sun Jul 30, 2006 4:44 am

Post by seantheman » Sun Sep 17, 2006 3:36 pm

Not that bad of an idea lol


Nice

-Sean

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Wed Sep 20, 2006 1:29 pm

I submitted an updated version (1.1.2) today, that will show the user, when his ban expires. Here's how it will look like:

Image
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

Gimpster
Registered User
Posts: 1
Joined: Tue Sep 19, 2006 5:57 pm
Location: Des Moines, IA
Contact:

Post by Gimpster » Wed Sep 20, 2006 6:34 pm

I appreciate your submitting this mod, we've had problems with users abusing some forums rules... and a nice "vacation" is just what the doctor ordered :)

Would it be possible to add a REASON for the temporary ban, or is that a pain?

Looking forward to the 1.1.2 mini-update.

dragsource.net
Registered User
Posts: 1
Joined: Wed Sep 20, 2006 6:38 pm

Post by dragsource.net » Wed Sep 20, 2006 6:45 pm

Or perhaps have it autosend a PM so when they log back in it shows them the reason. Don't know how difficult this would be.

deejaybet
Registered User
Posts: 1814
Joined: Thu Dec 08, 2005 2:01 pm
Location: Derry, Northern Ireland
Contact:

Post by deejaybet » Wed Sep 20, 2006 6:57 pm

if you use evil<3 ban reasons mod with this then i would guess they would work together :)

e-mo
Registered User
Posts: 90
Joined: Tue Oct 01, 2002 2:54 pm

Post by e-mo » Wed Sep 20, 2006 8:07 pm

No need to guess...I know it :)

it is working cuz I did install all his mods..the temp ban and also Reason Ban..

e-mo
deejaybet wrote: if you use evil<3 ban reasons mod with this then i would guess they would work together :)
...with great power...comes great responsibilities...

Looking help for this Mod Problem: http://www.phpbb.com/community/viewtopi ... &start=165

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Wed Sep 20, 2006 8:48 pm

Gimpster: Yes, you could use ban reasons, as it has been suggested by deejaybet and e-mo. The two MODs work very well together.

dragsource.net: Yes, it would be possible to send a PM. I'll look into that later ;)


There will be some notes for people using the next version of temp ban together with ban reasons, so you can have the custom ban message, and the time until the ban expires :)
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Wed Sep 20, 2006 9:04 pm

Here's an addon for sending a PM:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_user_ban.php

#
#-----[ FIND ]------------------------------------------
#
//
// Load default header

#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Function by wGEric http://www.phpbb.com/phpBB/viewtopic.php?t=175334
function insert_pm(
   $to_id, 
   $message,
   $subject,
   $from_id,
   $html_on = 0,
   $bbcode_on = 1,
   $smilies_on = 1)
{
   global $db, $lang, $user_ip, $board_config, $userdata, $phpbb_root_path, $phpEx;

   if ( !$from_id )
   {
      $from_id = $userdata['user_id'];
   }

   //get varibles ready
   $to_id = intval($to_id);
   $from_id = intval($from_id);
   $msg_time = time();
   $attach_sig = $userdata['user_attachsig'];
   
   //get to users info
   $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active
      FROM " . USERS_TABLE . "
      WHERE user_id = '$to_id'
         AND user_id <> " . ANONYMOUS;
   if ( !($result = $db->sql_query($sql)) )
   {
      $error = TRUE;
      $error_msg = $lang['No_such_user'];
   }

   $to_userdata = $db->sql_fetchrow($result);

   $privmsg_subject = trim(strip_tags($subject));
   if ( empty($privmsg_subject) )
   {
      $error = TRUE;
      $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_subject'];
   }

   if ( !empty($message) )
   {
      if ( !$error )
      {
         if ( $bbcode_on )
         {
            $bbcode_uid = make_bbcode_uid();
         }

         $privmsg_message = prepare_message($message, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
         $privmsg_message = str_replace('\\\n', '\n', $privmsg_message);

      }
   }
   else
   {
      $error = TRUE;
      $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_message'];
   }

   //
   // See if recipient is at their inbox limit
   //
   $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time
      FROM " . PRIVMSGS_TABLE . "
      WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
            OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " 
            OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
         AND privmsgs_to_userid = " . $to_userdata['user_id'];
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_MESSAGE, $lang['No_such_user']);
   }

   $sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : '';

   if ( $inbox_info = $db->sql_fetchrow($result) )
   {
      if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )
      {
         $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . "
            WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
                  OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
                  OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "  )
               AND privmsgs_date = " . $inbox_info['oldest_post_time'] . "
               AND privmsgs_to_userid = " . $to_userdata['user_id'];
         if ( !$result = $db->sql_query($sql) )
         {
            message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql);
         }
         $old_privmsgs_id = $db->sql_fetchrow($result);
         $old_privmsgs_id = $old_privmsgs_id['privmsgs_id'];
            
         $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
            WHERE privmsgs_id = $old_privmsgs_id";
         if ( !$db->sql_query($sql) )
         {
            message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)'.$sql, '', __LINE__, __FILE__, $sql);
         }

         $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TEXT_TABLE . "
            WHERE privmsgs_text_id = $old_privmsgs_id";
         if ( !$db->sql_query($sql) )
         {
            message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql);
         }
      }
   }

   $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)
      VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\'", "''", $privmsg_subject) . "', " . $from_id . ", " . $to_userdata['user_id'] . ", $msg_time, '$user_ip', $html_on, $bbcode_on, $smilies_on, $attach_sig)";

   if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )
   {
      message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info);
   }

   $privmsg_sent_id = $db->sql_nextid();

   $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
      VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $privmsg_message) . "')";

   if ( !$db->sql_query($sql, END_TRANSACTION) )
   {
      message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
   }

   //
   // Add to the users new pm counter
   //
   $sql = "UPDATE " . USERS_TABLE . "
      SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " 
      WHERE user_id = " . $to_userdata['user_id'];
   if ( !$status = $db->sql_query($sql) )
   {
      message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
   }

   if ( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] )
   {
      $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
      $script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx;
      $server_name = trim($board_config['server_name']);
      $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
      $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';

      include($phpbb_root_path . 'includes/emailer.'.$phpEx);
      $emailer = new emailer($board_config['smtp_delivery']);
               
      $emailer->from($board_config['board_email']);
      $emailer->replyto($board_config['board_email']);

      $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
      $emailer->email_address($to_userdata['user_email']);
      $emailer->set_subject($lang['Notification_subject']);
               
      $emailer->assign_vars(array(
         'USERNAME' => $to_username,
         'SITENAME' => $board_config['sitename'],
         'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',

         'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox')
      );

      $emailer->send();
      $emailer->reset();
   }

   return;
   
   $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

   message_die(GENERAL_MESSAGE, $msg);

} // insert_pm()

#
#-----[ FIND ]------------------------------------------
#
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
			}

#
#-----[ AFTER, ADD ]------------------------------------------
#
			insert_pm ( $user_list[$i], 'You have been banned from ' . $board_config['sitename'] . ' temporarily, for the following reason:' . "\n\n" . $ban_reason, 'Reason for temporary ban', $userdata['user_id'] )
The language is hardcoded for now. The first argument of insert_pm(), is the id of the user geting the PM ($user_list[$i]). Second is the message in the PM. Third is the title, and the forth is the senders user ID.

If i put this in the next release, i'll add language variables. Please tell me if it works, as i havn't had time to test it.


Thanks! :)
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

Flashhh!
Registered User
Posts: 11
Joined: Thu Oct 05, 2006 3:10 am

I have problems to find part of the code

Post by Flashhh! » Thu Oct 05, 2006 3:12 am

Hello, I cant find this part of code on functions.php:

Code: Select all

#-----[ OPEN ]------------------------------------------ 
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------ 
#
?>
#
I have 2.021 but ?> is not in functions.php!!

Also I cant find in admin_user_ban.php:

Code: Select all

#-----[ FIND ]------------------------------------------ 
#
		$select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
So I think is not for 2.021.....

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Re: I have problems to find part of the code

Post by igorw » Thu Oct 05, 2006 3:25 pm

Flashhh! wrote: Hello, I cant find this part of code on functions.php:

Code: Select all

#-----[ OPEN ]------------------------------------------ 
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------ 
#
?>
#
I have 2.021 but ?> is not in functions.php!!

Also I cant find in admin_user_ban.php:

Code: Select all

#-----[ FIND ]------------------------------------------ 
#
		$select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
So I think is not for 2.021.....


For some reason your editor converted those characters to html. The actual lines are:

Code: Select all

#
#-----[ FIND ]------------------------------------------ 
#
?>
And:

Code: Select all

#
#-----[ FIND ]------------------------------------------ 
#
		$select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
Try using an other text editor to view the file ;)
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

Flashhh!
Registered User
Posts: 11
Joined: Thu Oct 05, 2006 3:10 am

Post by Flashhh! » Fri Oct 06, 2006 7:36 pm

Evil this is a great MOD!, you were right about my text editor but now I have another problem: I dont know what Im making wrong:

Image

I cant see Minutes, weaks, etc.... Any Ideas?

Post Reply

Return to “[2.0.x] MOD Database Releases”