Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to display the registered members count for today in BuddyPress. Something like:

20 new members registered today

I have no clue where to start, so I cannot provide any code yet :(

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted
function bp_registrations_today($activated = false) {
    global $wpdb;

    $query = "SELECT COUNT(ID) FROM {$wpdb->prefix}users WHERE DATE(user_registered) = CURDATE()";

    if ( $activated ) {
        $query .= " AND user_status = 0";
    }

    return $wpdb->get_var($query);
}

To get the number of users registered today, call the function as

echo bp_registrations_today();

To get the number of users registered today with activated accounts, call the function as

echo bp_registrations_today(true);
share|improve this answer
    
Thank You Chittaranjan, will check it out tonight and will write here the result !! –  Daniel Foltynek Nov 29 '13 at 18:49
    
It is working perfectly Chittaranjan !! Thank you very much –  Daniel Foltynek Nov 29 '13 at 19:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.