/** * Blocks user access based on WPL user role * @author Howard <*****@*****.**> * @static * @param string $role * @param int $user_id */ public static function min_access($role = 'guest', $user_id = '') { /** apply filters **/ _wpl_import('libraries.filters'); @extract(wpl_filters::apply('wpl_check_min_access', array('role' => $role, 'user_id' => $user_id))); if (!wpl_global::has_permission($role, $user_id)) { echo __("You don't have access to this page!", WPL_TEXTDOMAIN); exit; } }
/** * Check is user is administrator or not * @author Howard R <*****@*****.**> * @static * @param int $user_id * @return boolean */ public static function is_administrator($user_id = '') { /** get current user id **/ if (!trim($user_id)) { $user_id = wpl_users::get_cur_user_id(); } if ($user_id == 0 or $user_id == '') { return false; } $administrator = wpl_global::has_permission('administrator', $user_id); $super_admin = wpl_users::is_super_admin(); if ($super_admin) { return true; } return $administrator; }
/** * Blocks user access based on WPL user role * @author Howard <*****@*****.**> * @static * @param string $role * @param int $user_id */ public static function min_access($role = 'guest', $user_id = '') { if (!wpl_global::has_permission($role, $user_id)) { echo __("You don't have access to this page!", WPL_TEXTDOMAIN); exit; } }