Title: PHP Function or Code to check if user is approved?
Last modified: March 6, 2019

---

# PHP Function or Code to check if user is approved?

 *  Resolved [luxman](https://wordpress.org/support/users/luxman/)
 * (@luxman)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/php-function-or-code-to-check-if-user-is-approved/)
 * What code can I use to check to see if a user has been approved or not?
 * a is_user approved or something function?
 * thank you

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

 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [7 years, 3 months ago](https://wordpress.org/support/topic/php-function-or-code-to-check-if-user-is-approved/#post-11282510)
 * You can use this function below, copied from our plugin file.
 * Just pass in the user ID you want to check on. It’ll return boolean true if they’re
   moderated still, and false if they’re not and should have access to things.
 * Example:
 *     ```
       if ( bp_registration_get_moderation_status( 1 ) ) {
           // Do something to user 1, since they're moderated right now.
       }
       ```
   
 *     ```
       /**
        * Check our moderation status and return boolean values based on that.
        *
        * @since 4.2.0
        *
        * @param int $user_id User ID to check.
        * @return boolean Whether or not they're in moderation status.
        */
       function bp_registration_get_moderation_status( $user_id ) {
       	$moderated = get_user_meta( $user_id, '_bprwg_is_moderated', true );
   
       	if ( 'true' == $moderated ) {
       		return true;
       	}
       	return false;
       }
       ```
   
 *  Thread Starter [luxman](https://wordpress.org/support/users/luxman/)
 * (@luxman)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/php-function-or-code-to-check-if-user-is-approved/#post-11282514)
 * Yes, that works perfect! Thank you
    -  This reply was modified 7 years, 3 months ago by [luxman](https://wordpress.org/support/users/luxman/).
 *  Thread Starter [luxman](https://wordpress.org/support/users/luxman/)
 * (@luxman)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/php-function-or-code-to-check-if-user-is-approved/#post-11282732)
 *     ```
       if ( bp_registration_get_moderation_status( 1 ) ) {
           // Do something to user 1, since they're moderated right now.
       }
       ```
   
 * This only works for user 1
 * How do I make it so that it checks the logged in user?
 * something like
 * `is_user_logged_in() && !bp_registration_get_moderation_status( 'true' )`
 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [7 years, 3 months ago](https://wordpress.org/support/topic/php-function-or-code-to-check-if-user-is-approved/#post-11282744)
 * you would need to use something like get_current_user_id() or if you’re trying
   to display something conditionally based on the BuddyPress displayed user, bp_displayed_user_id().
   Both would be used for the first parameter.
 *     ```
       is_user_logged_in() && !bp_registration_get_moderation_status( get_current_user_id() )
       ```
   
 *  Thread Starter [luxman](https://wordpress.org/support/users/luxman/)
 * (@luxman)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/php-function-or-code-to-check-if-user-is-approved/#post-11283023)
 * got it. thanks!

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

The topic ‘PHP Function or Code to check if user is approved?’ is closed to new 
replies.

 * ![](https://ps.w.org/bp-registration-options/assets/icon-256x256.png?rev=2882040)
 * [Registration Options for BuddyPress](https://wordpress.org/plugins/bp-registration-options/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bp-registration-options/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bp-registration-options/)
 * [Active Topics](https://wordpress.org/support/plugin/bp-registration-options/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bp-registration-options/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bp-registration-options/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [luxman](https://wordpress.org/support/users/luxman/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/php-function-or-code-to-check-if-user-is-approved/#post-11283023)
 * Status: resolved