當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wpl_global::has_permission方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:gvh1993,項目名稱:project-vvvh,代碼行數:17,代碼來源:global.php

示例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;
 }
開發者ID:amankatoch,項目名稱:wp-plugin,代碼行數:23,代碼來源:users.php

示例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;
     }
 }
開發者ID:amankatoch,項目名稱:wp-plugin,代碼行數:14,代碼來源:global.php


注:本文中的wpl_global::has_permission方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。