• Resolved mubasher99

    (@mubasher99)


    hello there..
    I want to know the Php code to Count total number of pending User Requests. i have a custom Admin page where i show the total registered users with the code

    <?php
     global $wpdb; $user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );
     echo "<p>Total Subscribers= {$user_count}</p>";
     ?>

    But now i want to know the code or any shortcode to show the total number of pending users who are waiting for admin approval.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @mubasher99,

    Please use the following programming code to display the pending users.

    $users = get_users();
    $pending_users     = 0;
    foreach( $users as $user ){
        $user_status       = get_user_meta( $user->ID, 'ur_user_status', true );
        $user_email_status = get_user_meta(  $user->ID, 'ur_confirm_email', true );
        if ( '' !== $user_status && '' === $user_email_status ) {
            if ( 0 == $user_status ) {
                $pending_users++;
            }
        } elseif ( ( '' === $user_status && '' !== $user_email_status ) || ( '' !== $user_status && '' !== $user_email_status ) ) {
            if ( 0 == $user_email_status[0] ) {
                $pending_users++;
            }
        }
    }
    echo $pending_users;

    Note: Above code only work for the users registered from the user registration plugin.

    Regards!

    Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @mubasher99,

    Since we did not get a response from your end, we are marking this thread as resolved as we believe the things mentioned here are now resolved. Please create a new support thread if needed.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Php code to Count total number of pending User Requests’ is closed to new replies.