Jump to content

  •  

  • Tutorial info Visit support topic

    • Added on: Mar 25 2009 01:17 AM
    • Date Updated: Mar 25 2009 10:18 AM
    • Views: 2366
     


    * * * * *
    1 Ratings

    (IM) Group Name Indicator: legend of groups that only has users online

    Posted by Adriano Faria on Mar 25 2009 01:17 AM
    This tutorial will show only the group legend to those groups who has users online on that moment.

    Open php file that begins with groupNameIndicator on hooks folder, on forum root directory.

    Find:

    		this->registry = ipsRegistry::instance();
    		$this->cache	= $this->registry->cache();
    Add below:

    		$this->DB		= $this->registry->DB();
    Find:

    		$data = array();
    Add above:

    		$this->DB->build( array( 'select' => 'member_group, count(member_id) as cnt', 'from' => 'sessions', 'group' => 'member_group' ) );
       
    		 $this->DB->execute();
       
    		 while ( $row = $this->DB->fetch() )
    		 {
    			   $grupos[ $row['member_group'] ] = $row['cnt'];
    		 }
    Find:

    			if ( isset( $group['g_display'] ) && $group['g_display'] )
    			   {
    				   $data[ $group['g_display'] ] = "<a href='" . $this->registry->getClass( 'output' )->buildSEOUrl( 'app=members&amp;section=view&amp;module=list&amp;filter='.$id, 'public', $group['g_title'] ) . "'>" . IPSLib::makeNameFormatted( $group['g_title'], $id ) . "</a>";
    			   }
    Change to:

    			if ( isset( $group['g_display'] ) && $group['g_display'] )
    			   {
    				   if ( $grupos[$id] > 0 )
    				   {
    					   $data[ $group['g_display'] ] = "<a href='" . $this->registry->getClass( 'output' )->buildSEOUrl( 'app=members&amp;section=view&amp;module=list&amp;filter='.$id, 'public', $group['g_title'] ) . "'>" . IPSLib::makeNameFormatted( $group['g_title'], $id ) . "</a>";
    				   }
    			   }
    Screenshot:

    Posted Image
    There's only one 1 user online, so only the legend of his group will be displayed.


    Powered by Tutorials 1.4.1 © 2012, by Michael McCune