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
(@luxman)
Yes, that works perfect! Thank you
-
This reply was modified 7 years, 3 months ago by
luxman.
Thread Starter
luxman
(@luxman)
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' )
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() )