Solved

Show a count of registered users in Drupal 7

Posted on 2014-10-30
2
46 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

734 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