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

38 lines
807 B
PHP
Raw Normal View History

2014-12-15 22:38:07 +02:00
<?php
2015-01-21 15:05:02 +02:00
2014-12-15 22:38:07 +02:00
/***
*** @checks if user can access the backend
***/
function um_block_wpadmin_by_user_role() {
2017-08-07 16:30:12 +03:00
if ( is_admin() && ! defined('DOING_AJAX') && um_user( 'ID' ) && ! um_user( 'can_access_wpadmin' ) && ! is_super_admin( um_user('ID') ) ) {
2015-01-03 15:31:15 +02:00
um_redirect_home();
2014-12-15 22:38:07 +02:00
}
}
add_action( 'init', 'um_block_wpadmin_by_user_role', 99 );
2014-12-15 22:38:07 +02:00
/***
*** @hide admin bar appropriately
***/
2016-02-24 15:44:19 +08:00
function um_control_admin_bar( $content ){
2016-02-26 22:19:18 +08:00
if( is_user_logged_in() ){
if ( um_user('can_not_see_adminbar') ){
return false;
}
return true;
}
2015-02-01 01:30:04 +02:00
2016-02-26 22:19:18 +08:00
return $content;
2014-12-15 22:38:07 +02:00
}
2017-11-02 18:13:50 +02:00
add_filter( 'show_admin_bar' , 'um_control_admin_bar', 9999, 1 );
2016-02-24 15:44:19 +08:00
2015-01-27 01:52:11 +02:00
/***
*** @fix permission for admin bar
***/
function um_force_admin_bar() {
um_reset_user();
}
add_action( 'wp_footer', 'um_force_admin_bar' );