s2Member v110815
Source Code: s2member\includes\classes\users-list-in.inc.php
Docs updated: August 15, 2011, 4:14 pm
Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\classes\users-list-in.inc.php ?php /** * Users list ( inner processing routines ). * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member\Users_List * @since 3.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_users_list_in" ) ) { /** * Users list ( inner processing routines ). * * @package s2Member\Users_List * @since 3.5 */ class c_ws_plugin__s2member_users_list_in { /** * Adds Custom Fields to the admin Profile editing page. * * @package s2Member\Users_List * @since 3.5 * * @attaches-to: ``add_action("edit_user_profile");`` * @attaches-to: ``add_action("show_user_profile");`` * * @param obj $user Expects a `WP_User` object passed in by the Action Hook. * @return null */ public static function users_list_edit_cols ( $user = FALSE ) { global $current_site , $current_blog ; /* Multisite Networking. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_users_list_edit_cols" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ $current_user = ( is_user_logged_in ( ) ) ? wp_get_current_user ( ) : false ; /* Current User. */ /**/ if ( is_object ( $user ) && ( $user_id = $user - ID ) && is_object ( $current_user ) && $current_user - ID ) { $role = c_ws_plugin__s2member_user_access:: user_access_role ( $user ) ; /* This User's WordPress® Role. */ $level = c_ws_plugin__s2member_user_access:: user_access_level ( $user ) ; /* This User's Access Level for s2Member. */ /**/ if ( current_user_can ( "edit_users" ) && ( ! is_multisite ( ) || is_super_admin ( ) || is_user_member_of_blog ( $user_id ) ) ) { echo 'div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"/div' . "\n" ; /**/ echo 'h3 style="position:relative;"img src="' . esc_attr ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "c" ] [ "dir_url" ] ) . '/images/large-icon.png" title="s2Member ( a Membership management system for WordPress® )" alt="" style="position:absolute; top:-15px; right:0; border:0;" /s2Member Configuration & Profile Fields' . ( ( is_multisite ( ) ) ? ' ( for this Blog )' : '' ) . '/h3' . "\n" ; /**/ echo 'table class="form-table"' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( is_multisite ( ) && is_super_admin ( ) ) /* MUST be a Super Admin. */ /* On a Multisite Network, the Super Administrator can ALWAYS edit this. */ { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_originating_blog" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-originating-blog"Originating Blog ID#:/label a href="#" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdinput type="text" name="ws_plugin__s2member_profile_s2member_originating_blog" id="ws-plugin--s2member-profile-s2member-originating-blog" value="' . format_to_edit ( get_user_meta ( $user_id , "s2member_originating_blog" , true ) ) . '" class="regular-text" //td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_originating_blog" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_subscr_gateway" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-subscr-gateway"Paid Subscr. Gateway:/label a href="#" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdselect name="ws_plugin__s2member_profile_s2member_subscr_gateway" id="ws-plugin--s2member-profile-s2member-subscr-gateway" style="width:25em;"option value=""/option' . "\n" ; foreach ( apply_filters ( "ws_plugin__s2member_profile_s2member_subscr_gateways" , array ( "paypal" = "PayPal® ( code: paypal )" ) , get_defined_vars ( ) ) as $gateway = $gateway_name ) echo 'option value="' . esc_attr ( $gateway ) . '"' . ( ( $gateway === get_user_option ( "s2member_subscr_gateway" , $user_id ) ) ? ' selected="selected"' : '' ) . '' . esc_html ( $gateway_name ) . '/option' . "\n" ; echo '/select' . "\n" ; echo '/td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_subscr_gateway" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-subscr-id"Paid Subscr. ID:/label a href="#" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdinput type="text" name="ws_plugin__s2member_profile_s2member_subscr_id" id="ws-plugin--s2member-profile-s2member-subscr-id" value="' . format_to_edit ( get_user_option ( "s2member_subscr_id" , $user_id ) ) . '" class="regular-text" //td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_custom" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-custom"Custom Value:/label a href="#" HTTP_HOST" ] ) ) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . c_ws_plugin__s2member_utils_strings:: esc_sq ( esc_attr ( $_SERVER [ "HTTP_HOST" ] ) ) . '|cv1|cv2|cv3\'); return false;" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdinput type="text" name="ws_plugin__s2member_profile_s2member_custom" id="ws-plugin--s2member-profile-s2member-custom" value="' . format_to_edit ( get_user_option ( "s2member_custom" , $user_id ) ) . '" class="regular-text" //td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_custom" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_registration_ip" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-registration-ip"Registration IP:/label a href="#" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdinput type="text" name="ws_plugin__s2member_profile_s2member_registration_ip" id="ws-plugin--s2member-profile-s2member-registration-ip" value="' . format_to_edit ( get_user_option ( "s2member_registration_ip" , $user_id ) ) . '" class="regular-text" //td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_registration_ip" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ! is_multisite ( ) || !c_ws_plugin__s2member_utils_conds:: is_multisite_farm ( ) || is_main_site ( ) ) /* ^ Will change once Custom Capabilities are compatible with a Blog Farm. */ { foreach ( $user - allcaps as $cap = $cap_enabled ) if ( preg_match ( "/^access_s2member_ccap_/" , $cap ) ) $ccaps [ ] = preg_replace ( "/^access_s2member_ccap_/" , "" , $cap ) ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_ccaps" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-ccaps"Custom Capabilities:/label a href="#" tabindex="-1"[?]/a' . ( ( is_multisite ( ) ) ? 'br /small( for this Blog )/small' : '' ) . '/th' . "\n" ; echo 'tdinput type="text" name="ws_plugin__s2member_profile_s2member_ccaps" id="ws-plugin--s2member-profile-s2member-ccaps" value="' . format_to_edit ( ( ( ! empty ( $ccaps ) ) ? implode ( "," , $ccaps ) : "" ) ) . '" class="regular-text" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^a-z_0-9,]/gi, \'\').toLowerCase ());" //td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_ccaps" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ if ( ! $user - has_cap ( "administrator" ) ) /* Do NOT present these details for Administrator accounts. */ { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; $auto_eot_time = get_user_option ( "s2member_auto_eot_time" , $user_id ) ; $auto_eot_time = ( $auto_eot_time ) ? date ( "D M j, Y g:i a T" , $auto_eot_time ) : "" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-auto-eot-time"Automatic EOT Time:/label a href="#" tabindex="-1"[?]/a' . ( ( $auto_eot_time ) ? 'br /small( a href="http://www.world-time-zones.org/zones/greenwich-mean-time.htm" target="_blank" rel="external"Universal Time / GMT/a )/small' : '' ) . '/th' . "\n" ; echo 'tdinput type="text" name="ws_plugin__s2member_profile_s2member_auto_eot_time" id="ws-plugin--s2member-profile-s2member-auto-eot-time" value="' . format_to_edit ( $auto_eot_time ) . '" class="regular-text" //td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ if (c_ws_plugin__s2member_list_servers:: list_servers_integrated ( ) ) /* Only if integrated with s2Member. */ { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_opt_in" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-opt-in"Re-process List Servers:/label a href="#" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdlabelinput type="checkbox" name="ws_plugin__s2member_profile_opt_in" id="ws-plugin--s2member-profile-opt-in" value="1" / Yes, send a mailing list confirmation email to this User./label/td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_opt_in" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_auto_opt_out_transitions" ] ) 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 ( "user-role-change" , $custom_reg_auto_op_outs ) || c_ws_plugin__s2member_utils_arrays:: in_regex_array ( "modification" , $custom_reg_auto_op_outs ) ) { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_auto_opt_out_transitions" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-custom-reg-auto-opt-out-transitions"Allow List Transitioning:/label a href="#" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdlabelinput type="checkbox" name="ws_plugin__s2member_custom_reg_auto_opt_out_transitions" id="ws-plugin--s2member-custom-reg-auto-opt-out-transitions" value="1" checked="checked" / Yes, automatically transition this User\'s mailing list subscription(s) when/if I change their Role./label/td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_auto_opt_out_transitions" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_ip_restrictions" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-ip-restrictions"Reset IP Restrictions:/label a href="#" tabindex="-1"[?]/a/th' . "\n" ; echo 'tdlabelinput type="checkbox" name="ws_plugin__s2member_profile_ip_restrictions" id="ws-plugin--s2member-profile-ip-restrictions" value="1" / Yes, delete/reset IP Restrictions associated with this Username./label' . ( (c_ws_plugin__s2member_ip_restrictions:: specific_ip_restriction_breached_security ( strtolower ( $user - user_login ) ) ) ? 'br /em*Note* this User HAS breached security through existing IP Restrictions./em' : 'br /em*Note* this User is NOT currently banned by any of your IP Restrictions./em' ) . '/td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_ip_restrictions" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] ) /* Only if configured. */ if ( $fields_applicable = c_ws_plugin__s2member_custom_reg_fields:: custom_fields_configured_at_level ( $level , "administrative" ) ) { echo 'tr' . "\n" ; echo 'td colspan="2"' . "\n" ; echo 'div style="height:1px; line-height:1px; background:#CCCCCC;"/div' . "\n" ; echo '/td' . "\n" ; echo '/tr' . "\n" ; /**/ $fields = get_user_option ( "s2member_custom_fields" , $user_id ) ; /* Existing fields. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ foreach ( json_decode ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] , true ) as $field ) { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( in_array ( $field [ "id" ] , $fields_applicable ) ) /* Field applicable? */ { $field_var = preg_replace ( "/[^a-z0-9]/i" , "_" , strtolower ( $field [ "id" ] ) ) ; $field_id_class = preg_replace ( "/_/" , "-" , $field_var ) ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; if ( apply_filters ( "ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display" , true , get_defined_vars ( ) ) ) { if ( ! empty ( $field [ "section" ] ) && $field [ "section" ] === "yes" ) /* Starts a new section? */ echo 'trtd colspan="2"div class="ws-plugin--s2member-profile-divider-section' . ( ( ! empty ( $field [ "sectitle" ] ) ) ? '-title' : '' ) . '"' . ( ( ! empty ( $field [ "sectitle" ] ) ) ? $field [ "sectitle" ] : '' ) . '/div/td/tr' ; /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-' . esc_attr ( $field_id_class ) . '"' . ( ( preg_match ( "/^(checkbox|pre_checkbox)$/" , $field [ "type" ] ) ) ? ucwords ( preg_replace ( "/_/" , " " , $field_var ) ) : $field [ "label" ] ) . ':/label/th' . "\n" ; echo 'td' . c_ws_plugin__s2member_custom_reg_fields:: custom_field_gen ( __FUNCTION__ , $field , "ws_plugin__s2member_profile_" , "ws-plugin--s2member-profile-" , "" , ( ( preg_match ( "/^(text|textarea|select|selects)$/" , $field [ "type" ] ) ) ? "width:99%;" : "" ) , "" , "" , $fields , $fields [ $field_var ] , "administrative" ) . '/td' . "\n" ; echo '/tr' . "\n" ; } unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'td colspan="2"' . "\n" ; echo 'div style="height:1px; line-height:1px; background:#CCCCCC;"/div' . "\n" ; echo '/td' . "\n" ; echo '/tr' . "\n" ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_notes" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-s2member-notes"Administrative Notes:/label a href="#" tabindex="-1"[?]/abr /br /smallThese Notations are private; Users/Members will never see any of these notes./small/th' . "\n" ; echo 'tdtextarea name="ws_plugin__s2member_profile_s2member_notes" id="ws-plugin--s2member-profile-s2member-notes" rows="5" wrap="off" spellcheck="false" style="width:99%;"' . format_to_edit ( get_user_option ( "s2member_notes" , $user_id ) ) . '/textarea/td' . "\n" ; echo '/tr' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_notes" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo '/table' . "\n" ; /**/ echo 'div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"/div' . "\n" ; } /**/ else if ( $current_user - ID === $user - ID ) /* Otherwise, a User can always edit their own Profile. */ { if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] ) /* Only if configured. */ if ( $fields_applicable = c_ws_plugin__s2member_custom_reg_fields:: custom_fields_configured_at_level ( $level , "profile" ) ) { echo 'div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"/div' . "\n" ; /**/ echo 'h3Additional Profile Fields' . ( ( is_multisite ( ) ) ? ' ( for this Blog )' : '' ) . '/h3' . "\n" ; /**/ echo 'table class="form-table"' . "\n" ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ $fields = get_user_option ( "s2member_custom_fields" , $user_id ) ; /* Existing fields. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ foreach ( json_decode ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] , true ) as $field ) { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( in_array ( $field [ "id" ] , $fields_applicable ) ) /* Field applicable? */ { $field_var = preg_replace ( "/[^a-z0-9]/i" , "_" , strtolower ( $field [ "id" ] ) ) ; $field_id_class = preg_replace ( "/_/" , "-" , $field_var ) ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; if ( apply_filters ( "ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display" , true , get_defined_vars ( ) ) ) { if ( ! empty ( $field [ "section" ] ) && $field [ "section" ] === "yes" ) /* Starts a new section? */ echo 'trtd colspan="2"div class="ws-plugin--s2member-profile-divider-section' . ( ( ! empty ( $field [ "sectitle" ] ) ) ? '-title' : '' ) . '"' . ( ( ! empty ( $field [ "sectitle" ] ) ) ? $field [ "sectitle" ] : '' ) . '/div/td/tr' ; /**/ echo 'tr' . "\n" ; echo 'thlabel for="ws-plugin--s2member-profile-' . esc_attr ( $field_id_class ) . '"' . ( ( preg_match ( "/^(checkbox|pre_checkbox)$/" , $field [ "type" ] ) ) ? ucwords ( preg_replace ( "/_/" , " " , $field_var ) ) : $field [ "label" ] ) . ':/label/th' . "\n" ; echo 'td' . c_ws_plugin__s2member_custom_reg_fields:: custom_field_gen ( __FUNCTION__ , $field , "ws_plugin__s2member_profile_" , "ws-plugin--s2member-profile-" , "" , ( ( preg_match ( "/^(text|textarea|select|selects)$/" , $field [ "type" ] ) ) ? "width:99%;" : "" ) , "" , "" , $fields , $fields [ $field_var ] , "profile" ) . '/td' . "\n" ; echo '/tr' . "\n" ; } unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_edit_cols_after" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ echo '/table' . "\n" ; /**/ echo 'div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"/div' . "\n" ; } } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_users_list_edit_cols" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return ; /* Return for uniformity. */ } /** * Saves Custom Fields after an admin updates Profile. * * @package s2Member\Users_List * @since 3.5 * * @attaches-to: ``add_action("edit_user_profile_update");`` * @attaches-to: ``add_action("personal_options_update");`` * * @param int|str $user_id Expects a numeric WordPress® User ID passed in by the Action Hook. * @return null */ public static function users_list_update_cols ( $user_id = FALSE ) { global $current_site , $current_blog ; /* Multisite Networking. */ /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_users_list_update_cols" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ $user = new WP_User ( $user_id ) ; /* We need both of these objects. $user and $current_user. */ $current_user = ( is_user_logged_in ( ) ) ? wp_get_current_user ( ) : false ; /* Current User. */ /**/ if ( is_object ( $user ) && ( $user_id = $user - ID ) && is_object ( $current_user ) && $current_user - ID ) { if ( current_user_can ( "edit_users" ) && ( ! is_multisite ( ) || is_super_admin ( ) || is_user_member_of_blog ( $user_id ) ) ) { if ( ! empty ( $_POST ) && is_array ( $_p = c_ws_plugin__s2member_utils_strings:: trim_deep ( stripslashes_deep ( $_POST ) ) ) ) { $old_role = c_ws_plugin__s2member_user_access:: user_access_role ( $user ) ; $role = ( isset ( $_p [ "role" ] ) && $_p [ "role" ] !== $old_role ) ? $_p [ "role" ] : $old_role ; $level = c_ws_plugin__s2member_user_access:: user_access_role_to_level ( $role ) ; /**/ $user - user_email = ( isset ( $_p [ "email" ] ) && is_email ( $_p [ "email" ] ) && $_p [ "email" ] !== $user - user_email ) ? $_p [ "email" ] : $user - user_email ; $user - first_name = ( isset ( $_p [ "first_name" ] ) && $_p [ "first_name" ] !== $user - first_name ) ? $_p [ "first_name" ] : $user - first_name ; $user - last_name = ( isset ( $_p [ "last_name" ] ) && $_p [ "last_name" ] !== $user - last_name ) ? $_p [ "last_name" ] : $user - last_name ; /**/ $auto_eot_time = ( ! empty ( $_p [ "ws_plugin__s2member_profile_s2member_auto_eot_time" ] ) ) ? strtotime ( $_p [ "ws_plugin__s2member_profile_s2member_auto_eot_time" ] ) : "" ; /**/ if ( $role !== $old_role ) /* In this case, we need to fire a Hook on `ws_plugin__s2member_during_collective_mods`. */ do_action ( "ws_plugin__s2member_during_collective_mods" , $user_id , get_defined_vars ( ) , "user-role-change" , "modification" , $role , $old_role , $user ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_originating_blog" ] ) && is_multisite ( ) && is_super_admin ( ) ) update_user_meta ( $user_id , "s2member_originating_blog" , $_p [ "ws_plugin__s2member_profile_s2member_originating_blog" ] ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_subscr_gateway" ] ) ) update_user_option ( $user_id , "s2member_subscr_gateway" , $_p [ "ws_plugin__s2member_profile_s2member_subscr_gateway" ] ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_subscr_id" ] ) ) update_user_option ( $user_id , "s2member_subscr_id" , $_p [ "ws_plugin__s2member_profile_s2member_subscr_id" ] ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_custom" ] ) ) update_user_option ( $user_id , "s2member_custom" , $_p [ "ws_plugin__s2member_profile_s2member_custom" ] ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_registration_ip" ] ) ) update_user_option ( $user_id , "s2member_registration_ip" , $_p [ "ws_plugin__s2member_profile_s2member_registration_ip" ] ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_notes" ] ) ) update_user_option ( $user_id , "s2member_notes" , $_p [ "ws_plugin__s2member_profile_s2member_notes" ] ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_auto_eot_time" ] ) && isset ( $auto_eot_time ) ) update_user_option ( $user_id , "s2member_auto_eot_time" , $auto_eot_time ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_s2member_ccaps" ] ) ) { foreach ( $user - allcaps as $cap = $cap_enabled ) if ( preg_match ( "/^access_s2member_ccap_/" , $cap ) ) $user - remove_cap ( $ccap = $cap ) ; /**/ if ( ! empty ( $_p [ "ws_plugin__s2member_profile_s2member_ccaps" ] ) ) foreach ( preg_split ( "/[\r \n \t\s;,]+/" , $_p [ "ws_plugin__s2member_profile_s2member_ccaps" ] ) as $ccap ) if ( strlen ( $ccap = trim ( strtolower ( preg_replace ( "/[^a-z_0-9]/i" , "" , $ccap ) ) ) ) ) $user - add_cap ( "access_s2member_ccap_" . $ccap ) ; } /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] ) { foreach ( json_decode ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] , true ) as $field ) { $field_var = preg_replace ( "/[^a-z0-9]/i" , "_" , strtolower ( $field [ "id" ] ) ) ; $field_id_class = preg_replace ( "/_/" , "-" , $field_var ) ; /**/ if ( isset ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) { if ( ( is_array ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) && ! empty ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) || strlen ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) $fields [ $field_var ] = $_p [ "ws_plugin__s2member_profile_" . $field_var ] ; else /* Else unset. */ unset ( $fields [ $field_var ] ) ; } else /* Else ``unset()``. */ unset ( $fields [ $field_var ] ) ; } } /**/ if ( ! empty ( $fields ) ) update_user_option ( $user_id , "s2member_custom_fields" , $fields ) ; else /* Else delete their Custom Fields? */ delete_user_option ( $user_id , "s2member_custom_fields" ) ; /**/ if ( $level 0 ) /* We ONLY process this if they are higher than Level #0. */ { $pr_times = get_user_option ( "s2member_paid_registration_times" , $user_id ) ; $pr_times [ "level" ] = ( ! $pr_times [ "level" ] ) ? time ( ) : $pr_times [ "level" ] ; /* Preserve. */ $pr_times [ "level" . $level ] = ( ! $pr_times [ "level" . $level ] ) ? time ( ) : $pr_times [ "level" . $level ] ; update_user_option ( $user_id , "s2member_paid_registration_times" , $pr_times ) ; /* Update now. */ } /**/ if ( ! empty ( $_p [ "ws_plugin__s2member_profile_opt_in" ] ) ) /* Should we process List Servers for this User? */ c_ws_plugin__s2member_list_servers:: process_list_servers ( $role , $level , $user - user_login , ( ( ! empty ( $_p [ "pass1" ] ) ) ? $_p [ "pass1" ] : "" ) , $user - user_email , $user - first_name , $user - last_name , false , true , true , $user_id ) ; /**/ if ( ! empty ( $_p [ "ws_plugin__s2member_profile_ip_restrictions" ] ) ) /* Delete/reset IP Restrictions? */ c_ws_plugin__s2member_ip_restrictions:: delete_reset_specific_ip_restrictions ( strtolower ( $user - user_login ) ) ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_update_cols" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } } /**/ else if ( $current_user - ID === $user - ID ) /* Otherwise, a User can always edit their own Profile. */ { if ( ! empty ( $_POST ) && is_array ( $_p = c_ws_plugin__s2member_utils_strings:: trim_deep ( stripslashes_deep ( $_POST ) ) ) ) { $role = c_ws_plugin__s2member_user_access:: user_access_role ( $user ) ; $level = c_ws_plugin__s2member_user_access:: user_access_role_to_level ( $role ) ; /**/ if ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] ) if ( $fields_applicable = c_ws_plugin__s2member_custom_reg_fields:: custom_fields_configured_at_level ( $level , "profile" ) ) { $_existing_fields = get_user_option ( "s2member_custom_fields" , $user_id ) ; /**/ foreach ( json_decode ( $GLOBALS [ "WS_PLUGIN__" ] [ "s2member" ] [ "o" ] [ "custom_reg_fields" ] , true ) as $field ) { $field_var = preg_replace ( "/[^a-z0-9]/i" , "_" , strtolower ( $field [ "id" ] ) ) ; $field_id_class = preg_replace ( "/_/" , "-" , $field_var ) ; /**/ if ( ! in_array ( $field [ "id" ] , $fields_applicable ) || preg_match ( "/^no/" , $field [ "editable" ] ) ) { if ( isset ( $_existing_fields [ $field_var ] ) && ( ( is_array ( $_existing_fields [ $field_var ] ) && ! empty ( $_existing_fields [ $field_var ] ) ) || strlen ( $_existing_fields [ $field_var ] ) ) ) $fields [ $field_var ] = $_existing_fields [ $field_var ] ; else /* Else unset. */ unset ( $fields [ $field_var ] ) ; } else if ( $field [ "required" ] === "yes" && ( ! isset ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) || ( is_array ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) && empty ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) || ! strlen ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) ) { if ( isset ( $_existing_fields [ $field_var ] ) && ( ( is_array ( $_existing_fields [ $field_var ] ) && ! empty ( $_existing_fields [ $field_var ] ) ) || strlen ( $_existing_fields [ $field_var ] ) ) ) $fields [ $field_var ] = $_existing_fields [ $field_var ] ; else /* Else unset. */ unset ( $fields [ $field_var ] ) ; } else if ( isset ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) { if ( ( is_array ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) && ! empty ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) || strlen ( $_p [ "ws_plugin__s2member_profile_" . $field_var ] ) ) $fields [ $field_var ] = $_p [ "ws_plugin__s2member_profile_" . $field_var ] ; else /* Else unset. */ unset ( $fields [ $field_var ] ) ; } else /* Else ``unset()``. */ unset ( $fields [ $field_var ] ) ; } /**/ if ( ! empty ( $fields ) ) update_user_option ( $user_id , "s2member_custom_fields" , $fields ) ; else /* Else delete their Custom Fields? */ delete_user_option ( $user_id , "s2member_custom_fields" ) ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_users_list_update_cols" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } } } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_after_users_list_update_cols" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ return ; /* Return for uniformity. */ } } } ? [ full view ]s2member\includes\classes\users-list-in.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)Statistics: Posted by System Robot — August 15th, 2011, 3:14 pm
]]>