Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-11168

Prevent the admin when an user is already banned

XMLWordPrintable

      Hi,
      Wouldn't it be better to prevent the admin or the moderator when this one wants to ban an user, who already is ?
      I have made that small code to check the user id before the confirm action :

      #
      #-----[ OPEN ]------------------------------------------------
      #
      includes/mcp/mcp_ban.php
      #
      #-----[ FIND ]------------------------------------------------
      #
      				if (confirm_box(true))
      #
      #-----[ BEFORE, ADD ]-----------------------------------------
      #
      				if ( $mode === 'user' )
      				{
      					$sql = 'SELECT user_id
      						FROM ' . USERS_TABLE . "
      						WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($ban)) . "'";
      					$result = $db->sql_query($sql);
      					$user_id = (int) $db->sql_fetchfield('user_id');
      					$db->sql_freeresult($result);
       
      					if ( !empty($user_id) )
      					{
      						trigger_error($user->lang['BAN_ALREADY_ENTERED'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
      					}
      				}
      #
      #-----[ SAVE/CLOSE ALL FILES ]--------------------------------
      #
      # EoM
      

            Marc Marc
            ABDev Adrien Bonnel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: