coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: just_some_guy on October 13, 2007, 06:24:02 PM

Title: [MOD] Number of Registered Users in Statistics Bar
Post by: just_some_guy on October 13, 2007, 06:24:02 PM
Number of Registered Users in Statistics Bar
================================

CPG 1.4x

This 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 the files you are going to edit before.

Step 2.  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 XXXXX_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);
    }


Replace XXXX in the code above with your gallery table prefix.

Step 3.

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

DEMO (http://www.mysimtractor.com)

Title: Re: [MOD] Number of Registered Users in Statistics Bar
Post by: François Keller on October 13, 2007, 06:40:33 PM
Not sure you find if ($statistics && count($cat_data) > 0) {
        $template = template_extract_block($template_cat_list, 'footer');
        $params = array('{STATISTICS}' => $statistics);
        echo template_eval($template, $params);
    }
in all theme.php file.  ;)
one more time, the best way to apply a mod is to copy/paste the function you have to modify from the theme/sample/theme.php to the theme.php file from your theme if the function not exist before modifying.Don't modify the include/theme.inc.php file
an other thing:
QuoteReplace XXXX in the code above with your gallery table prefix.
XXXX = $CONFIG['TABLE_PREFIX']
Title: Re: [MOD] Number of Registered Users in Statistics Bar
Post by: just_some_guy on October 13, 2007, 08:00:18 PM
Thanks Frantz.

I cant seem to be able to edit my post, but i will add some instructions here:

If you cant find those sections of code in theme.php then copy the appropriate parts from the sample theme.
You can either replace the XXXX with $CONFIG['TABLE_PREFIX'] or the way mentioned in my first post.
Title: Re: [MOD] Number of Registered Users in Statistics Bar
Post by: just_some_guy on October 13, 2007, 11:15:28 PM
Please can a Dev Member moving this to MODS: Statistics

thanks,
Title: Re: [MOD] Number of Registered Users in Statistics Bar
Post by: Joachim Müller on October 14, 2007, 10:43:45 AM
Please post complete instructions (including the suggested modifications) in a separate posting. The mods board is only for complete, working mods. Yours still needs some tweaks. A mod will move your thread accordingly if applicable anyway.
Title: Re: [MOD] Number of Registered Users in Statistics Bar
Post by: just_some_guy on October 14, 2007, 10:47:30 AM
Sure, thanks GauGau