Jump to content

  •  

  • Tutorial info Visit support topic

    • Added on: May 22 2009 02:44 PM
    • Date Updated: May 22 2009 03:36 PM
    • Views: 1843


    * * * * *
    1 Ratings

    Ban/Unban members on Mini Profile

    Posted by Adriano Faria on May 22 2009 02:44 PM
    This tutorial will flag the user as BANNED and will keep the member on his original group.

    Open admin\applications\forums\modules_public\moderate\moderate.php and find:

    			default:
    					  $this->_showError();
    				  break;
    Add above:

    			case 'ban_member':
    					 $this->_BanMember();
    				 break;
    				 
    				 case 'unban_member':
    					 $this->_UnBanMember();
    				 break;
    Find:

    	/**
    		  * Save the member updates
    		  *
    		  * @access	private
    		  * @return	void		Outputs error screen
    		  * @todo	 [Future] Determine what items should be editable and allow moderators to edit them
    		  */
    Add above:

    	/**
    		  * (SOS Invision) Ban member on mini profile
    		  *
    		  * @access	private
    		  * @return	void		Outputs error screen
    		  */
    		 private function _BanMember()
    		 {
    			 /* INIT */
    			 $member_id = intval( $this->request['member_id'] );
    			 $toBan	   = array( 'members' => array( 'member_banned' => 1 ) );
    			
    			 /* Load member */
    			 $member = IPSMember::load( $member_id );
    			
    			 if ( ! $member['member_id'] )
    			 {
    				 $this->_showError( 'moderate_no_permission', 10311900 );
    			 }
    	
    			 /* Not a mod? */
    			 if ( ! $this->memberData['g_access_cp'] )
    			 {
    				 $this->_showError( 'moderate_no_permission', 10311900 );
    			 }
    	
    			 /* Admin? */
    			 if ( $member['member_group_id'] == $this->settings['admin_group'] )
    			 {
    				 $this->_showError( 'mod_admin_edit', 10311901 );
    			 }
    			 
    			 /* Already banned? */
    			 if ( $member['member_banned'] == 1 )
    			 {
    				 $this->_showError( 'already_banned', 10311901 );
    			 }
    			
    			 /* Ban member */
    			 IPSMember::save( $member_id, $toBan );
    			
    			 /* Redirect */
    			 if( $this->topic['tid'] )
    			 {
    				 $this->registry->output->redirectScreen( $this->lang->words['member_banned'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&st=" . intval($this->request['st']), $this->topic['title_seo'] );
    			 }
    			 else
    			 {
    				 $this->registry->output->redirectScreen( $this->lang->words['member_banned'], $this->settings['base_url'] . "showuser=" . $member['member_id'], $member['members_seo_name'] );
    			 }
    			
    		 }
    	
    		 /**
    		  * (SOS Invision) Unban member on mini profile
    		  *
    		  * @access	private
    		  * @return	void		Outputs error screen
    		  */
    		 private function _UnBanMember()
    		 {
    			 /* INIT */
    			 $member_id = intval( $this->request['member_id'] );
    			 $toUnBan	   = array( 'members' => array( 'member_banned' => 0 ) );
    			
    			 /* Load member */
    			 $member = IPSMember::load( $member_id );
    			
    			 if ( ! $member['member_id'] )
    			 {
    				 $this->_showError( 'moderate_no_permission', 10311900 );
    			 }
    	
    			 /* Not a mod? */
    			 if ( ! $this->memberData['g_access_cp'] )
    			 {
    				 $this->_showError( 'moderate_no_permission', 10311900 );
    			 }
    	
    			 /* Unban member */
    			 IPSMember::save( $member_id, $toUnBan );
    			
    			 /* Redirect */
    			 if( $this->topic['tid'] )
    			 {
    				 $this->registry->output->redirectScreen( $this->lang->words['member_unbanned'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&st=" . intval($this->request['st']), $this->topic['title_seo'] );
    			 }
    			 else
    			 {
    				 $this->registry->output->redirectScreen( $this->lang->words['member_unbanned'], $this->settings['base_url'] . "showuser=" . $member['member_id'], $member['members_seo_name'] );
    			 }
    			
    		 }
    Find:

    		$not_forum_array	= array( 'editmember', 'doeditmember' );
    Change to:

    		$not_forum_array	= array( 'editmember', 'doeditmember', 'ban_member', 'unban_member' );
    Open Look & Feel -> your skin -> Profile -> showcard.

    Find:

    			<if test="cardGallery:|:$member['has_gallery'] AND IPSLib::appIsInstalled( 'gallery' )">
    					 <li><a href='{parse url="app=gallery&module=user&section=user&user={$member['member_id']}" base="public"}' title='{$this->lang->words['view_gallery']}'>{parse replacement="gallery_link"}</a></li>
    				 </if>
    Add below:

    			<if test="$this->memberData['g_access_cp'] == 1">
    					 <if test="$member['member_banned'] == 0">
    						 <li><a title='Banir este membro' href='{$this->settings['base_url']}&app=forums&module=moderate&section=moderate&do=ban_member&member_id={$member['member_id']}&auth_key={$this->member->form_hash}'">{parse replacement="ban_member_miniprofile"}</a></li>
    					 <else />
    						 <li><a title='Desbanir este membro' href='{$this->settings['base_url']}&app=forums&module=moderate&section=moderate&do=unban_member&member_id={$member['member_id']}&auth_key={$this->member->form_hash}'">{parse replacement="unban_member_miniprofile"}</a></li>
    					 </if>
    				 </if>
    Save.

    On Look & Feel, go to Import / Export. On Import Replacements, import the XML on this zip:

    Attached File  Macros_Ban_Unban_Members.zip   360bytes   121 downloads

    Yet on Look & Feel, go to Manage Language, on Upload language pack from your computer, import the XML on this zip:

    Attached File  Language__Ban_Unban_Members.zip   520bytes   108 downloads

    Upload those images to public/style_images/master folder:

    Attached File  images.zip   7.49K   95 downloads

    That's how it should look:

    Attached Image: imagem.PNG

    Notes:

    • Only users that have access to Admin CP can view, ban and unban users
    • Admins are protected

    Powered by Tutorials 1.3.1 © 2012, by Michael McCune