本文整理匯總了PHP中wpl_global::has_permission方法的典型用法代碼示例。如果您正苦於以下問題:PHP wpl_global::has_permission方法的具體用法?PHP wpl_global::has_permission怎麽用?PHP wpl_global::has_permission使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wpl_global
的用法示例。
在下文中一共展示了wpl_global::has_permission方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: min_access
/**
* Blocks user access based on WPL user role
* @author Howard <howard@realtyna.com>
* @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;
}
}
示例2: is_administrator
/**
* Check is user is administrator or not
* @author Howard R <howard@realtyna.com>
* @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;
}
示例3: min_access
/**
* Blocks user access based on WPL user role
* @author Howard <howard@realtyna.com>
* @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;
}
}