Sign in to follow this  
Followers 0

Number of members using each skin in dropdown (IPB 3.3.x)


This tutorial will show you how to add the number of members using each skin in the skin dropdown.

[img]http://i32.tinypic.com/91ctqt.jpg[/img]

Open admin/sources/classes/output/formats/html/htmlOutput.php
Find: in function html_fetchSetsDropDown )
[code]
//-----------------------------------------
// Go get 'em
//-----------------------------------------[/code]

Add ABOVE:

[code] //-----------------------------------------
// Skin Dropdown Member Count by Devfuse
//-----------------------------------------

$this->DB->build( array(
'select' => 'sc.set_id',
'from' => array( 'skin_collections' => 'sc' ),
'group' => 'sc.set_id',
'add_join' => array(
array(
'select' => 'count(m.skin) as total_skins',
'from' => array( 'members' => 'm' ),
'where' => "m.skin=sc.set_id",
'type' => 'left',
)
)
) );
$this->DB->execute();

$skin_count = array();
while( $skin = $this->DB->fetch() )
{
$skin_count[ $skin['set_id'] ] = $skin['total_skins'];
}[/code]

Find: ( in function html_fetchSetsDropDown )

[code] /* Ok to add... */
$output[] = array( 'id' => $data['set_id'], 'depth' => $depthMarkers, 'title' => $data['set_name'], 'selected' => $_selected );[/code]

Replace With:
[code] /* Ok to add... */
$output[] = array( 'id' => $data['set_id'], 'depth' => $depthMarkers, 'title' => $data['set_name'], 'selected' => $_selected, 'count' => $skin_count[ $data['set_id'] ] );[/code]

Save admin/sources/classes/output/formats/html/htmlOutput.php

Open ACP > Look & Feel Tab > select skin > Global Templates > globalTemplate

Find:
[CODE]<a href='#' data-clicklaunch='changeSkin' data-skinid='{$skin['id']}'>{$skin['title']}</a>[/CODE]

Replace With:
[CODE]<a href='#' data-clicklaunch='changeSkin' data-skinid='{$skin['id']}'>{$skin['title']} ({$skin['count']})</a>[/CODE]

Save Template.



0 Comments

There are no comments to display.