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:
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&section=view&module=list&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&section=view&module=list&filter='.$id, 'public', $group['g_title'] ) . "'>" . IPSLib::makeNameFormatted( $group['g_title'], $id ) . "</a>";
}
}
Screenshot:
There's only one 1 user online, so only the legend of his group will be displayed.













