By Continental on
I need simply to count all users and show this number somewhere on the page (many be main) of in the hand-made block. I found some useful query
//prepare amount of users
$count_users_tot = db_fetch_array(db_query("SELECT COUNT(uid) FROM {users}"));
but how can I insert in this php-style page? Help, please, I'm php-dummy.
Comments
where ?
where do you want to put this information ?
in a special block ?
or something in your page (theme template)
I think both.
I think both. Does it really matter? I want to write to the main page: "We're ... 1'000'000'000 users =)" and somewhere in block like "Total users: 3" to show it on different pages I choose.
so,
it should be special block and
it should be php-code I insert along other informatino on the main (custom page). not theme! I don't want it to show everythere.
PHP filter
so use PHP filter in your custom block or page, and add the following code:
ps. sorry for not answering for a such time :/
thank you. =) It wasn't
thank you. =) It wasn't priority, but now I have a nice statistics block... I also need to count photos from gallery (menalto) in the same way, if anybody can get me a tip how to do it I'll really appreciate it (however, it's only hald drupal issue... mostly gallery).
Thank You!
Plugged your code in a block and it worked beautifully! Exactly what I needed....
Thanks.
how can I count only
how can I count only authenticated users?
authenticated users
$count_users_tot = db_result(db_query("SELECT COUNT(uid) FROM {users} where status > 0"));
Hal Eagar
Software Architect
hal.eagar@door3.com
Drupal 7.7
Would this work with drupal 7.7
im having errors when i paste your codes on a block and have a php code config.
thank you.
this works for me
(remove line break!)
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
How to save in view without fields?
Is there a way to save this in a view in the header, without any fields? If so, what is the correct view format that will accept the code without requiring any fields to save it?
I do not really understand
I do not really understand why you want to use a view. However there is a module which allows you to add a custom php field to a view. This code in a custom php field could, I am guessing, be the only field in your view.
Obviously you can display the out of a view which has a 'block' display in your header, if your theme has a header region.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Hello kuba. Is there a way to
Hello kuba. Is there a way to modify this to only display the number of users of a certain role?