当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_User::__construct方法代码示例

本文整理汇总了PHP中WP_User::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_User::__construct方法的具体用法?PHP WP_User::__construct怎么用?PHP WP_User::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_User的用法示例。


在下文中一共展示了WP_User::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: WeddingGuest

 function WeddingGuest($id = null)
 {
     parent::__construct($id);
     $this->attending_wedding = (bool) get_user_meta($this->ID, '_attending_wedding', true);
     $this->attending_dinner = (bool) get_user_meta($this->ID, '_attending_dinner', true);
     $this->has_responded = (bool) ($this->_attending_wedding == '1' || $this->_attending_wedding == '0' || $this->_attending_dinner == '1' || $this->_attending_dinner == '0');
 }
开发者ID:ryanbagwell,项目名称:Wordpress-Weddings,代码行数:7,代码来源:class.guests.php

示例2: array

 function WP_Scoped_User($id = 0, $name = '', $args = array())
 {
     //log_mem_usage_rs( 'begin WP_Scoped_User' );
     if (method_exists($this, 'WP_User')) {
         $this->WP_User($id, $name);
     } else {
         parent::__construct($id, $name);
     }
     // without this, logged users have no read access to blogs they're not registered for
     if (IS_MU_RS && $id && !is_admin() && empty($this->allcaps)) {
         $this->caps['subscriber'] = true;
     }
     // initialize blog_roles arrays
     $this->assigned_blog_roles[ANY_CONTENT_DATE_RS] = array();
     $this->blog_roles[ANY_CONTENT_DATE_RS] = array();
     //log_mem_usage_rs( 'called this->WP_User' );
     $defaults = array('disable_user_roles' => false, 'disable_group_roles' => false, 'disable_wp_roles' => false);
     $args = array_merge($defaults, (array) $args);
     extract($args);
     if ($this->ID || defined('SCOPER_ANON_METAGROUP')) {
         if (!$disable_wp_roles) {
             // include both WP roles and custom caps, which are treated as a hidden single-cap role capable of satisfying single-cap current_user_can calls
             $this->assigned_blog_roles[ANY_CONTENT_DATE_RS] = $this->caps;
             // prepend role_type prefix to wp rolenames
             global $wp_roles;
             foreach (array_keys($this->assigned_blog_roles[ANY_CONTENT_DATE_RS]) as $name) {
                 if (isset($wp_roles->role_objects[$name])) {
                     $this->assigned_blog_roles[ANY_CONTENT_DATE_RS]['wp_' . $name] = $this->assigned_blog_roles[ANY_CONTENT_DATE_RS][$name];
                     unset($this->assigned_blog_roles[ANY_CONTENT_DATE_RS][$name]);
                 }
             }
         }
         if (defined('DEFINE_GROUPS_RS') && !$disable_group_roles) {
             $this->groups = $this->_get_usergroups();
             if (!empty($args['filter_usergroups'])) {
                 // assist group admin
                 $this->groups = array_intersect_key($this->groups, $args['filter_usergroups']);
             }
         }
         // if ( RS_BLOG_ROLES ) {  // rs_blog_roles option has never been active in any RS release; leave commented here in case need arises
         if ($rs_blogroles = $this->get_blog_roles_daterange('rs')) {
             foreach (array_keys($rs_blogroles) as $date_key) {
                 if (isset($this->assigned_blog_roles[$date_key])) {
                     $this->assigned_blog_roles[$date_key] = array_merge($this->assigned_blog_roles[$date_key], $rs_blogroles[$date_key]);
                 } else {
                     $this->assigned_blog_roles[$date_key] = $rs_blogroles[$date_key];
                 }
             }
         }
         //}
         // note: The allcaps property still governs current_user_can calls when the cap requirements do not pertain to a specific object.
         // If WP roles fail to provide all required caps, the Role Scoper has_cap filter validates the current_user_can check if any RS blogrole has all the required caps.
         //
         // The blog_roles array also comes into play for object permission checks such as page or post listing / edit.
         // In such cases, roles in the Scoped_User->blog_roles array supplement any pertinent taxonomy or role assignments,
         // as long as the object or its terms are not configured to require that role to be term-assigned or object-assigned.
         //log_mem_usage_rs( 'new Scoped User done' );
         add_filter('user_has_cap', array(&$this, 'reinstate_caps'), 99, 3);
     }
 }
开发者ID:btj,项目名称:cscircles-wp-content,代码行数:60,代码来源:scoped-user.php

示例3: elseif

 function __construct($person_id = 0, $username = '', $blog_id = '')
 {
     if (is_array($person_id)) {
         if (array_key_exists('person_id', $person_id)) {
             $person_id = $person_id['person_id'];
         } elseif (array_key_exists('user_id', $person_id)) {
             $person_id = $person_id['user_id'];
         } else {
             $person_id = $person_id['ID'];
         }
     } elseif (is_object($person_id) && get_class($person_id) == 'WP_User') {
         $person_id = $person_id->ID;
         //create new object if passed a wp_user
     }
     if ($username) {
         parent::__construct($person_id, $username);
     } elseif (is_numeric($person_id) && $person_id <= 0) {
         $this->data = new stdClass();
         $this->ID = 0;
         $this->display_name = 'Non-Registered User';
         $this->user_email = '';
     } else {
         parent::__construct($person_id);
     }
     $this->phone = wp_kses_data(get_metadata('user', $this->ID, 'dbem_phone', true));
     //extra field for EM
     do_action('em_person', $this, $person_id, $username);
 }
开发者ID:pcco,项目名称:portal-redesign,代码行数:28,代码来源:em-person.php

示例4:

 /**
  * Initialize User Object
  * 
  * @param int $user_id 
  */
 function __construct($user_id = FALSE)
 {
     if (!$user_id) {
         $user_id = get_current_user_id();
     }
     parent::__construct($user_id);
 }
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:12,代码来源:user.php

示例5: array

 function __construct($ID, $name = '')
 {
     /**
      * If its an existing user, make sure we initialise it with WP_User[]
      */
     if ($ID != 0) {
         parent::__construct($ID, $name);
     }
     /* Set meta vars */
     $this->first_name = get_user_meta($ID, 'first_name', true);
     $this->last_name = get_user_meta($ID, 'last_name', true);
     /**
      * Get number of enrolled courses.
      */
     $this->courses_number = Student::get_courses_number($this->ID);
     /**
      * Add hooks to handle completion data.
      */
     add_action('coursepress_set_course_completed', array(&$this, 'add_course_completed_meta'), 10, 2);
     add_action('coursepress_set_unit_completed', array(&$this, 'add_unit_completed_meta'), 10, 3);
     add_action('coursepress_set_all_unit_pages_viewed', array(&$this, 'add_pages_viewed_meta'), 10, 3);
     add_action('coursepress_set_mandatory_question_answered', array(&$this, 'add_mandatory_questions_meta'), 10, 4);
     add_action('coursepress_set_gradable_question_passed', array(&$this, 'add_questions_passed_meta'), 10, 4);
     /**
      * Add hooks to handle other tracking
      * @todo More hooks coming.
      */
     /**
      * Perform action after a Student object is created.
      *
      * @since 1.2.2
      */
     do_action('coursepress_student_init', $this);
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:34,代码来源:class.student.php

示例6:

 function __construct($ID, $name = '')
 {
     if ($ID != 0) {
         parent::__construct($ID, $name);
     }
     /* Set meta vars */
     $this->first_name = get_user_meta($ID, 'first_name', true);
     $this->last_name = get_user_meta($ID, 'last_name', true);
     $this->courses_number = Instructor::get_courses_number($ID);
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:10,代码来源:class.instructor.php

示例7: array

 function WP_Scoped_User_Anon()
 {
     if (method_exists($this, 'WP_User')) {
         $this->WP_User(0, '');
     } else {
         parent::__construct(0, '');
     }
     // initialize blog_roles arrays
     $this->blog_roles[ANY_CONTENT_DATE_RS] = array();
 }
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:10,代码来源:scoped-user_anon.php

示例8: foreach

 function M_Membership($id, $name = '')
 {
     global $wpdb;
     if ($id != 0) {
         parent::__construct($id, $name);
     }
     $this->db =& $wpdb;
     foreach ($this->tables as $table) {
         $this->{$table} = membership_db_prefix($this->db, $table);
     }
     $this->transition_through_subscription();
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:12,代码来源:class.membership.php

示例9: array

 function WP_Scoped_User_Anon()
 {
     if (method_exists($this, 'WP_User')) {
         $this->WP_User(0, '');
     } else {
         parent::__construct(0, '');
     }
     // initialize blog_roles arrays
     $this->blog_roles[ANY_CONTENT_DATE_RS] = array();
     if (defined('DEFINE_GROUPS_RS') && defined('SCOPER_ANON_METAGROUP')) {
         $this->groups = $this->_get_usergroups();
     }
 }
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:13,代码来源:scoped-user_anon.php

示例10: __construct

 public function __construct($id = 0, $name = '', $blog_id = '')
 {
     global $wpdb;
     if ($id != 0) {
         parent::__construct($id, $name, $blog_id);
         membership_debug_log(sprintf(__('MEMBER: Loaded member %d', 'membership'), $id));
     }
     $this->_wpdb = $wpdb;
     if ($id != 0 && ($this->has_cap('membershipadmin') || $this->has_cap('manage_options') || is_super_admin($this->ID))) {
         // bail - user is admin or super admin
         return;
     }
     $this->transition_through_subscription();
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:14,代码来源:Member.php

示例11: array

 function __construct($id = 0, $name = '', $args = array())
 {
     //pp_log_mem_usage( 'begin PP_User' );
     parent::__construct($id, $name);
     // without this, logged users have no read access to sites they're not registered for
     if (PP_MULTISITE && $id && !is_admin() && empty($this->allcaps)) {
         $this->caps['read'] = true;
     }
     $agent_type = 'pp_group';
     $this->groups[$agent_type] = $this->_get_pp_groups(compact('agent_type'));
     if (!empty($args['filter_usergroups']) && !empty($args['filter_usergroups'][$agent_type])) {
         // assist group admin
         $this->groups[$agent_type] = array_intersect_key($this->groups[$agent_type], $args['filter_usergroups'][$agent_type]);
     }
     $this->site_roles = $this->get_site_roles();
     // @todo: eliminate redundant call - get_user_typecast_caps()
     add_filter('map_meta_cap', array(&$this, 'reinstate_caps'), 99, 3);
     //pp_log_mem_usage( 'new PP_User done' );
 }
开发者ID:severnrescue,项目名称:web,代码行数:19,代码来源:pp-user.php

示例12: __construct

 public function __construct($id = null, $name = null, $third = null)
 {
     if (is_object($id)) {
         $this->ID = $id->ID;
         $attrHolder = $id;
     } else {
         parent::__construct($id, $name, $third);
         $attrHolder = $this;
     }
     if ($this->ID) {
         foreach (get_user_meta($this->ID) as $key => $values) {
             if (is_array($values) && count($values) == 1) {
                 $v = unserialize($values[0]) === false ? $values[0] : unserialize($values[0]);
                 $this->set($key, $v);
             } else {
                 $this->set($key, $values);
             }
         }
         foreach (self::$wpUserInternalFields as $field) {
             $this->set($field, $attrHolder->{$field});
         }
     }
     $this->_initial_import_done = true;
 }
开发者ID:netacceleration,项目名称:accelpress,代码行数:24,代码来源:AP_User.php

示例13:

 function __construct($id = false)
 {
     parent::__construct($id);
 }
开发者ID:shrimp2t,项目名称:LearnPress,代码行数:4,代码来源:class.lpr-user.php

示例14: __construct

 /**
  * Create class object.
  *
  * @param   int|string|stdClass|WP_User $id     User's ID, a WP_User object, or a user object from the DB.
  * @param   string  $name                       Optional. User's username
  * @param   int     $blog_id                    Optional Blog ID, defaults to current blog.
  * @return  void
  * @access  public
  * @since   1.0.0
  */
 public function __construct($id = 0, $name = '', $blog_id = '')
 {
     parent::__construct($id, $name, $blog_id);
 }
开发者ID:rafecolton,项目名称:Charitable,代码行数:14,代码来源:class-charitable-user.php

示例15: __construct

 /**
  * Create an instance of WPDKUser class
  *
  * @brief Constructor
  *
  * @param int|object|array|string $user      Optional. User's ID, WP_User object, WPDKUser object, array. If 0 (zero)
  *                                           the current user is get
  * @param string                  $name      Optional. User's username
  * @param int|string              $blog_id   Optional. Blog ID, defaults to current blog.
  *
  * @return WPDKUser
  */
 public function __construct($user = 0, $name = '', $blog_id = '')
 {
     $id_user = 0;
     // Sanitize $id
     if (is_numeric($user)) {
         $id_user = $user;
         // If zero get the current id user
         if (empty($id_user)) {
             $id_user = get_current_user_id();
         }
     } elseif (is_object($user) && isset($user->ID)) {
         $id_user = absint($user->ID);
     } elseif (is_array($user) && isset($user['ID'])) {
         $id_user = absint($user['ID']);
     } elseif (is_string($user) && is_email($user)) {
         $user = get_user_by('email', $user);
         $id_user = $user->ID;
     }
     parent::__construct($id_user, $name, $blog_id);
     // Set the extended property when an user is set
     if (!empty($id_user)) {
         $this->first_name = $this->get('first_name');
         $this->last_name = $this->get('last_name');
         $this->nice_name = $this->data->user_nicename;
         $this->user_login = $this->data->user_login;
         $this->full_name = $this->full_name($this->first_name, $this->last_name);
         $this->display_name = $this->data->display_name;
         $this->email = sanitize_email($this->data->user_email);
         $this->status = $this->get(WPDKUserMeta::STATUS);
         $this->statusDescription = $this->get(WPDKUserMeta::STATUS_DESCRIPTION);
         // Sanitize string->int
         $this->data->ID = absint($id_user);
         $this->ID = absint($id_user);
     }
 }
开发者ID:wpxtreme,项目名称:wpdk,代码行数:47,代码来源:wpdk-users.php


注:本文中的WP_User::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。