I edited a bit of code the other day from the Wordpress Ultimate Members plug-in to change the user profile to pending if the profile is edited by the user.
However, I noted that the code also sets the admin account to pending too. I don’t want this, so I have been trying to use an if/ else statement to query if the user is admin before the script runs.
I know this is straight forward for experts in PHP, but I have tried lots of variations and admin is still being set to pending approval.
Here’s the original code that is setting admin to pending:
// Set profile to under review after edits
add_action('um_user_edit_profile', 'um_post_edit_pending_hook', 10, 2);
function um_post_edit_pending_hook($user_id, $args){
global $ultimatemember;
$ultimatemember->user->pending();
}
Here s the code that I am trying to bypass admin with which won’t work. I won’t add all the variations I have tried.
add_action('um_user_edit_profile', 'um_post_edit_pending_hook', 10, 2);
function um_post_edit_pending_hook($user_id, $args){
if ( is_admin() ) {
return false;
} else {
global $ultimatemember;
$ultimatemember->user->pending();
}
}
Any assistance would gratefully be appreciated.