mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
24 lines
560 B
PHP
24 lines
560 B
PHP
<?php
|
|
|
|
/***
|
|
*** @checks if user can access the backend
|
|
***/
|
|
function um_block_wpadmin_by_user_role(){
|
|
global $ultimatemember;
|
|
if( is_admin() && !defined('DOING_AJAX') && um_user('ID') && !um_user('can_access_wpadmin')){
|
|
um_redirect_home();
|
|
}
|
|
}
|
|
add_action('init','um_block_wpadmin_by_user_role', 99);
|
|
|
|
/***
|
|
*** @hide admin bar appropriately
|
|
***/
|
|
function um_control_admin_bar(){
|
|
if( !is_admin() && !um_user('can_access_wpadmin')) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
add_filter( 'show_admin_bar' , 'um_control_admin_bar'); |