From 35bdbfb054d81217f5549e591afc2948772fcaa1 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Mon, 12 Feb 2018 00:56:01 +0200 Subject: [PATCH] - code formatted; --- includes/core/um-actions-wpadmin.php | 65 +++++++++++++++------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/includes/core/um-actions-wpadmin.php b/includes/core/um-actions-wpadmin.php index 3a847567..1cc06348 100644 --- a/includes/core/um-actions-wpadmin.php +++ b/includes/core/um-actions-wpadmin.php @@ -3,38 +3,41 @@ if ( ! defined( 'ABSPATH' ) ) exit; - /*** - *** @checks if user can access the backend - ***/ - function um_block_wpadmin_by_user_role() { - if ( is_admin() && ! defined('DOING_AJAX') && um_user( 'ID' ) && ! um_user( 'can_access_wpadmin' ) && ! is_super_admin( um_user('ID') ) ) { - um_redirect_home(); - } +/** + * Checks if user can access the backend + */ +function um_block_wpadmin_by_user_role() { + if ( is_admin() && ! defined( 'DOING_AJAX' ) && um_user( 'ID' ) && ! um_user( 'can_access_wpadmin' ) && ! is_super_admin( um_user( 'ID' ) ) ) { + um_redirect_home(); } - add_action( 'init', 'um_block_wpadmin_by_user_role', 99 ); - - /*** - *** @hide admin bar appropriately - ***/ - function um_control_admin_bar( $content ){ - - if( is_user_logged_in() ){ - - if ( um_user('can_not_see_adminbar') ){ - return false; - } +} +add_action( 'init', 'um_block_wpadmin_by_user_role', 99 ); - return true; - } - return $content; +/** + * Hide admin bar appropriately + * + * @param $content + * + * @return bool + */ +function um_control_admin_bar( $content ) { + if ( is_user_logged_in() ) { + if ( um_user( 'can_not_see_adminbar' ) ) { + return false; + } + return true; } - add_filter( 'show_admin_bar' , 'um_control_admin_bar', 9999, 1 ); - - /*** - *** @fix permission for admin bar - ***/ - function um_force_admin_bar() { - um_reset_user(); - } - add_action( 'wp_footer', 'um_force_admin_bar' ); + + return $content; +} +add_filter( 'show_admin_bar' , 'um_control_admin_bar', 9999, 1 ); + + +/** + * Fix permission for admin bar + */ +function um_force_admin_bar() { + um_reset_user(); +} +add_action( 'wp_footer', 'um_force_admin_bar' ); \ No newline at end of file