Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 09:36 pm EST
Geeklog Forums
Is there a way to display how many users my site has?
Status: offline
kilerb
Forum User
Regular Poster
Registered: 03/19/08
Posts: 119
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!
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!
9
8
Quote
Status: offline
ofey
Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
The following php will give you the number of registered users to your site. Create a staticpage with php enabled with:
$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
Those who say it can't be done, are usually interrupted by others doing it.
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
Those who say it can't be done, are usually interrupted by others doing it.
10
9
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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
(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
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
11
11
Quote
Status: offline
kilerb
Forum User
Regular Poster
Registered: 03/19/08
Posts: 119
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..
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..
28
12
Quote
Status: offline
ofey
Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
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
Those who say it can't be done, are usually interrupted by others doing it.
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
Those who say it can't be done, are usually interrupted by others doing it.
7
12
Quote
Status: offline
ofey
Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
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
Those who say it can't be done, are usually interrupted by others doing it.
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
Those who say it can't be done, are usually interrupted by others doing it.
12
10
Quote
All times are EST. The time is now 09:36 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content