Posted on: 12/20/09 12:29pm
By: kilerb
But without a link to the list?
Basically a non-clickable number in a sentence that says "This site is up to XXX members and counting!" or something like that. I'd rather them not be able to see the list though.
Thanks!
Re: Is there a way to display how many users my site has?
Posted on: 12/20/09 02:21pm
By: ofey
The following php will give you the number of registered users to your site. Create a staticpage with php enabled with:
Text Formatted Code
global $_TABLES;
$count = DB_Count($_TABLES['users']) - 1;
echo " $count ";
This will count the number of rows in the table with all the users. The -1 is to take out the anonymous user.
Then use an autotag if geeklog supports them
[code] [ staticpage_content:pageID ] [\code]
This autotag just goes into the article or where ever you want the variable which is the number of registered users. The page ID is the ID for the staticpage you created.
Geeklog autotag documentation http://www.geeklog.net/docs/english/staticpages.html#autotags.
Shane
Re: Is there a way to display how many users my site has?
Posted on: 12/20/09 02:23pm
By: Dirk
Where do you want to display that? For a side block, you could create a simple PHP function and display it in a PHP block. Otherwise, use CUSTOM_templateSetVars to define a new template variable (see sample code in lib-custom.php).
For a simple count, use something like
Text Formatted Code
$num_users = DB_count($_TABLES['users']) - 1;
(the -1 is to not count the Anonymous user account). That would also include all users who were banned or created an account but never logged in. Too lazy now to look up how to exclude those, sorry :wink:
bye, Dirk
Re: Is there a way to display how many users my site has?
Posted on: 12/20/09 02:42pm
By: kilerb
Thanks Ofey and Dirk... What's the echo line for in yours Ofey?
I'd almost like it to be in the header or a sideblock would be cool if it didn't take too much room. I'd like it to be sort of big... (The number, not necessarily the text before it...)
Like this...
<small font>This site now has
<big font>XXX
<small font>members, and counting!
All centered..
Re: Is there a way to display how many users my site has?
Posted on: 12/20/09 03:15pm
By: ofey
Hi kilerb,
The echo prints the number of registered users to a staticpage. Without it your staticpage would have no content. Then the autotag takes the content of that staticpage which in this case is the number of registered users and puts it where you want it or wherever you put the staticpage_content autotag. You will end up using:
<small font>This site now has
<big font>[ staticpage_content:pageID]
<small font>members, and counting!
I would advise you first to create the staticpage and make sure it is working correctly first, then add the autotag to you block.
Let us know how you get on.
Thanks,
Shane
Re: Is there a way to display how many users my site has?
Posted on: 12/20/09 07:11pm
By: kilerb
Thanks! Worked great... How can I make the number bigger or bold?
Thanks again...
Re: Is there a way to display how many users my site has?
Posted on: 12/20/09 07:22pm
By: ofey
Hi,
I imagine basic HTML tags will do it. Something like,
<b>[staticpage....]</b> and so on.
But you should be able to use the advanced editor when writing blocks.
Shane
Re: Is there a way to display how many users my site has?
Posted on: 12/21/09 04:45am
By: kilerb
Thanks a lot, looks great...