Fix profile access and redirection

This commit is contained in:
champsupertramp
2016-06-28 16:55:38 +08:00
parent 1383c80f8c
commit 76ec5ba301
2 changed files with 22 additions and 0 deletions
+20
View File
@@ -349,3 +349,23 @@
}
}
/***
*** @Profile Access
***/
add_action('um_access_profile','um_access_profile');
function um_access_profile( $user_id ){
if( ! um_is_myprofile() && um_is_core_page('user') && ! current_user_can('edit_users') ){
um_fetch_user( $user_id );
if( ! in_array( um_user('account_status'), array('approved') ) ){
um_redirect_home();
}
um_reset_user();
}
}
+2
View File
@@ -149,6 +149,8 @@ class UM_Rewrite {
um_set_requested_user( $user_id );
do_action('um_access_profile', $user_id );
} else {
exit( wp_redirect( um_get_core_page('user') ) );