Files
ultimatemember/includes/core/um-actions-access.php
T
Mykyta Synelnikov 7f7820e67c * fixed sending emails upon registration;
* 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
2024-10-10 18:18:56 +03:00

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' );