By Damion on
I need to get the total number of users in the database and throw it into a block.
All I need is the number - I can manipulate from there. If there are 200 members, I need it to return '200'.
Thanks.
I need to get the total number of users in the database and throw it into a block.
All I need is the number - I can manipulate from there. If there are 200 members, I need it to return '200'.
Thanks.
Comments
=-=
http://drupal.org/node/66638
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Here you go
I have made this block quickly just to get you started!
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
Thanks
Thanks for the snippet.
It looks like it is pulling the "Anon" user as well. I have 5 users and script is showing 6. This will work perfectly for my needs though - just take total users - 1 and I can run my other calculations off that.
Thanks!
do this then
If i'm not mistaken, Anon users have a value of 0. so if you do the following it should work.
I just added the where u.uid > 0 :)
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
Thanks
I appreciate that. I started thinking about that after I subtracted 1 from result, and actually put the code verbatim on my site what you rewrote - just forgot to post back here :)
Thanks again for your help. I think with everyone's help here I may actually be able to 'get' the inner-workings of Drupal.
The more I learn about it- the more I like ;)
Just what I need
Thanks a lot CompShack this is exactly what I was searching for.
Peter Aziz
registered users
this is great, but i don't know where to put the code. i'm using 6.16 and as far as i can tell code for the "who's online" and "online users for the forum (where i'm using this) is found in users.module. i want to put the total registered users between the two, but if i lift the code out from between the
andtags, the page crashes (whiteout). any suggestions would be most appreciated!lanny goodman
You don't need the while loop
You don't need the while loop - just use db_result() instead of db_fetch_object().
London Drupal Developer
Thanks!
Thanks CompShack! This is exactly what I needed, and with the Custom Field Module I was able to integrate this right into views as a custom php field. I would also like to note that with this code, the number that is generated is unformatted. By simply changing "$blog->num" into "number_format($blog->num)" I was able to add commas. Thanks again!
total member Drupal 7
has anyone a work code for Drupal 7 ?
The later code has an error.
Drupal 7 total number of users
Local News Platform Built on Drupal
http://sanangelolive.com/
not sure what to do with this
hi,
i'm not a php programmer. i set up a new block, pasted this code into it, labeled it php code but it doesn't show up. any suggestions? thanks.
lanny
=-=
The block is empty
Just confirming: indeed, this php code doesn't seem to generate the desired info in the block (in fact, the block doesn't even seem to show up)
I put this code into a
DRUPAL 7: I put this code into a new block
and it worked fine.
The block has to have "php code" as input text format
Ensure you have the php filter module enabled!
byebye
A
=-=
Rather than placing that directly into a new block which can cause issues later when upgrading the site ... it is better to place it in a custom block module.
a scaffold for a custom block module can be found in the examples module http://drupal.org/project/examples
Number of users in a block
Hi, here you are the code that creates a block with the number of active users of a Drupal website:
This if the function that returns the number of users
And this is the functions that creates the block
Hope it helps.
Ruben Teijeiro
Drupal Hero