Files
ultimatemember/includes/core/um-actions-access.php
T

25 lines
477 B
PHP
Raw Normal View History

<?php
2017-12-18 15:36:04 +02:00
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
2017-11-23 01:29:10 +02:00
/**
* Profile Access
*
* @param int $user_id
*/
function um_access_profile( $user_id ) {
2017-11-23 01:29:10 +02:00
if ( ! um_is_myprofile() && um_is_core_page( 'user' ) && ! current_user_can( 'edit_users' ) ) {
2017-11-23 01:29:10 +02:00
um_fetch_user( $user_id );
2017-11-23 01:29:10 +02:00
if ( ! in_array( um_user( 'account_status' ), array( 'approved' ) ) ) {
um_redirect_home();
}
2017-11-23 01:29:10 +02:00
um_reset_user();
}
2017-11-23 01:29:10 +02:00
}
add_action( 'um_access_profile', 'um_access_profile' );