Number of Registered Users in Statistics Bar
================================
CPG 1.4xThis mod will add the number of registered users to the statistics bar on the main page.
So you will end up with something like this:
"339 files in 94 albums and 10 categories with 169 comments viewed 22444 times by 1321 registered users "This mod is very simple. Here are the instructions:
Step 1:
Its best practice to backup your files first.Step 2:
Preparation:Open themes/sample/theme.php
find: at line 224
<!-- BEGIN footer -->
<tr>
<td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
</tr>
<!-- END footer -->
and paste that code into your theme.php.
find: around line 1443
function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
global $template_cat_list, $lang_cat_list;
if (count($cat_data) > 0) {
starttable('100%');
$template = template_extract_block($template_cat_list, 'header');
$params = array('{CATEGORY}' => $lang_cat_list['category'],
'{ALBUMS}' => $lang_cat_list['albums'],
'{PICTURES}' => $lang_cat_list['pictures'],
);
echo template_eval($template, $params);
}
$template_noabl = template_extract_block($template_cat_list, 'catrow_noalb');
$template = template_extract_block($template_cat_list, 'catrow');
foreach($cat_data as $category) {
if (!isset($category['cat_thumb'])) { $category['cat_thumb'] = ''; }
if (count($category) == 3) {
$params = array('{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1]
);
echo template_eval($template_noabl, $params);
} elseif (isset($category['cat_albums']) && ($category['cat_albums'] != '')) {
$params = array('{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
'{CAT_ALBUMS}' => $category['cat_albums'],
'{ALB_COUNT}' => $category[2],
'{PIC_COUNT}' => $category[3],
);
echo template_eval($template, $params);
} else {
$params = array('{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
'{CAT_ALBUMS}' => '',
'{ALB_COUNT}' => $category[2],
'{PIC_COUNT}' => $category[3],
);
echo template_eval($template, $params);
}
}
if ($statistics && count($cat_data) > 0) {
$template = template_extract_block($template_cat_list, 'footer');
$params = array('{STATISTICS}' => $statistics);
echo template_eval($template, $params);
}
if (count($cat_data) > 0)
endtable();
echo template_extract_block($template_cat_list, 'spacer');
}
And copy that function into your theme.php
Editing - If you have the above content in your theme.php file then you will not need to copy from the sample theme.php.
This will involve editing the content you pasted from the sample theme.php.
Step 3. Open theme.php
Find:
if ($statistics && count($cat_data) > 0) {
$template = template_extract_block($template_cat_list, 'footer');
$params = array('{STATISTICS}' => $statistics);
echo template_eval($template, $params);
}
Replace with:
$result = mysql_query("SELECT * FROM {$CONFIG['TABLE_PREFIX']}users");
$reg_usr = mysql_num_rows($result);
if ($statistics && count($cat_data) > 0) {
$template = template_extract_block($template_cat_list, 'footer');
$params = array('{STATISTICS}' => $statistics,
'{REG_USR}' => $reg_usr,
);
echo template_eval($template, $params);
}
Step 4.
Find:
<!-- BEGIN footer -->
<tr>
<td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
</tr>
<!-- END footer -->
Replace with:
<!-- BEGIN footer -->
<tr>
<td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS} by <strong>{REG_USR}</strong> registered users </span></td>
</tr>
<!-- END footer -->
And there you go, finished,
just_some_guy
If a Dev Team Member would move this to the Mods Statistics section that would be great.
Thanks Frantz for the notice about the $CONFIG.