Solved

Show a count of registered users in Drupal 7

Posted on 2014-10-30
2
21 Views
Last Modified: 2016-05-25
Hello
I want to display a count of approved users in a Drupal 7 site. I'm using PHP to do this.
I have the following
<?php $members = db_query("SELECT count(uid) FROM {users}")->fetchField(); echo "$members"; ?> 

Open in new window

This is giving me all members, approved or not. How do I show only the members that have been approved for membership?

Thank you
0
Comment
Question by:itkadmin
2 Comments
 
LVL 13

Accepted Solution

by:
Arrow_1 earned 500 total points
ID: 40414221
This will give you the active users:
<?php
$members = db_query("SELECT count(uid) FROM {users} WHERE status > 0")->fetchField();
echo "There are $members active users";
?>

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now