本文整理汇总了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;
}
}