mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
7f7820e67c
* fixed using `um_user( 'status' )` and `um_user( 'account_status' )` functions; * fixed using `set_status()` function; * based on https://github.com/ultimatemember/ultimatemember/pull/1564
20 lines
437 B
PHP
20 lines
437 B
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Profile Access
|
|
*
|
|
* @param int $user_id
|
|
*/
|
|
function um_access_profile( $user_id ) {
|
|
if ( ! um_is_myprofile() && um_is_core_page( 'user' ) && ! current_user_can( 'edit_users' ) ) {
|
|
$account_status = UM()->common()->users()->get_status( $user_id );
|
|
if ( 'approved' !== $account_status ) {
|
|
um_redirect_home();
|
|
}
|
|
}
|
|
}
|
|
add_action( 'um_access_profile', 'um_access_profile' );
|