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


PHP c_ws_plugin__s2member_user_access::user_access_label方法代码示例

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


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

示例1: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  * 	Or, this could be set to any property that exists on the WP_User object for a particular User;
  * 	( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  * 	`s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  * 	`s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  * 	`s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  * 	`s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  * 	`s2member_access_ccaps`, etc, etc. ).
  * @param int|str $user_id Optional. Defaults to the current User's ID.
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = FALSE, $user_id = FALSE)
 {
     global $wpdb;
     $current_user = wp_get_current_user();
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (isset($user->{$field_id})) {
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, "full_name") === 0) {
                             return trim($user->first_name . " " . $user->last_name);
                         } else {
                             if (preg_match("/^(email|user_email)\$/i", $field_id)) {
                                 return $user->user_email;
                             } else {
                                 if (preg_match("/^(login|user_login)\$/i", $field_id)) {
                                     return $user->user_login;
                                 } else {
                                     if (strcasecmp($field_id, "s2member_access_role") === 0) {
                                         return c_ws_plugin__s2member_user_access::user_access_role($user);
                                     } else {
                                         if (strcasecmp($field_id, "s2member_access_level") === 0) {
                                             return c_ws_plugin__s2member_user_access::user_access_level($user);
                                         } else {
                                             if (strcasecmp($field_id, "s2member_access_label") === 0) {
                                                 return c_ws_plugin__s2member_user_access::user_access_label($user);
                                             } else {
                                                 if (strcasecmp($field_id, "s2member_access_ccaps") === 0) {
                                                     return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                 } else {
                                                     if (strcasecmp($field_id, "ip") === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID)) {
                                                         return $_SERVER["REMOTE_ADDR"];
                                                     } else {
                                                         if (strcasecmp($field_id, "s2member_registration_ip") === 0 || strcasecmp($field_id, "reg_ip") === 0 || strcasecmp($field_id, "ip") === 0) {
                                                             return get_user_option("s2member_registration_ip", $user_id);
                                                         } else {
                                                             if (strcasecmp($field_id, "s2member_subscr_or_wp_id") === 0) {
                                                                 return ($subscr_id = get_user_option("s2member_subscr_id", $user_id)) ? $subscr_id : $user_id;
                                                             } else {
                                                                 if (is_array($fields = get_user_option("s2member_custom_fields", $user_id))) {
                                                                     if (isset($fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))])) {
                                                                         return $fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))];
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:86,代码来源:utils-users.inc.php

示例2: new_user_notification

 /**
  * Handles new User/Member notifications.
  *
  * @package s2Member\Email_Configs
  * @since 110707
  *
  * @param string|int $user_id A numeric WordPress User ID.
  * @param string $user_pass Optional. A plain text version of the User's password.
  * 	If omitted, only the administrative notification will be sent.
  * @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
  * @param string $user_email Optional. This defaults to the user's currently configured email address.
  * @return bool True if all required parameters are supplied, else false.
  */
 public static function new_user_notification($user_id = FALSE, $user_pass = FALSE, $notify = array("user", "admin"), $user_email = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_new_user_notification", get_defined_vars());
     unset($__refs, $__v);
     if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && is_array($notify) && !empty($notify)) {
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         c_ws_plugin__s2member_email_configs::email_config_release();
         if (in_array("user", $notify) && $user_pass) {
             $fields = get_user_option("s2member_custom_fields", $user_id);
             $cv = preg_split("/\\|/", get_user_option("s2member_custom", $user_id));
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $label = c_ws_plugin__s2member_user_access::user_access_label($user);
             $level = c_ws_plugin__s2member_user_access::user_access_level($user);
             $ccaps = implode(",", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
             $user->user_email = $user_email ? $user_email : $user->user_email;
             $user_full_name = trim($user->first_name . " " . $user->last_name);
             $user_ip = $_SERVER["REMOTE_ADDR"];
             if ($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_subject"]) {
                 if ($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) {
                     if ($sbj = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
                         if ($sbj = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
                             if ($sbj = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
                                 if ($sbj = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
                                     if ($sbj = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
                                         if ($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
                                             if ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
                                                 if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
                                                     if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                         if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                             if ($sbj = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
                                                                 if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
                                                                     if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                         if (is_array($fields) && !empty($fields)) {
                                                                             foreach ($fields as $var => $val) {
                                                                                 if (!($sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                     break;
                                                                                 }
                                                                             }
                                                                         }
                                                                         if ($msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_email_message"]) {
                                                                             if ($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $msg)) {
                                                                                 if ($msg = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
                                                                                     if ($msg = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
                                                                                         if ($msg = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
                                                                                             if ($msg = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
                                                                                                 if ($msg = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
                                                                                                     if ($msg = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
                                                                                                         if ($msg = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
                                                                                                             if ($msg = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
                                                                                                                 if ($msg = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                     if ($msg = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                         if ($msg = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
                                                                                                                             if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
                                                                                                                                 if ($msg = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
                                                                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                                                                         foreach ($fields as $var => $val) {
                                                                                                                                             if (!($msg = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg))) {
                                                                                                                                                 break;
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                     if (($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                                                                         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                             $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                             $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                         }
                                                                                                                                         c_ws_plugin__s2member_email_configs::email_config() . wp_mail($user->user_email, apply_filters("ws_plugin__s2member_welcome_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_welcome_email_msg", $msg, get_defined_vars()), "From: \"" . preg_replace('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
//.........这里部分代码省略.........
开发者ID:NClaus,项目名称:Ambrose,代码行数:101,代码来源:email-configs.inc.php

示例3: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string     $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  *   Or, this could be set to any property that exists on the WP_User object for a particular User;
  *   ( i.e., `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  *   `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  *   `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  *   `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  *   `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  *   `s2member_access_ccaps`, etc, etc. ).
  * @param int|string $user_id Optional. Defaults to the current User's ID.
  * @param array $args Any additional behavioral args. Since v150717.
  *
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = '', $user_id = 0, $args = array())
 {
     global $wpdb;
     /** @var wpdb $wpdb Reference for IDEs. */
     $current_user = wp_get_current_user();
     // Current user.
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         $args = (array) $args;
         // Force array.
         if (isset($user->{$field_id})) {
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, 'full_name') === 0) {
                             return trim($user->first_name . ' ' . $user->last_name);
                         } else {
                             if (preg_match('/^(?:email|user_email)$/i', $field_id)) {
                                 return $user->user_email;
                             } else {
                                 if (preg_match('/^(?:login|user_login)$/i', $field_id)) {
                                     return $user->user_login;
                                 } else {
                                     if (preg_match('/^(?:s2member_)?registration_time$/i', $field_id)) {
                                         return $user->user_registered;
                                     } else {
                                         if (strcasecmp($field_id, 's2member_access_role') === 0) {
                                             return c_ws_plugin__s2member_user_access::user_access_role($user);
                                         } else {
                                             if (strcasecmp($field_id, 's2member_access_level') === 0) {
                                                 return c_ws_plugin__s2member_user_access::user_access_level($user);
                                             } else {
                                                 if (strcasecmp($field_id, 's2member_access_label') === 0) {
                                                     return c_ws_plugin__s2member_user_access::user_access_label($user);
                                                 } else {
                                                     if (strcasecmp($field_id, 's2member_access_ccaps') === 0) {
                                                         return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                     } else {
                                                         if (strcasecmp($field_id, 'ip') === 0 && !empty($current_user->ID) && $current_user->ID === $user_id) {
                                                             return $_SERVER['REMOTE_ADDR'];
                                                         } else {
                                                             if (strcasecmp($field_id, 's2member_registration_ip') === 0 || strcasecmp($field_id, 'reg_ip') === 0 || strcasecmp($field_id, 'ip') === 0) {
                                                                 return get_user_option('s2member_registration_ip', $user_id);
                                                             } else {
                                                                 if (strcasecmp($field_id, 's2member_subscr_or_wp_id') === 0) {
                                                                     return ($subscr_id = get_user_option('s2member_subscr_id', $user_id)) ? $subscr_id : $user_id;
                                                                 } else {
                                                                     if (strcasecmp($field_id, 'avatar') === 0) {
                                                                         // Avatar with a specific size?
                                                                         return get_avatar($user_id, !empty($args['size']) ? $args['size'] : 96);
                                                                     } else {
                                                                         if (is_array($fields = get_user_option('s2member_custom_fields', $user_id))) {
                                                                             $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field_id));
                                                                             if (isset($fields[$field_var])) {
                                                                                 return $fields[$field_var];
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member,代码行数:101,代码来源:utils-users.inc.php

示例4: new_user_notification

 /**
  * Handles new User/Member notifications.
  *
  * @package s2Member\Email_Configs
  * @since 110707
  *
  * @param string|int $user_id A numeric WordPress User ID.
  * @param string $user_pass Optional. A plain text version of the User's password.
  * 	If omitted, only the administrative notification will be sent.
  * @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
  * @param string $user_email Optional. This defaults to the user's currently configured email address.
  * @return bool True if all required parameters are supplied, else false.
  */
 public static function new_user_notification($user_id = 0, $user_pass = '', $notify = array('user', 'admin'), $user_email = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_new_user_notification', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $user_id = (int) $user_id;
     $user_pass = (string) $user_pass;
     $notify = (array) $notify;
     $user_email = (string) $user_email;
     if (!$user_pass && !empty($GLOBALS['ws_plugin__s2member_plain_text_pass'])) {
         $user_pass = (string) $GLOBALS['ws_plugin__s2member_plain_text_pass'];
     }
     if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && $notify) {
         $is_gte_wp43 = version_compare(get_bloginfo('version'), '4.3', '>=');
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         c_ws_plugin__s2member_email_configs::email_config_release();
         if (in_array('user', $notify, true) && empty($GLOBALS['ws_plugin__s2member_custom_wp_login_bp_password']) && ($user_pass && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%user_pass%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'] = sprintf(_x("Your Username/Password for:\n%s\n\nUsername: %%%%user_login%%%%\nTo set your password, visit: %%%%wp_set_pass_url%%%%\n\n%%%%wp_login_url%%%%", 's2member-front', 's2member'), get_bloginfo('name')), '%%wp_set_pass_url%%') !== false)) {
             if ($is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false) {
                 remove_filter('random_password', 'c_ws_plugin__s2member_registrations::generate_password');
                 $user_activation_key = wp_generate_password(20, false);
                 // ↑ Make sure it's w/o filter.
                 do_action('retrieve_password_key', $user->user_login, $user_activation_key);
                 if (!class_exists('PasswordHash')) {
                     require_once ABSPATH . WPINC . '/class-phpass.php';
                 }
                 $wp_hasher = new PasswordHash(8, true);
                 $user_activation_key_hash = time() . ':' . $wp_hasher->HashPassword($user_activation_key);
                 $GLOBALS['wpdb']->update($GLOBALS['wpdb']->users, array('user_activation_key' => $user_activation_key_hash), array('user_login' => $user->user_login));
                 $wp_set_pass_url_args = array('action' => 'rp', 'key' => $user_activation_key, 'login' => $user->user_login);
                 $wp_set_pass_url = add_query_arg(urlencode_deep($wp_set_pass_url_args), wp_login_url());
             } else {
                 $wp_set_pass_url = wp_lostpassword_url();
             }
             // Default behavior; and older versions of WordPress.
             $fields = get_user_option('s2member_custom_fields', $user_id);
             $cv = preg_split('/\\|/', get_user_option('s2member_custom', $user_id));
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $label = c_ws_plugin__s2member_user_access::user_access_label($user);
             $level = c_ws_plugin__s2member_user_access::user_access_level($user);
             $ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
             $user->user_email = $user_email ? $user_email : $user->user_email;
             $user_full_name = trim($user->first_name . ' ' . $user->last_name);
             $user_ip = $_SERVER['REMOTE_ADDR'];
             if ($sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_subject']) {
                 if ($sbj = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $sbj)) {
                     if ($sbj = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $sbj)) {
                         if ($sbj = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
                             if ($sbj = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
                                 if ($sbj = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
                                     if ($sbj = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
                                         if ($sbj = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
                                             if ($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
                                                 if ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
                                                     if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
                                                         if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                             if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                                 if ($sbj = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
                                                                     if ($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
                                                                         if ($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                             if (is_array($fields) && !empty($fields)) {
                                                                                 foreach ($fields as $var => $val) {
                                                                                     // Custom Registration/Profile Fields.
                                                                                     if (!($sbj = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                         break;
                                                                                     }
                                                                                 }
                                                                             }
                                                                             // Empty; we can stop here.
                                                                             if ($msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message']) {
                                                                                 if ($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) {
                                                                                     if ($msg = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $msg)) {
                                                                                         if ($msg = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
                                                                                             if ($msg = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
                                                                                                 if ($msg = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
                                                                                                     if ($msg = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
                                                                                                         if ($msg = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
                                                                                                             if ($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
                                                                                                                 if ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
                                                                                                                     if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
                                                                                                                         if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                             if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                                 if ($msg = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
                                                                                                                                     if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
                                                                                                                                         if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:email-configs.inc.php

示例5: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  * 	Or, this could be set to any property that exists on the WP_User object for a particular User;
  * 	( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  * 	`s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  * 	`s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  * 	`s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  * 	`s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  * 	`s2member_access_ccaps`, etc, etc. ).
  * @param int|str $user_id Optional. Defaults to the current User's ID.
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = FALSE, $user_id = FALSE)
 {
     global $wpdb;
     /* Global database object reference. We'll need this to obtain the right database prefix. */
     /**/
     $current_user = wp_get_current_user();
     /* Current User's object ( used when/if `$user_id` is empty ). */
     /**/
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (isset($user->{$field_id})) {
             /* Immediate User object property? ( most likely ) */
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 /* Also try the data object property. */
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     /* Immediate prefixed? */
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         /* Data prefixed? */
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, "full_name") === 0) {
                             /* First/last full name? */
                             return trim($user->first_name . " " . $user->last_name);
                         } else {
                             if (preg_match("/^(email|user_email)\$/i", $field_id)) {
                                 /* Email address? */
                                 return $user->user_email;
                             } else {
                                 if (preg_match("/^(login|user_login)\$/i", $field_id)) {
                                     /* Username / login? */
                                     return $user->user_login;
                                 } else {
                                     if (strcasecmp($field_id, "s2member_access_role") === 0) {
                                         /* Role name/ID? */
                                         return c_ws_plugin__s2member_user_access::user_access_role($user);
                                     } else {
                                         if (strcasecmp($field_id, "s2member_access_level") === 0) {
                                             /* Access Level? */
                                             return c_ws_plugin__s2member_user_access::user_access_level($user);
                                         } else {
                                             if (strcasecmp($field_id, "s2member_access_label") === 0) {
                                                 /* Access Label? */
                                                 return c_ws_plugin__s2member_user_access::user_access_label($user);
                                             } else {
                                                 if (strcasecmp($field_id, "s2member_access_ccaps") === 0) {
                                                     /* Custom Caps? */
                                                     return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                 } else {
                                                     if (strcasecmp($field_id, "ip") === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID)) {
                                                         return $_SERVER["REMOTE_ADDR"];
                                                     } else {
                                                         if (strcasecmp($field_id, "s2member_registration_ip") === 0 || strcasecmp($field_id, "reg_ip") === 0 || strcasecmp($field_id, "ip") === 0) {
                                                             return get_user_option("s2member_registration_ip", $user_id);
                                                         } else {
                                                             if (strcasecmp($field_id, "s2member_subscr_or_wp_id") === 0) {
                                                                 return ($subscr_id = get_user_option("s2member_subscr_id", $user_id)) ? $subscr_id : $user_id;
                                                             } else {
                                                                 if (is_array($fields = get_user_option("s2member_custom_fields", $user_id))) {
                                                                     if (isset($fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))])) {
                                                                         return $fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))];
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /**/
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:utils-users.inc.php

示例6: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string     $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  *   Or, this could be set to any property that exists on the WP_User object for a particular User;
  *   ( i.e., `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  *   `s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  *   `s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  *   `s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  *   `s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  *   `s2member_access_ccaps`, etc, etc. ).
  * @param int|string $user_id Optional. Defaults to the current User's ID.
  *
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = '', $user_id = 0)
 {
     global $wpdb;
     /** @var wpdb $wpdb */
     $current_user = wp_get_current_user();
     // Current User's object (used when/if `$user_id` is empty).
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (isset($user->{$field_id})) {
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, 'full_name') === 0) {
                             return trim($user->first_name . ' ' . $user->last_name);
                         } else {
                             if (preg_match('/^(email|user_email)$/i', $field_id)) {
                                 return $user->user_email;
                             } else {
                                 if (preg_match('/^(login|user_login)$/i', $field_id)) {
                                     return $user->user_login;
                                 } else {
                                     if (preg_match('/^(s2member_)?registration_time$/i', $field_id)) {
                                         return $user->user_registered;
                                     } else {
                                         if (strcasecmp($field_id, 's2member_access_role') === 0) {
                                             return c_ws_plugin__s2member_user_access::user_access_role($user);
                                         } else {
                                             if (strcasecmp($field_id, 's2member_access_level') === 0) {
                                                 return c_ws_plugin__s2member_user_access::user_access_level($user);
                                             } else {
                                                 if (strcasecmp($field_id, 's2member_access_label') === 0) {
                                                     return c_ws_plugin__s2member_user_access::user_access_label($user);
                                                 } else {
                                                     if (strcasecmp($field_id, 's2member_access_ccaps') === 0) {
                                                         return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                     } else {
                                                         if (strcasecmp($field_id, 'ip') === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID)) {
                                                             return $_SERVER['REMOTE_ADDR'];
                                                         } else {
                                                             if (strcasecmp($field_id, 's2member_registration_ip') === 0 || strcasecmp($field_id, 'reg_ip') === 0 || strcasecmp($field_id, 'ip') === 0) {
                                                                 return get_user_option('s2member_registration_ip', $user_id);
                                                             } else {
                                                                 if (strcasecmp($field_id, 's2member_subscr_or_wp_id') === 0) {
                                                                     return ($subscr_id = get_user_option('s2member_subscr_id', $user_id)) ? $subscr_id : $user_id;
                                                                 } else {
                                                                     if (is_array($fields = get_user_option('s2member_custom_fields', $user_id))) {
                                                                         if (isset($fields[preg_replace('/[^a-z0-9]/i', '_', strtolower($field_id))])) {
                                                                             return $fields[preg_replace('/[^a-z0-9]/i', '_', strtolower($field_id))];
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return FALSE;
     // Otherwise, return false.
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:94,代码来源:utils-users.inc.php

示例7: fill_replacement_codes

 protected static function fill_replacement_codes($user, $eot, &$recipients, &$subject, &$message)
 {
     $ipn_signup_vars = (array) c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars($user->ID);
     foreach (array('payer_email', 'first_name', 'last_name', 'subscr_id', 'subscr_cid', 'subscr_baid', 'subscr_gateway', 'currency', 'currency_symbol', 'initial', 'initial_term', 'regular', 'regular_term', 'recurring', 'item_name', 'item_number') as $_key) {
         if (isset($ipn_signup_vars[$_key])) {
             $_value = (string) $ipn_signup_vars[$_key];
             $recipients = str_ireplace('%%' . $_key . '%%', $_value, $recipients);
             $subject = str_ireplace('%%' . $_key . '%%', $_value, $subject);
             $message = str_ireplace('%%' . $_key . '%%', $_value, $message);
         }
     }
     unset($_key, $_value);
     // Housekeeping.
     if (!empty($ipn_signup_vars['initial_term'])) {
         $initial_cycle = c_ws_plugin__s2member_utils_time::period_term($ipn_signup_vars['initial_term']);
         $recipients = str_ireplace('%%initial_cycle%%', $initial_cycle, $recipients);
         $subject = str_ireplace('%%initial_cycle%%', $initial_cycle, $subject);
         $message = str_ireplace('%%initial_cycle%%', $initial_cycle, $message);
     }
     if (!empty($ipn_signup_vars['regular_term'])) {
         if (!empty($ipn_signup_vars['recurring'])) {
             $regular_cycle = c_ws_plugin__s2member_utils_time::period_term($ipn_signup_vars['regular_term'], true);
             $recurring_regular_cycle = $ipn_signup_vars['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($ipn_signup_vars['regular_term'], true);
         } else {
             $regular_cycle = c_ws_plugin__s2member_utils_time::period_term($ipn_signup_vars['regular_term'], false);
             $recurring_regular_cycle = __('0 / non-recurring', 's2member-front', 's2member');
         }
         $recipients = str_ireplace('%%regular_cycle%%', $regular_cycle, $recipients);
         $subject = str_ireplace('%%regular_cycle%%', $regular_cycle, $subject);
         $message = str_ireplace('%%regular_cycle%%', $regular_cycle, $message);
         $recipients = str_ireplace('%%recurring/regular_cycle%%', $recurring_regular_cycle, $recipients);
         $subject = str_ireplace('%%recurring/regular_cycle%%', $recurring_regular_cycle, $subject);
         $message = str_ireplace('%%recurring/regular_cycle%%', $recurring_regular_cycle, $message);
     }
     if (isset($ipn_signup_vars['first_name'], $ipn_signup_vars['last_name'])) {
         $full_name = trim($ipn_signup_vars['first_name'] . ' ' . $ipn_signup_vars['last_name']);
         $recipients = str_ireplace('%%full_name%%', $full_name, $recipients);
         $subject = str_ireplace('%%full_name%%', $full_name, $subject);
         $message = str_ireplace('%%full_name%%', $full_name, $message);
     }
     foreach (array('subscr_id', 'subscr_cid', 'subscr_baid', 'subscr_gateway') as $_key) {
         $_value = (string) get_user_option('s2member_' . $_key, $user->ID);
         $recipients = str_ireplace('%%' . $_key . '%%', $_value, $recipients);
         $subject = str_ireplace('%%' . $_key . '%%', $_value, $subject);
         $message = str_ireplace('%%' . $_key . '%%', $_value, $message);
     }
     unset($_key, $_value);
     // Housekeeping.
     foreach (array('ID', 'first_name', 'last_name', 'user_email', 'user_login') as $_property) {
         $_property_value = (string) $user->{$_property};
         $_lc_property_wo_user_prefix = preg_replace('/^user_/i', '', strtolower($_property));
         $recipients = str_ireplace('%%user_' . $_lc_property_wo_user_prefix . '%%', $_property_value, $recipients);
         $subject = str_ireplace('%%user_' . $_lc_property_wo_user_prefix . '%%', $_property_value, $subject);
         $message = str_ireplace('%%user_' . $_lc_property_wo_user_prefix . '%%', $_property_value, $message);
     }
     unset($_property, $_property_value, $_lc_property_wo_user_prefix);
     // Housekeeping.
     $first_name = $user->first_name;
     // If not yet filled above.
     $recipients = str_ireplace('%%first_name%%', $first_name, $recipients);
     $subject = str_ireplace('%%first_name%%', $first_name, $subject);
     $message = str_ireplace('%%first_name%%', $first_name, $message);
     $last_name = $user->last_name;
     // If not yet filled above.
     $recipients = str_ireplace('%%last_name%%', $last_name, $recipients);
     $subject = str_ireplace('%%last_name%%', $last_name, $subject);
     $message = str_ireplace('%%last_name%%', $last_name, $message);
     $full_name = trim($first_name . ' ' . $last_name);
     // Same here.
     $recipients = str_ireplace('%%full_name%%', $full_name, $recipients);
     $subject = str_ireplace('%%full_name%%', $full_name, $subject);
     $message = str_ireplace('%%full_name%%', $full_name, $message);
     $user_full_name = trim($user->first_name . ' ' . $user->last_name);
     $recipients = str_ireplace('%%user_full_name%%', $user_full_name, $recipients);
     $subject = str_ireplace('%%user_full_name%%', $user_full_name, $subject);
     $message = str_ireplace('%%user_full_name%%', $user_full_name, $message);
     $user_ip = get_user_option('s2member_registration_ip', $user->ID);
     $recipients = str_ireplace('%%user_ip%%', $user_ip, $recipients);
     $subject = str_ireplace('%%user_ip%%', $user_ip, $subject);
     $message = str_ireplace('%%user_ip%%', $user_ip, $message);
     $user_role = c_ws_plugin__s2member_user_access::user_access_role($user);
     $recipients = str_ireplace('%%user_role%%', $user_role, $recipients);
     $subject = str_ireplace('%%user_role%%', $user_role, $subject);
     $message = str_ireplace('%%user_role%%', $user_role, $message);
     $user_level = c_ws_plugin__s2member_user_access::user_access_level($user);
     $recipients = str_ireplace('%%user_level%%', $user_level, $recipients);
     $subject = str_ireplace('%%user_level%%', $user_level, $subject);
     $message = str_ireplace('%%user_level%%', $user_level, $message);
     $user_level_label = c_ws_plugin__s2member_user_access::user_access_label($user);
     $recipients = str_ireplace('%%user_level_label%%', $user_level_label, $recipients);
     $subject = str_ireplace('%%user_level_label%%', $user_level_label, $subject);
     $message = str_ireplace('%%user_level_label%%', $user_level_label, $message);
     $user_ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
     $recipients = str_ireplace('%%user_ccaps%%', $user_ccaps, $recipients);
     $subject = str_ireplace('%%user_ccaps%%', $user_ccaps, $subject);
     $message = str_ireplace('%%user_ccaps%%', $user_ccaps, $message);
     if (is_array($fields = get_user_option('s2member_custom_fields', $user->ID))) {
         foreach ($fields as $_key => $_value) {
             $_serialized_value = maybe_serialize($_value);
             $recipients = str_ireplace('%%' . $_key . '%%', $_serialized_value, $recipients);
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member-pro,代码行数:101,代码来源:reminders.inc.php


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