本文整理汇总了PHP中c_ws_plugin__s2member_user_access::user_access_level方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_user_access::user_access_level方法的具体用法?PHP c_ws_plugin__s2member_user_access::user_access_level怎么用?PHP c_ws_plugin__s2member_user_access::user_access_level使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_user_access
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_user_access::user_access_level方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: synchronize_paid_reg_times
/**
* Synchronizes Paid Registration Times with Role assignments.
*
* @package s2Member\Registrations
* @since 3.5
*
* @attaches-to ``add_action("set_user_role");``
*
* @param integer|string $user_id A numeric WordPress User ID should be passed in by the Action Hook.
* @param string $role A WordPress Role ID/Name should be passed in by the Action Hook.
*
* @return null
*/
public static function synchronize_paid_reg_times($user_id = FALSE, $role = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars());
unset($__refs, $__v);
if ($user_id && is_object($user = new WP_User($user_id)) && !empty($user->ID) && ($level = c_ws_plugin__s2member_user_access::user_access_level($user)) > 0) {
$pr_times = get_user_option("s2member_paid_registration_times", $user_id);
$pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
$pr_times["level" . $level] = empty($pr_times["level" . $level]) ? time() : $pr_times["level" . $level];
update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
// Update now.
}
}
示例2: synchronize_paid_reg_times
/**
* Synchronizes Paid Registration Times with Role assignments.
*
* @package s2Member\Registrations
* @since 3.5
*
* @attaches-to ``add_action("set_user_role");``
*
* @param int|str $user_id A numeric WordPress® User ID should be passed in by the Action Hook.
* @param str $role A WordPress® Role ID/Name should be passed in by the Action Hook.
* @return null
*/
public static function synchronize_paid_reg_times($user_id = FALSE, $role = FALSE)
{
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if ($user_id && is_object($user = new WP_User($user_id)) && !empty($user->ID) && ($level = c_ws_plugin__s2member_user_access::user_access_level($user)) > 0) {
$pr_times = get_user_option("s2member_paid_registration_times", $user_id);
$pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
$pr_times["level" . $level] = empty($pr_times["level" . $level]) ? time() : $pr_times["level" . $level];
update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
/* Update now. */
}
/**/
return;
/* Return for uniformity. */
}
示例3: login_redirect
/**
* Handles Pro login redirections.
*
* @package s2Member\Login_Redirects
* @since 110720
*
* @attaches-to ``add_filter('ws_plugin__s2member_login_redirect');``
*
* @param bool|string $redirect Expects a boolean value of true|false, or a non-empty string, passed through by the Filter.
* @param array $vars Expects an array of defined variables, passed in by the Filter.
*
* @return bool|string A One-Time-Offer redirection URL, else the original value.
*/
public static function login_redirect($redirect = FALSE, $vars = array())
{
if ($redirect && !empty($vars['user']) && !empty($vars['logins'])) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_login_welcome_page_otos']) as $oto) {
if (($oto = trim($oto)) && preg_match('/^(?:([0-9]+)\\:)(?:([0-9]+)\\:)?(.+)$/', $oto, $m)) {
list(, $number_of_logins, $level, $url) = $m;
// Assign variables.
if ((int) $number_of_logins === (int) $vars['logins']) {
// One-Time-Offer applies?
if (!is_numeric($level) || c_ws_plugin__s2member_user_access::user_access_level($vars['user']) === (int) $level) {
if ($url = c_ws_plugin__s2member_login_redirects::fill_login_redirect_rc_vars($url, $vars['user'])) {
return $redirect = $url;
}
}
}
}
}
}
return $redirect;
// Return ``$redirect`` value.
}
示例4: login_redirect
/**
* Handles Pro login redirections.
*
* @package s2Member\Login_Redirects
* @since 110720
*
* @attaches-to ``add_filter("ws_plugin__s2member_login_redirect");``
*
* @param bool|str $redirect Expects a boolean value of true|false, or a non-empty string, passed through by the Filter.
* @param array $vars Expects an array of defined variables, passed in by the Filter.
* @return bool|str A One-Time-Offer redirection URL, else the original value.
*/
public static function login_redirect($redirect = FALSE, $vars = FALSE)
{
if ($redirect && ($user = $vars["user"]) && ($logins = $vars["logins"])) {
foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_login_welcome_page_otos"]) as $oto) {
if (($oto = trim($oto)) && preg_match("/^(?:([0-9]+)\\:)(?:([0-9]+)\\:)?(.+)\$/", $oto, $m)) {
list(, $number_of_logins, $level, $url) = $m;
// Assign variables.
if ((int) $number_of_logins === (int) $logins) {
// One-Time-Offer applies?
if (!is_numeric($level) || c_ws_plugin__s2member_user_access::user_access_level($user) === (int) $level) {
if ($url = c_ws_plugin__s2member_login_redirects::fill_login_redirect_rc_vars($url, $user)) {
return $redirect = $url;
}
}
}
}
}
}
return $redirect;
// Return ``$redirect`` value.
}
示例5: 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();
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
//.........这里部分代码省略.........
示例6: custom_profile_field_items_4bp
/**
* Adds Custom Fields to BuddyPress Profiles in public view.
*
* @package s2Member\Custom_Reg_Fields
* @since 110524RC
*
* @attaches-to ``add_action("bp_profile_field_item");``
*
* @return null
*/
public static function custom_profile_field_items_4bp()
{
global $bp;
static $processed = false;
do_action("ws_plugin__s2member_before_custom_profile_field_items_4bp", get_defined_vars());
if (!$processed && in_array("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"])) {
if (apply_filters("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars())) {
if (bp_is_user_profile() && (function_exists("bp_is_user_profile_edit") && !bp_is_user_profile_edit() || function_exists("bp_is_profile_edit") && !bp_is_profile_edit()) && (int) bp_get_the_profile_group_id() === 1) {
if (isset($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id)) {
if ($processed = true) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars());
unset($__refs, $__v);
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
if (($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User($user_id))) >= 0) {
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, "profile-view")) {
$fields = get_user_option("s2member_custom_fields", $user_id);
foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars());
unset($__refs, $__v);
if (in_array($field["id"], $fields_applicable)) {
$field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
$field_id_class = preg_replace("/_/", "-", $field_var);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
if (apply_filters("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars())) {
if (!empty($field["section"]) && $field["section"] === "yes") {
echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . (!empty($field["sectitle"]) ? '-title' : '') . '">' . (!empty($field["sectitle"]) ? $field["sectitle"] : '') . '</div></td>' . "\n";
echo '</tr>' . "\n";
}
echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . '">' . "\n";
echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' label"><span>' . $field["label"] . '</span></td>' . "\n";
echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile-view") . '</td>' . "\n";
echo '</tr>' . "\n";
}
unset($__refs, $__v);
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars());
unset($__refs, $__v);
}
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars());
unset($__refs, $__v);
}
}
}
}
}
do_action("ws_plugin__s2member_after_custom_profile_field_items_4bp", get_defined_vars());
return;
}
示例7: check_mms_register_access
/**
* Allows access to the main Multisite Registration Form.
*
* @package s2Member\Option_Forces
* @since 3.5
*
* @attaches-to ``add_filter("pre_site_option_registration");``
*
* @param string $users_can_register Expects *( `none`, `all`, `blog`, `user` )*, passed through by the Filter.
* @return string One of `none|all|user`; depending on several factors.
*/
public static function check_mms_register_access($users_can_register = FALSE)
{
global $wpdb;
// Global database object reference
global $current_site, $current_blog;
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_check_register_access", get_defined_vars());
unset($__refs, $__v);
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
if (c_ws_plugin__s2member_utils_conds::bp_is_installed() && is_multisite() && !c_ws_plugin__s2member_utils_conds::is_multisite_farm()) {
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = c_ws_plugin__s2member_option_forces::check_register_access() ? "user" : "none", get_defined_vars());
} else {
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm()) {
// Blog Farm?
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "none", get_defined_vars());
} else {
if (!is_network_admin() && $users_can_register !== "all") {
if (is_main_site() && current_user_can("create_users") || is_super_admin()) {
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "all", get_defined_vars());
} else {
if (is_user_logged_in() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID && $user->has_cap("access_s2member_level1")) {
$mms_options = c_ws_plugin__s2member_utilities::mms_options();
$blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level($user)];
$user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
$user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
// NOT less than zero.
$blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
if ($user_blogs < $blogs_allowed) {
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "all", get_defined_vars());
}
} else {
if (!is_user_logged_in() && is_main_site() && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
if (preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $m[1]])) {
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "all", get_defined_vars());
} else {
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "user", get_defined_vars());
}
}
}
}
} else {
if (!is_network_admin() && $users_can_register === "all") {
if (is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID) {
$mms_options = c_ws_plugin__s2member_utilities::mms_options();
$blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level($user)];
$user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
$user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
// NOT less than zero.
$blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
if ($user_blogs >= $blogs_allowed) {
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "none", get_defined_vars());
}
}
}
}
}
}
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register, get_defined_vars());
}
示例8: fill_login_redirect_rc_vars
/**
* Fills Replacement Codes in Special Redirection URLs.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @param str $url A URL with possible Replacement Codes in it.
* @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
* @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
*/
public static function fill_login_redirect_rc_vars($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars());
unset($__refs, $__v);
$url = (string) $url;
$orig_url = $url;
$user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
$user_id = $user ? (string) $user->ID : "";
$user_login = $user ? (string) strtolower($user->user_login) : "";
$user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
$user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
$user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
$url = preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $url);
$url = preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $url);
$url = preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $url);
$url = preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $url);
$url = preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $url);
$url = preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $url);
if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, false)) || !empty($parse["path"]) && strpos($parse["path"], "//") !== false)) {
$url = site_url("/");
}
if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
$url = false;
}
return apply_filters("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars());
}
示例9: auto_process_list_server_removals
/**
* Listens to Collective EOT/MOD Events processed internally by s2Member.
*
* This is only applicable when ``["custom_reg_auto_opt_outs"]`` contains related Event(s).
*
* @package s2Member\List_Servers
* @since 3.5
*
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_mods");``
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_eots");``
*
* @param int|str $user_id Required. A WordPress User ID, numeric string or integer.
* @param array $vars Required. An array of defined variables passed by the calling Hook.
* @param str $event Required. A specific event that triggered this call from the Action Hook.
* @param str $event_spec Required. A specific event specification *(a broader classification)*.
* @param str $mod_new_role Required if ``$event_spec === "modification"`` (but can be empty). Role the User is being modified to.
* @param str $mod_new_user Optional. If ``$event_spec === "modification"``, the new User object with current details.
* @param str $mod_old_user Optional. If ``$event_spec === "modification"``, the old/previous User obj with old details.
* @return null This function does not have a return value.
*/
public static function auto_process_list_server_removals($user_id = FALSE, $vars = FALSE, $event = FALSE, $event_spec = FALSE, $mod_new_role = FALSE, $mod_new_user = FALSE, $mod_old_user = FALSE)
{
global $current_site, $current_blog;
static $auto_processed = array();
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_auto_process_list_server_removals", get_defined_vars());
unset($__refs, $__v);
$custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"], "/^", "\$/i");
if (c_ws_plugin__s2member_list_servers::list_servers_integrated() && $user_id && is_numeric($user_id) && !in_array($user_id, $auto_processed) && is_array($vars) && is_string($event = (string) $event) && is_string($event_spec = (string) $event_spec) && (c_ws_plugin__s2member_utils_arrays::in_regex_array($event, $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array($event_spec, $custom_reg_auto_op_outs)) && is_object($user = $_user = new WP_User($user_id)) && !empty($user->ID)) {
$mod_new_role = $event_spec === "modification" && $mod_new_role && is_string($mod_new_role) ? $mod_new_role : false;
$mod_new_user = $event_spec === "modification" && $mod_new_user && is_object($mod_new_user) && !empty($mod_new_user->ID) && $mod_new_user->ID === $_user->ID ? $mod_new_user : false;
$mod_old_user = $event_spec === "modification" && $mod_old_user && is_object($mod_old_user) && !empty($mod_old_user->ID) && $mod_old_user->ID === $_user->ID ? $mod_old_user : false;
$user = $event_spec === "modification" && $mod_old_user ? $mod_old_user : $_user;
// Now, should we switch over to the old/previous User object ``$mod_old_user`` here? Or, should we use the one pulled by this routine with the User's ID?
if (($event_spec !== "modification" || $event_spec === "modification" && (string) $mod_new_role !== c_ws_plugin__s2member_user_access::user_access_role($user) && strtotime($user->user_registered) < strtotime("-10 seconds") && ($event !== "user-role-change" || $event === "user-role-change" && !empty($vars["_p"]["ws_plugin__s2member_custom_reg_auto_opt_out_transitions"]))) && ($auto_processed[$user->ID] = true)) {
$removed = c_ws_plugin__s2member_list_servers::process_list_server_removals(c_ws_plugin__s2member_user_access::user_access_role($user), c_ws_plugin__s2member_user_access::user_access_level($user), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $user->ID);
if ($event_spec === "modification" && $mod_new_role && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_out_transitions"] === "2" || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_out_transitions"] === "1" && $removed)) {
$user = $event_spec === "modification" && $mod_new_user ? $mod_new_user : $_user;
// Now, should we switch over to a new/current User object ``$mod_new_user`` here? (which may contain newly updated details). Or, should we simply use the User object pulled by this routine with the User's ID?
$transitioned = c_ws_plugin__s2member_list_servers::process_list_servers($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level($mod_new_role), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $removed ? false : true, $user->ID);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_auto_process_list_server_removal_transitions", get_defined_vars());
unset($__refs, $__v);
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_auto_process_list_server_removals", get_defined_vars());
unset($__refs, $__v);
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_after_auto_process_list_server_removals", get_defined_vars());
unset($__refs, $__v);
return;
}
示例10: 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))];
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
/**/
//.........这里部分代码省略.........
示例11: auto_process_list_server_removals
/**
* Listens to Collective EOT/MOD events processed by s2Member.
*
* @since 3.5
* @package s2Member\List_Servers
*
* @attaches-to `add_action('ws_plugin__s2member_during_collective_mods');`.
* @attaches-to `add_action('ws_plugin__s2member_during_collective_eots');`.
*
* @param int|string $user_id Required. A WordPress User ID, numeric string or integer.
* @param array $vars Required. An array of defined variables passed by the calling hook.
* @param string $event Required. A specific event that triggered this call from the action hook.
* @param string $event_spec Required. A specific event specification *(a broader classification)*.
* @param string $mod_new_role Required if `$event_spec === 'modification'`; but can be empty. User role.
* @param string $mod_new_user Optional. If `$event_spec === 'modification'`, the new user object with current details.
* @param string $mod_old_user Optional. If `$event_spec === 'modification'`, the old/previous user obj with old details.
*
* @note This is only applicable when `['custom_reg_auto_opt_outs']` contains related Event(s).
*/
public static function auto_process_list_server_removals($user_id, $vars, $event, $event_spec, $mod_new_role = NULL, $mod_new_user = NULL, $mod_old_user = NULL)
{
static $auto_processed = array();
// Static cache.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_auto_process_list_server_removals', get_defined_vars());
unset($__refs, $__v);
// Allows vars to be modified by reference.
if (c_ws_plugin__s2member_list_servers::list_servers_integrated()) {
if ($user_id && is_numeric($user_id) && !isset($auto_processed[$user_id])) {
if (is_array($vars) && is_string($event = (string) $event) && is_string($event_spec = (string) $event_spec)) {
if ($custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_outs'], '/^', '$/i')) {
if (c_ws_plugin__s2member_utils_arrays::in_regex_array($event, $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array($event_spec, $custom_reg_auto_op_outs)) {
if (is_object($dynamic_user = $user_now = new WP_User($user_id)) && $dynamic_user->exists() && !empty($dynamic_user->ID)) {
$mod_new_role = $event_spec === 'modification' && is_string($mod_new_role) ? $mod_new_role : '';
// Might be empty.
$mod_new_user = $event_spec === 'modification' && !empty($mod_new_user->ID) && $mod_new_user->ID === $dynamic_user->ID ? $mod_new_user : NULL;
$mod_old_user = $event_spec === 'modification' && !empty($mod_old_user->ID) && $mod_old_user->ID === $dynamic_user->ID ? $mod_old_user : NULL;
$dynamic_user = $event_spec === 'modification' && $mod_old_user ? $mod_old_user : $user_now;
// Use old user when applicable.
if ($event_spec !== 'modification' || $event_spec === 'modification' && $mod_new_role !== c_ws_plugin__s2member_user_access::user_access_role($dynamic_user) && strtotime($dynamic_user->user_registered) < strtotime('-10 seconds') && ($event !== 'user-role-change' || $event === 'user-role-change' && !empty($vars['_p']['ws_plugin__s2member_custom_reg_auto_opt_out_transitions']))) {
$auto_processed[$dynamic_user->ID] = -1;
// Flag as auto-processed!
$auto_removal_success = c_ws_plugin__s2member_list_servers::process_list_server_removals(c_ws_plugin__s2member_user_access::user_access_role($dynamic_user), c_ws_plugin__s2member_user_access::user_access_level($dynamic_user), $dynamic_user->user_login, '', $dynamic_user->user_email, $dynamic_user->first_name, $dynamic_user->last_name, '', TRUE, $dynamic_user->ID);
if ($event_spec === 'modification' && $mod_new_role && ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '2' || $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_auto_opt_out_transitions'] === '1' && $auto_removal_success)) {
$dynamic_user = $event_spec === 'modification' && $mod_new_user ? $mod_new_user : $user_now;
// New user; when applicable.
$auto_transition_success = c_ws_plugin__s2member_list_servers::process_list_servers($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level($mod_new_role), $dynamic_user->user_login, '', $dynamic_user->user_email, $dynamic_user->first_name, $dynamic_user->last_name, '', TRUE, $auto_removal_success ? FALSE : TRUE, $dynamic_user->ID);
do_action('ws_plugin__s2member_during_auto_process_list_server_removal_transitions', get_defined_vars());
}
do_action('ws_plugin__s2member_during_auto_process_list_server_removals', get_defined_vars());
}
}
}
}
}
}
}
do_action('ws_plugin__s2member_after_auto_process_list_server_removals', get_defined_vars());
}
示例12: user_access_label
/**
* Determines Access Label for a User/Member.
*
* If ``$user`` is NOT passed in, check the current User/Member.
* If ``$user`` IS passed in, this function will check a specific ``$user``.
*
* @package s2Member\User_Access
* @since 3.5
*
* @param obj $user Optional. A `WP_User` object. Defaults to the current User.
* In order to check the current User, you must call this function with no arguments/parameters.
* @return str Access Level Label, empty string if ``$user`` does not exist, or if no User is currently logged-in.
*/
public static function user_access_label($user = FALSE)
{
if (func_num_args() && (!is_object($user) || empty($user->ID)) || !func_num_args() && !$user && (!is_object($user = is_user_logged_in() ? wp_get_current_user() : false) || empty($user->ID))) {
return apply_filters("ws_plugin__s2member_user_access_label", "", get_defined_vars());
/* No $user, or NOT logged in. */
} else {
if (($level = c_ws_plugin__s2member_user_access::user_access_level($user)) >= 0 && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"])) {
return apply_filters("ws_plugin__s2member_user_access_label", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"], get_defined_vars());
} else {
/* Else there is no Label configured for this User/Member. Return empty string. */
return apply_filters("ws_plugin__s2member_user_access_label", "", get_defined_vars());
}
}
}
示例13: custom_profile_field_items_4bp
/**
* Adds Custom Fields to BuddyPress Profiles in public view.
*
* @package s2Member\Custom_Reg_Fields
* @since 110524RC
*
* @attaches-to ``add_action('bp_profile_field_item');``
*/
public static function custom_profile_field_items_4bp()
{
global $bp;
// Global reference to the BuddyPress object.
static $processed = FALSE;
// Process this routine only one time.
do_action('ws_plugin__s2member_before_custom_profile_field_items_4bp', get_defined_vars());
if (!$processed && in_array('profile-view', $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields_4bp'])) {
if (apply_filters('ws_plugin__s2member_custom_profile_field_items_4bp_display', TRUE, get_defined_vars())) {
if (bp_is_user_profile() && !bp_is_user_profile_edit() && (int) bp_get_the_profile_group_id() === 1) {
if (isset($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id) && ($processed = TRUE)) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before', get_defined_vars());
unset($__refs, $__v);
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
if (($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User($user_id))) >= 0) {
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, 'profile-view')) {
$fields = get_user_option('s2member_custom_fields', $user_id);
foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields', get_defined_vars());
unset($__refs, $__v);
if (in_array($field['id'], $fields_applicable)) {
$field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
$field_id_class = preg_replace('/_/', '-', $field_var);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
if (apply_filters('ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display', TRUE, get_defined_vars())) {
if (!empty($field['section']) && $field['section'] === 'yes') {
echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . (!empty($field['sectitle']) ? '-title' : '') . '">' . (!empty($field['sectitle']) ? $field['sectitle'] : '') . '</div></td>' . "\n";
echo '</tr>' . "\n";
}
echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . '">' . "\n";
echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' label"><span>' . $field['label'] . '</span></td>' . "\n";
echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr($field_id_class) . ' field_' . esc_attr($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_profile_4bp_', 'ws-plugin--s2member-profile-4bp-', 'ws-plugin--s2member-profile-field-4bp', '', '', '', $fields, @$fields[$field_var], 'profile-view') . '</td>' . "\n";
echo '</tr>' . "\n";
}
unset($__refs, $__v);
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields', get_defined_vars());
unset($__refs, $__v);
}
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after', get_defined_vars());
unset($__refs, $__v);
}
}
}
}
do_action('ws_plugin__s2member_after_custom_profile_field_items_4bp', get_defined_vars());
}
示例14: 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.
}
示例15: fill_ruri_level_access_rc_vars
/**
* Fills Replacement Code variables in URIs; collectively.
*
* @package s2Member\URIs
* @since 3.5
*
* @param str $uris A URI string, or a string of multiple URIs is also fine.
* @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
* @return str Collective string of input URIs, with Replacement Codes having been filled.
*/
public static function fill_ruri_level_access_rc_vars($uris = FALSE, $user = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars());
unset($__refs, $__v);
$uris = (string) $uris;
// Force ``$uris`` to a string value.
$orig_uris = $uris;
// Record the original URIs that were passed in; collectively.
$user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
$user_id = $user ? (string) $user->ID : "";
$user_login = $user ? (string) strtolower($user->user_login) : "";
$user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
$user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
$user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
$uris = strlen($user_login) ? preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $uris) : $uris;
$uris = strlen($user_id) ? preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $uris) : $uris;
$uris = strlen($user_level) ? preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $uris) : $uris;
$uris = strlen($user_role) ? preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $uris) : $uris;
$uris = strlen($user_ccaps) ? preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $uris) : $uris;
$uris = strlen($user_logins) ? preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $uris) : $uris;
return apply_filters("ws_plugin__s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars());
}