Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Number of Registered Users in Statistics Bar  (Read 16921 times)

0 Members and 1 Guest are viewing this topic.

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Number of Registered Users in Statistics Bar
« on: October 17, 2007, 03:51:36 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 your files first.

Step 2:

Preparation:

Open themes/sample/theme.php

find: at line 224

Code: [Select]
<!-- 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

Code: [Select]
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:

Code: [Select]
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:

Code: [Select]
$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:

Code: [Select]
<!-- BEGIN footer -->
        <tr>
                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->

Replace with:

Code: [Select]
<!-- 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.
« Last Edit: October 18, 2007, 08:19:29 am by GauGau »
Logged
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: Number of Registered Users in Statistics Bar
« Reply #1 on: October 17, 2007, 04:15:55 pm »

Good idea and nice work. But by displaying it like this it looks like only registered users can view the pictures. So either that option has been set and normal unregistered users do not see anything or you should maybe make it like "339 files in 94 albums and 10 categories with 169 comments viewed 22444 times and we have 1321 registered users "

Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Number of Registered Users in Statistics Bar
« Reply #2 on: October 17, 2007, 05:03:20 pm »

I see what you mean Hein. If you wish to change the "by X registered users " edit as follows:

find the

Code: [Select]
<td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS} by <strong>{REG_USR}</strong> registered users </span></td>

section, and change the text around
Code: [Select]
<strong>{REG_USR}</strong>
for example if you wished to have: "and we have X registered users"

use this code:

Code: [Select]
<td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS} and we have <strong>{REG_USR}</strong> registered users </span></td>

Thanks for the suggestion Hein.   
Logged
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

jolly

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Number of Registered Users in Statistics Bar
« Reply #3 on: June 25, 2009, 01:36:37 pm »

I did it, but the number of registered users is not display.
{REG_USR}  shown  nothing.
I cannot post link to my gallery ( bandwidth limit exceed) but i tried on my local copy. Does not work.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Number of Registered Users in Statistics Bar
« Reply #4 on: June 25, 2009, 08:31:55 pm »

You've been told so often how support works ::). When will you start doing as suggested? For the last time: read up board rules and do exactly as suggested there. In this particular case, you should have posted a link to your gallery and a copy of your changes as attachment to your posting.
Logged

jolly

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Number of Registered Users in Statistics Bar
« Reply #5 on: July 01, 2009, 10:04:50 pm »

Does it matter, where this code should be past in theme.php ?
Copy here and there, but still without effect
It seemed to me that this has no significance. My theme.php is already quite heavily modified, and this may be the reason.

Anyway, below you can find attached my theme.php with code. Please, help me, and show what is wrong. My gallery is available at www.foto-wpadka.pl


Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Number of Registered Users in Statistics Bar
« Reply #6 on: July 02, 2009, 02:27:59 pm »

1) Your gallery is outdated
2) Your gallery contains adult content. As per board rules, you should have posted a warning with the link.
3) The "Powered by Coppermine" tag has deliberately been disabled (setting the font size to zero), which is a licence breach and a sign of stupidity
4) The google analytics code has been applied improperly, which is unrelated, but silly just as well
5) Tracking your user account shows that you probably are the same person as the banned user nidhhog, so you have been under observation anyway.

I'm fed up with you. You are banned from this forum permanently. Do not dare to re-register. Restore the Coppermine credits immediately or uninstall coppermine from your website.
Logged

uag uag

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Number of Registered Users in Statistics Bar
« Reply #7 on: July 02, 2009, 03:51:42 pm »

-I do not offend you.
-Please, dont call me " stupid" because i am not.
-The fact, you are some kind of "guru" here, does not give you right to offend me.
-Size of font is not set to 0. Tag was moved permanently.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Number of Registered Users in Statistics Bar
« Reply #8 on: July 04, 2009, 12:07:41 am »

I told you that you're not allowed to re-register, yet you did, even using a mockery of my nickname. Don't behave like a moron again. Just go away and stay away.
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.