Example #1
0
 public function update_settings()
 {
     global $register_plus_redux;
     $options = array();
     $redux_usermeta = array();
     $_POST = stripslashes_deep((array) $_POST);
     if (isset($_POST['custom_logo_url']) && !isset($_POST['remove_logo'])) {
         $options['custom_logo_url'] = esc_url_raw((string) $_POST['custom_logo_url']);
     }
     $options['verify_user_email'] = isset($_POST['verify_user_email']) ? '1' : '0';
     $options['message_verify_user_email'] = isset($_POST['message_verify_user_email']) ? wp_kses_post((string) $_POST['message_verify_user_email']) : '';
     $options['verify_user_admin'] = isset($_POST['verify_user_admin']) ? '1' : '0';
     $options['message_verify_user_admin'] = isset($_POST['message_verify_user_admin']) ? wp_kses_post((string) $_POST['message_verify_user_admin']) : '';
     $options['delete_unverified_users_after'] = isset($_POST['delete_unverified_users_after']) ? absint((string) $_POST['delete_unverified_users_after']) : '0';
     $options['registration_redirect_url'] = isset($_POST['registration_redirect_url']) ? esc_url_raw((string) $_POST['registration_redirect_url']) : '';
     $options['verification_redirect_url'] = isset($_POST['verification_redirect_url']) ? esc_url_raw((string) $_POST['verification_redirect_url']) : '';
     $options['autologin_user'] = isset($_POST['autologin_user']) ? '1' : '0';
     $options['username_is_email'] = isset($_POST['username_is_email']) ? '1' : '0';
     $options['double_check_email'] = isset($_POST['double_check_email']) ? '1' : '0';
     if (isset($_POST['show_fields']) && is_array($_POST['show_fields'])) {
         $options['show_fields'] = (array) $_POST['show_fields'];
     }
     if (isset($_POST['required_fields']) && is_array($_POST['required_fields'])) {
         $options['required_fields'] = (array) $_POST['required_fields'];
     }
     $options['user_set_password'] = isset($_POST['user_set_password']) ? '1' : '0';
     $options['min_password_length'] = isset($_POST['min_password_length']) ? absint($_POST['min_password_length']) : 0;
     $options['disable_password_confirmation'] = isset($_POST['disable_password_confirmation']) ? '1' : '0';
     $options['show_password_meter'] = isset($_POST['show_password_meter']) ? '1' : '0';
     $options['message_empty_password'] = isset($_POST['message_empty_password']) ? wp_kses_data((string) $_POST['message_empty_password']) : '';
     $options['message_short_password'] = isset($_POST['message_short_password']) ? wp_kses_data((string) $_POST['message_short_password']) : '';
     $options['message_bad_password'] = isset($_POST['message_bad_password']) ? wp_kses_data((string) $_POST['message_bad_password']) : '';
     $options['message_good_password'] = isset($_POST['message_good_password']) ? wp_kses_data((string) $_POST['message_good_password']) : '';
     $options['message_strong_password'] = isset($_POST['message_strong_password']) ? wp_kses_data((string) $_POST['message_strong_password']) : '';
     $options['message_mismatch_password'] = isset($_POST['message_mismatch_password']) ? wp_kses_data((string) $_POST['message_mismatch_password']) : '';
     $options['enable_invitation_code'] = isset($_POST['enable_invitation_code']) ? '1' : '0';
     if (isset($_POST['invitation_code_bank']) && is_array($_POST['invitation_code_bank'])) {
         $invitation_code_bank = (array) $_POST['invitation_code_bank'];
     }
     $options['require_invitation_code'] = isset($_POST['require_invitation_code']) ? '1' : '0';
     $options['invitation_code_case_sensitive'] = isset($_POST['invitation_code_case_sensitive']) ? '1' : '0';
     $options['invitation_code_unique'] = isset($_POST['invitation_code_unique']) ? '1' : '0';
     $options['enable_invitation_tracking_widget'] = isset($_POST['enable_invitation_tracking_widget']) ? '1' : '0';
     $options['show_disclaimer'] = isset($_POST['show_disclaimer']) ? '1' : '0';
     $options['message_disclaimer_title'] = isset($_POST['message_disclaimer_title']) ? sanitize_text_field((string) $_POST['message_disclaimer_title']) : '';
     $options['message_disclaimer'] = isset($_POST['message_disclaimer']) ? wp_kses_post((string) $_POST['message_disclaimer']) : '';
     $options['require_disclaimer_agree'] = isset($_POST['require_disclaimer_agree']) ? '1' : '0';
     $options['message_disclaimer_agree'] = isset($_POST['message_disclaimer_agree']) ? sanitize_text_field((string) $_POST['message_disclaimer_agree']) : '';
     $options['show_license'] = isset($_POST['show_license']) ? '1' : '0';
     $options['message_license_title'] = isset($_POST['message_license_title']) ? sanitize_text_field((string) $_POST['message_license_title']) : '';
     $options['message_license'] = isset($_POST['message_license']) ? wp_kses_post((string) $_POST['message_license']) : '';
     $options['require_license_agree'] = isset($_POST['require_license_agree']) ? '1' : '0';
     $options['message_license_agree'] = isset($_POST['message_license_agree']) ? sanitize_text_field((string) $_POST['message_license_agree']) : '';
     $options['show_privacy_policy'] = isset($_POST['show_privacy_policy']) ? '1' : '0';
     $options['message_privacy_policy_title'] = isset($_POST['message_privacy_policy_title']) ? sanitize_text_field((string) $_POST['message_privacy_policy_title']) : '';
     $options['message_privacy_policy'] = isset($_POST['message_privacy_policy']) ? wp_kses_post((string) $_POST['message_privacy_policy']) : '';
     $options['require_privacy_policy_agree'] = isset($_POST['require_privacy_policy_agree']) ? '1' : '0';
     $options['message_privacy_policy_agree'] = isset($_POST['message_privacy_policy_agree']) ? sanitize_text_field((string) $_POST['message_privacy_policy_agree']) : '';
     $options['default_css'] = isset($_POST['default_css']) ? '1' : '0';
     $options['required_fields_style'] = '';
     if (isset($_POST['required_fields_style'])) {
         // Stolen from Jetpack 2.0.4 custom-css.php Jetpack_Custom_CSS::filter_attr()
         require_once 'csstidy/class.csstidy.php';
         $csstidy = new csstidy();
         $csstidy->set_cfg('remove_bslash', FALSE);
         $csstidy->set_cfg('compress_colors', FALSE);
         $csstidy->set_cfg('compress_font-weight', FALSE);
         $csstidy->set_cfg('discard_invalid_properties', TRUE);
         $csstidy->set_cfg('merge_selectors', FALSE);
         $csstidy->set_cfg('remove_last_;', FALSE);
         $csstidy->set_cfg('css_level', 'CSS3.0');
         $required_fields_style = 'div {' . (string) $_POST['required_fields_style'] . '}';
         $required_fields_style = preg_replace('/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $required_fields_style);
         $required_fields_style = wp_kses_split($required_fields_style, array(), array());
         $csstidy->parse($required_fields_style);
         $required_fields_style = $csstidy->print->plain();
         $required_fields_style = str_replace(array("\n", "\r", "\t"), '', $required_fields_style);
         preg_match("/^div\\s*{(.*)}\\s*\$/", $required_fields_style, $matches);
         if (!empty($matches[1])) {
             $options['required_fields_style'] = $matches[1];
         }
     }
     $options['required_fields_asterisk'] = isset($_POST['required_fields_asterisk']) ? '1' : '0';
     $options['starting_tabindex'] = isset($_POST['starting_tabindex']) ? absint($_POST['starting_tabindex']) : 0;
     /*
     if ( isset( $_POST['datepicker_firstdayofweek'] ) ) $options['datepicker_firstdayofweek'] = absint( $_POST['datepicker_firstdayofweek'] );
     if ( isset( $_POST['datepicker_dateformat'] ) ) $options['datepicker_dateformat'] = sanitize_text_field( (string) $_POST['datepicker_dateformat'] );
     if ( isset( $_POST['datepicker_startdate'] ) ) $options['datepicker_startdate'] = sanitize_text_field( (string) $_POST['datepicker_startdate'] );
     if ( isset( $_POST['datepicker_calyear'] ) ) $options['datepicker_calyear'] = sanitize_text_field( (string) $_POST['datepicker_calyear'] );
     if ( isset( $_POST['datepicker_calmonth'] ) ) $options['datepicker_calmonth'] = sanitize_text_field( (string) $_POST['datepicker_calmonth'] );
     */
     $options['disable_user_message_registered'] = isset($_POST['disable_user_message_registered']) ? '1' : '0';
     $options['disable_user_message_created'] = isset($_POST['disable_user_message_created']) ? '1' : '0';
     $options['custom_user_message'] = isset($_POST['custom_user_message']) ? '1' : '0';
     $options['user_message_from_email'] = isset($_POST['user_message_from_email']) ? sanitize_text_field((string) $_POST['user_message_from_email']) : '';
     $options['user_message_from_name'] = isset($_POST['user_message_from_name']) ? sanitize_text_field((string) $_POST['user_message_from_name']) : '';
     $options['user_message_subject'] = isset($_POST['user_message_subject']) ? sanitize_text_field((string) $_POST['user_message_subject']) : '';
     $options['user_message_body'] = isset($_POST['user_message_body']) ? wp_kses_post((string) $_POST['user_message_body']) : '';
     $options['send_user_message_in_html'] = isset($_POST['send_user_message_in_html']) ? '1' : '0';
     $options['user_message_newline_as_br'] = isset($_POST['user_message_newline_as_br']) ? '1' : '0';
     $options['custom_verification_message'] = isset($_POST['custom_verification_message']) ? '1' : '0';
     $options['verification_message_from_email'] = isset($_POST['verification_message_from_email']) ? sanitize_text_field((string) $_POST['verification_message_from_email']) : '';
     $options['verification_message_from_name'] = isset($_POST['verification_message_from_name']) ? sanitize_text_field((string) $_POST['verification_message_from_name']) : '';
     $options['verification_message_subject'] = isset($_POST['verification_message_subject']) ? sanitize_text_field((string) $_POST['verification_message_subject']) : '';
     $options['verification_message_body'] = isset($_POST['verification_message_body']) ? wp_kses_post((string) $_POST['verification_message_body']) : '';
     $options['send_verification_message_in_html'] = isset($_POST['send_verification_message_in_html']) ? '1' : '0';
     $options['verification_message_newline_as_br'] = isset($_POST['verification_message_newline_as_br']) ? '1' : '0';
     $options['disable_admin_message_registered'] = isset($_POST['disable_admin_message_registered']) ? '1' : '0';
     $options['disable_admin_message_created'] = isset($_POST['disable_admin_message_created']) ? '1' : '0';
     $options['admin_message_when_verified'] = isset($_POST['admin_message_when_verified']) ? '1' : '0';
     $options['custom_admin_message'] = isset($_POST['custom_admin_message']) ? '1' : '0';
     $options['admin_message_from_email'] = isset($_POST['admin_message_from_email']) ? sanitize_text_field((string) $_POST['admin_message_from_email']) : '';
     $options['admin_message_from_name'] = isset($_POST['admin_message_from_name']) ? sanitize_text_field((string) $_POST['admin_message_from_name']) : '';
     $options['admin_message_subject'] = isset($_POST['admin_message_subject']) ? sanitize_text_field((string) $_POST['admin_message_subject']) : '';
     $options['admin_message_body'] = isset($_POST['admin_message_body']) ? wp_kses_post((string) $_POST['admin_message_body']) : '';
     $options['send_admin_message_in_html'] = isset($_POST['send_admin_message_in_html']) ? '1' : '0';
     $options['admin_message_newline_as_br'] = isset($_POST['admin_message_newline_as_br']) ? '1' : '0';
     $options['custom_registration_page_css'] = '';
     if (isset($_POST['custom_registration_page_css'])) {
         // Stolen from Jetpack 2.0.4 custom-css.php Jetpack_Custom_CSS::init()
         require_once 'csstidy/class.csstidy.php';
         $csstidy = new csstidy();
         $csstidy->set_cfg('remove_bslash', FALSE);
         $csstidy->set_cfg('compress_colors', FALSE);
         $csstidy->set_cfg('compress_font-weight', FALSE);
         $csstidy->set_cfg('optimise_shorthands', 0);
         $csstidy->set_cfg('remove_last_;', FALSE);
         $csstidy->set_cfg('case_properties', FALSE);
         $csstidy->set_cfg('discard_invalid_properties', TRUE);
         $csstidy->set_cfg('css_level', 'CSS3.0');
         $csstidy->set_cfg('preserve_css', TRUE);
         $csstidy->set_cfg('template', dirname(__FILE__) . '/csstidy/wordpress-standard.tpl');
         $custom_registration_page_css = (string) $_POST['custom_registration_page_css'];
         $custom_registration_page_css = preg_replace('/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $custom_registration_page_css);
         $custom_registration_page_css = str_replace('<=', '&lt;=', $custom_registration_page_css);
         $custom_registration_page_css = wp_kses_split($custom_registration_page_css, array(), array());
         $custom_registration_page_css = str_replace('&gt;', '>', $custom_registration_page_css);
         $custom_registration_page_css = strip_tags($custom_registration_page_css);
         $csstidy->parse($custom_registration_page_css);
         $options['custom_registration_page_css'] = $csstidy->print->plain();
     }
     $options['custom_login_page_css'] = '';
     if (isset($_POST['custom_login_page_css'])) {
         // Stolen from Jetpack 2.0.4 custom-css.php Jetpack_Custom_CSS::init()
         require_once 'csstidy/class.csstidy.php';
         $csstidy = new csstidy();
         $csstidy->set_cfg('remove_bslash', FALSE);
         $csstidy->set_cfg('compress_colors', FALSE);
         $csstidy->set_cfg('compress_font-weight', FALSE);
         $csstidy->set_cfg('optimise_shorthands', 0);
         $csstidy->set_cfg('remove_last_;', FALSE);
         $csstidy->set_cfg('case_properties', FALSE);
         $csstidy->set_cfg('discard_invalid_properties', TRUE);
         $csstidy->set_cfg('css_level', 'CSS3.0');
         $csstidy->set_cfg('preserve_css', TRUE);
         $csstidy->set_cfg('template', dirname(__FILE__) . '/csstidy/wordpress-standard.tpl');
         $custom_login_page_css = (string) $_POST['custom_login_page_css'];
         $custom_login_page_css = preg_replace('/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $custom_login_page_css);
         $custom_login_page_css = str_replace('<=', '&lt;=', $custom_login_page_css);
         $custom_login_page_css = wp_kses_split($custom_login_page_css, array(), array());
         $custom_login_page_css = str_replace('&gt;', '>', $custom_login_page_css);
         $custom_login_page_css = strip_tags($custom_login_page_css);
         $csstidy->parse($custom_login_page_css);
         $options['custom_login_page_css'] = $csstidy->print->plain();
     }
     if (isset($_POST['label'])) {
         foreach ((array) $_POST['label'] as $index => $v) {
             $meta_field = array();
             if (!empty($_POST['label'][$index])) {
                 $meta_field['label'] = isset($_POST['label'][$index]) ? sanitize_text_field((string) $_POST['label'][$index]) : '';
                 $meta_field['meta_key'] = isset($_POST['meta_key'][$index]) ? sanitize_text_field((string) $_POST['meta_key'][$index]) : '';
                 $meta_field['display'] = isset($_POST['display'][$index]) ? sanitize_text_field((string) $_POST['display'][$index]) : '';
                 $meta_field['options'] = '';
                 if (isset($_POST['options'][$index])) {
                     if (in_array($meta_field['display'], array('checkbox', 'radio', 'select'))) {
                         /*.array[]string.*/
                         $field_options = explode(',', (string) $_POST['options'][$index]);
                         foreach ($field_options as &$field_option) {
                             $field_option = sanitize_text_field($field_option);
                         }
                         $meta_field['options'] = implode(',', $field_options);
                     } else {
                         $meta_field['options'] = sanitize_text_field((string) $_POST['options'][$index]);
                     }
                 }
                 $meta_field['escape_url'] = '0';
                 $meta_field['show_on_profile'] = isset($_POST['show_on_profile'][$index]) ? '1' : '0';
                 $meta_field['show_on_registration'] = isset($_POST['show_on_registration'][$index]) ? '1' : '0';
                 $meta_field['require_on_registration'] = isset($_POST['require_on_registration'][$index]) ? '1' : '0';
                 $meta_field['show_datepicker'] = isset($_POST['show_datepicker'][$index]) ? '1' : '0';
                 $meta_field['terms_content'] = isset($_POST['terms_content'][$index]) ? wp_kses_post((string) $_POST['terms_content'][$index]) : '';
                 $meta_field['terms_agreement_text'] = isset($_POST['terms_agreement_text'][$index]) ? wp_kses_post((string) $_POST['terms_agreement_text'][$index]) : '';
                 $meta_field['date_revised'] = isset($_POST['date_revised'][$index]) ? strtotime((string) $_POST['date_revised'][$index]) : time();
                 if (empty($meta_field['meta_key'])) {
                     $meta_field['meta_key'] = 'rpr_' . Register_Plus_Redux::sanitize_text($meta_field['label']);
                 }
             }
             $redux_usermeta[] = $meta_field;
         }
     }
     if (isset($_POST['newMetaFields'])) {
         foreach ((array) $_POST['newMetaFields'] as $label) {
             $meta_field = array();
             $meta_field['label'] = sanitize_text_field($label);
             $meta_field['meta_key'] = 'rpr_' . Register_Plus_Redux::sanitize_text($meta_field['label']);
             $meta_field['display'] = '';
             $meta_field['options'] = '';
             $meta_field['escape_url'] = '0';
             $meta_field['show_on_profile'] = '0';
             $meta_field['show_on_registration'] = '0';
             $meta_field['require_on_registration'] = '0';
             $meta_field['show_datepicker'] = '0';
             $meta_field['terms_content'] = '';
             $meta_field['terms_agreement_text'] = '';
             $meta_field['date_revised'] = time();
             $redux_usermeta[] = $meta_field;
         }
     }
     $register_plus_redux->rpr_update_options($options);
     if (!empty($invitation_code_bank)) {
         update_option('register_plus_redux_invitation_code_bank-rv1', $invitation_code_bank);
     }
     if (!empty($redux_usermeta)) {
         update_option('register_plus_redux_usermeta-rv2', $redux_usermeta);
     }
 }
 public function send_admin_mail($user_id, $plaintext_pass, $verification_code = '')
 {
     $user = get_userdata($user_id);
     $subject = Register_Plus_Redux::default_options('admin_message_subject');
     $message = Register_Plus_Redux::default_options('admin_message_body');
     add_filter('wp_mail_content_type', array($this, 'rpr_filter_mail_content_type_text'), 10, 1);
     if ('1' === $this->rpr_get_option('custom_admin_message')) {
         $subject = esc_html($this->rpr_get_option('admin_message_subject'));
         $message = $this->rpr_get_option('admin_message_body');
         if ('1' === $this->rpr_get_option('send_admin_message_in_html') && '1' === $this->rpr_get_option('admin_message_newline_as_br')) {
             $message = nl2br((string) $message);
         }
         $from_name = $this->rpr_get_option('admin_message_from_name');
         if (!empty($from_name)) {
             add_filter('wp_mail_from_name', array($this, 'rpr_filter_admin_mail_from_name'), 10, 1);
         }
         if (FALSE !== is_email($this->rpr_get_option('admin_message_from_email'))) {
             add_filter('wp_mail_from', array($this, 'rpr_filter_admin_mail_from'), 10, 1);
         }
         if ('1' === $this->rpr_get_option('send_admin_message_in_html')) {
             add_filter('wp_mail_content_type', array($this, 'rpr_filter_mail_content_type_html'), 10, 1);
         }
     }
     $subject = $this->replace_keywords($subject, $user);
     $message = $this->replace_keywords($message, $user, $plaintext_pass, $verification_code);
     wp_mail(get_option('admin_email'), $subject, $message);
 }
 public function rpr_admin_init()
 {
     global $register_plus_redux;
     // TODO: Write function to migrate register plus settings to redux
     // should not be in init, likely to use similar code to rename
     if (!current_user_can('manage_options')) {
         return;
     }
     if (RPR_ACTIVATION_REQUIRED !== get_option('register_plus_redux_last_activated')) {
         $register_plus_redux->rpr_activation();
     }
     $updated = FALSE;
     // Rename options as necessary, prior to defaulting any new options
     $rename_options = array('registration_redirect' => 'registration_redirect_url');
     foreach ($rename_options as $old_name => $new_name) {
         $old_value = $register_plus_redux->rpr_get_option($old_name);
         $new_value = $register_plus_redux->rpr_get_option($new_name);
         if (NULL === $new_value && NULL !== $old_value) {
             $register_plus_redux->rpr_set_option($new_name, $old_value);
             $register_plus_redux->rpr_unset_option($old_name);
             $updated = TRUE;
         }
     }
     // Load defaults for any options
     foreach (Register_Plus_Redux::default_options() as $option => $default_value) {
         if (NULL === $register_plus_redux->rpr_get_option($option)) {
             $register_plus_redux->rpr_set_option($option, $default_value);
             $updated = TRUE;
         }
     }
     if (TRUE === $updated) {
         $register_plus_redux->rpr_update_options(NULL);
     }
     // Added 03/28/11 in 3.7.4 converting invitation_code_bank to own option
     /*.array[]string.*/
     $nested_invitation_code_bank = $register_plus_redux->rpr_get_option('invitation_code_bank');
     /*.array[]string.*/
     $invitation_code_bank = get_option('register_plus_redux_invitation_code_bank-rv1');
     // TODO: This may need some work, not sure isset will fire the way I think it does
     if (FALSE === $invitation_code_bank && isset($nested_invitation_code_bank)) {
         update_option('register_plus_redux_invitation_code_bank-rv1', $nested_invitation_code_bank);
         //TODO: Confirm old invitation codes are migrating successfully, then kill old option
         //$register_plus_redux->rpr_unset_option( 'invitation_code_bank' );
     }
     // Added 03/02/13 in 3.9.6 converting 'unverified_*' users to "Unverified" users
     /*.object.*/
     $user_query = new WP_User_Query(array('meta_key' => 'stored_user_login'));
     if (!empty($user_query->results)) {
         global $wpdb;
         foreach ($user_query->results as $user) {
             $stored_user_login = get_user_meta($user->ID, 'stored_user_login', TRUE);
             $wpdb->update($wpdb->users, array('user_login' => $stored_user_login), array('ID' => $user->ID));
             $user->set_role('rpr_unverified');
             delete_user_meta($user->ID, 'stored_user_login');
         }
     }
     // Added 03/18/13 in 3.9.9 remove capability 'rpr_can_login', rely on role 'rpr_unverified' alone
     global $wp_roles;
     foreach ($wp_roles->get_names() as $role_name => $display_name) {
         $wp_roles->remove_cap($role_name, 'rpr_can_login');
     }
     // Added 03/28/11 in 3.7.4 converting custom fields
     /*.array[]mixed.*/
     $redux_usermeta = get_option('register_plus_redux_usermeta-rv2');
     if (empty($redux_usermeta)) {
         /*.array[]mixed.*/
         $redux_usermeta_rv1 = get_option('register_plus_redux_usermeta-rv1');
         /*.array[]mixed.*/
         $custom_fields = get_option('register_plus_redux_custom_fields');
         if (is_array($redux_usermeta_rv1)) {
             /*.array[]mixed.*/
             $redux_usermeta = array();
             foreach ($redux_usermeta_rv1 as $meta_field_rv1) {
                 $meta_field = array();
                 $meta_field['label'] = $meta_field_rv1['label'];
                 $meta_field['meta_key'] = $meta_field_rv1['meta_key'];
                 $meta_field['display'] = $meta_field_rv1['control'];
                 $meta_field['options'] = $meta_field_rv1['options'];
                 $meta_field['show_datepicker'] = '0';
                 $meta_field['escape_url'] = '0';
                 $meta_field['show_on_profile'] = $meta_field_rv1['show_on_profile'];
                 $meta_field['show_on_registration'] = $meta_field_rv1['show_on_registration'];
                 $meta_field['require_on_registration'] = $meta_field_rv1['required_on_registration'];
                 if ('text' === $meta_field['display']) {
                     $meta_field['display'] = 'textbox';
                 } elseif ('date' === $meta_field['display']) {
                     $meta_field['display'] = 'text';
                     $meta_field['show_datepicker'] = '1';
                 } elseif ('url' === $meta_field['display']) {
                     $meta_field['display'] = 'text';
                     $meta_field['escape_url'] = '1';
                 } elseif ('static' === $meta_field['display']) {
                     $meta_field['display'] = 'text';
                 }
                 $redux_usermeta[] = $meta_field;
             }
             // TODO: Confirm old custom fields are migrating successfully, then kill old option
             //delete_option( 'register_plus_redux_usermeta-rv1' );
             if (!empty($redux_usermeta)) {
                 update_option('register_plus_redux_usermeta-rv2', $redux_usermeta);
             }
         } elseif (is_array($custom_fields)) {
             /*.array[]mixed.*/
             $redux_usermeta = array();
             foreach ($custom_fields as $custom_field) {
                 $meta_field = array();
                 $meta_field['label'] = $custom_field['custom_field_name'];
                 $meta_field['meta_key'] = Register_Plus_Redux::sanitize_text($custom_field['custom_field_name']);
                 $meta_field['display'] = $custom_field['custom_field_type'];
                 $meta_field['options'] = $custom_field['custom_field_options'];
                 $meta_field['show_datepicker'] = '0';
                 $meta_field['escape_url'] = '0';
                 $meta_field['show_on_profile'] = $custom_field['show_on_profile'];
                 $meta_field['show_on_registration'] = $custom_field['show_on_registration'];
                 $meta_field['require_on_registration'] = $custom_field['required_on_registration'];
                 if ('text' === $meta_field['display']) {
                     $meta_field['display'] = 'textbox';
                 } elseif ('date' === $meta_field['display']) {
                     $meta_field['display'] = 'text';
                     $meta_field['show_datepicker'] = '1';
                 } elseif ('url' === $meta_field['display']) {
                     $meta_field['display'] = 'text';
                     $meta_field['escape_url'] = '1';
                 } elseif ('static' === $meta_field['display']) {
                     $meta_field['display'] = 'text';
                 }
                 $redux_usermeta[] = $meta_field;
             }
             // TODO: Confirm old custom fields are migrating successfully, then kill old option
             //delete_option( 'register_plus_redux_custom_fields' );
             if (!empty($redux_usermeta)) {
                 update_option('register_plus_redux_usermeta-rv2', $redux_usermeta);
             }
         }
     }
     update_option('register_plus_redux_version', RPR_VERSION);
 }
 public function rpr_signup_extra_fields($errors)
 {
     global $register_plus_redux;
     if ('1' === $register_plus_redux->rpr_get_option('double_check_email')) {
         $user_email2 = isset($_REQUEST['user_email2']) ? (string) $_REQUEST['user_email2'] : '';
         echo "\n", '<label id="user_email2-label" for="user_email2">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk')) {
             echo '*';
         }
         echo __('Confirm E-mail', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('user_email2')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" autocomplete="off" name="user_email2" id="user_email2" value="', esc_attr($user_email2), '" />';
     }
     if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('first_name', $register_plus_redux->rpr_get_option('show_fields'))) {
         $first_name = isset($_REQUEST['first_name']) ? (string) $_REQUEST['first_name'] : '';
         echo "\n", '<label id="first_name-label" for="first_name">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('first_name', $register_plus_redux->rpr_get_option('required_fields'))) {
             echo '*';
         }
         echo __('First Name', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('first_name')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" name="first_name" id="first_name" value="', esc_attr($first_name), '" />';
     }
     if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('last_name', $register_plus_redux->rpr_get_option('show_fields'))) {
         $last_name = isset($_REQUEST['last_name']) ? (string) $_REQUEST['last_name'] : '';
         echo "\n", '<label id="last_name-label" for="last_name">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('last_name', $register_plus_redux->rpr_get_option('required_fields'))) {
             echo '*';
         }
         echo __('Last Name', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('last_name')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" name="last_name" id="last_name" value="', esc_attr($last_name), '" />';
     }
     if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('user_url', $register_plus_redux->rpr_get_option('show_fields'))) {
         $user_url = isset($_REQUEST['user_url']) ? (string) $_REQUEST['user_url'] : '';
         echo "\n", '<label id="user_url-label" for="user_url">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('user_url', $register_plus_redux->rpr_get_option('required_fields'))) {
             echo '*';
         }
         echo __('Website', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('user_url')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" name="user_url" id="user_url" value="', esc_attr($user_url), '" />';
     }
     if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('aim', $register_plus_redux->rpr_get_option('show_fields'))) {
         $aim = isset($_REQUEST['aim']) ? (string) $_REQUEST['aim'] : '';
         echo "\n", '<label id="aim-label" for="aim">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('aim', $register_plus_redux->rpr_get_option('required_fields'))) {
             echo '*';
         }
         echo __('AIM', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('aim')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" name="aim" id="aim" value="', esc_attr($aim), '" />';
     }
     if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('yahoo', $register_plus_redux->rpr_get_option('show_fields'))) {
         $yahoo = isset($_REQUEST['yahoo']) ? (string) $_REQUEST['yahoo'] : '';
         echo "\n", '<label id="yahoo-label" for="yahoo">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('yahoo', $register_plus_redux->rpr_get_option('required_fields'))) {
             echo '*';
         }
         echo __('Yahoo IM', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('yahoo')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" name="yahoo" id="yahoo" value="', esc_attr($yahoo), '" />';
     }
     if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('jabber', $register_plus_redux->rpr_get_option('show_fields'))) {
         $jabber = isset($_REQUEST['jabber']) ? (string) $_REQUEST['jabber'] : '';
         echo "\n", '<label id="jabber-label" for="jabber">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('jabber', $register_plus_redux->rpr_get_option('required_fields'))) {
             echo '*';
         }
         echo __('Jabber / Google Talk', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('jabber')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" name="jabber" id="jabber" value="', esc_attr($jabber), '" />';
     }
     if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('about', $register_plus_redux->rpr_get_option('show_fields'))) {
         $description = isset($_REQUEST['description']) ? (string) $_REQUEST['description'] : '';
         echo "\n", '<label id="description-label" for="description">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('about', $register_plus_redux->rpr_get_option('required_fields'))) {
             echo '*';
         }
         echo __('About Yourself', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('description')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<textarea name="description" id="description" cols="25" rows="5">', esc_textarea($description), '</textarea>';
         echo '<br />', __('Share a little biographical information to fill out your profile. This may be shown publicly.', 'register-plus-redux');
     }
     $redux_usermeta = get_option('register_plus_redux_usermeta-rv2');
     if (is_array($redux_usermeta)) {
         foreach ($redux_usermeta as $meta_field) {
             if (!empty($meta_field['show_on_registration'])) {
                 $meta_key = esc_attr($meta_field['meta_key']);
                 if ('checkbox' === $meta_field['display']) {
                     $meta_value = isset($_REQUEST[$meta_key]) ? (array) $_REQUEST[$meta_key] : '';
                 } else {
                     $meta_value = isset($_REQUEST[$meta_key]) ? (string) $_REQUEST[$meta_key] : '';
                 }
                 if ($meta_field['display'] != 'hidden' && $meta_field['display'] != 'text') {
                     echo "\n", '<label id="', $meta_key, '-label" for="', $meta_key, '">';
                     if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && !empty($meta_field['require_on_registration'])) {
                         echo '*';
                     }
                     echo esc_html($meta_field['label']), ':</label>';
                     if ($errmsg = $errors->get_error_message($meta_key)) {
                         echo '<p class="error">', $errmsg, '</p>';
                     }
                 }
                 switch ($meta_field['display']) {
                     case 'textbox':
                         echo "\n", '<input type="text" name="', $meta_key, '" id="', $meta_key, '" ';
                         if ('1' === $meta_field['show_datepicker']) {
                             echo 'class="datepicker" ';
                         }
                         echo 'value="', esc_attr($meta_value), '" />';
                         break;
                     case 'select':
                         echo "\n", '<select name="', $meta_key, '" id="', $meta_key, '">';
                         /*.array[]string.*/
                         $field_options = explode(',', $meta_field['options']);
                         foreach ($field_options as $field_option) {
                             echo "\n", '<option id="', $meta_key, '-', Register_Plus_Redux::sanitize_text($field_option), '" value="', esc_attr($field_option), '"';
                             if ($meta_value === esc_attr($field_option)) {
                                 echo ' selected="selected"';
                             }
                             echo '>', esc_html($field_option), '</option>';
                         }
                         echo "n</select>";
                         break;
                     case 'checkbox':
                         /*.array[]string.*/
                         $field_options = explode(',', $meta_field['options']);
                         foreach ($field_options as $field_option) {
                             echo "\n", '<input type="checkbox" name="', $meta_key, '[]" id="', $meta_key, '-', Register_Plus_Redux::sanitize_text($field_option), '" value="', esc_attr($field_option), '" ';
                             if (is_array($meta_value) && in_array(esc_attr($field_option), $meta_value)) {
                                 echo 'checked="checked" ';
                             }
                             if (!is_array($meta_value) && $meta_value === esc_attr($field_option)) {
                                 echo 'checked="checked" ';
                             }
                             echo '><label id="', $meta_key, '-', Register_Plus_Redux::sanitize_text($field_option), '-label" class="', $meta_key, '" for="', $meta_key, '-', Register_Plus_Redux::sanitize_text($field_option), '">&nbsp;', esc_html($field_option), '</label><br />';
                         }
                         break;
                     case 'radio':
                         /*.array[]string.*/
                         $field_options = explode(',', $meta_field['options']);
                         foreach ($field_options as $field_option) {
                             echo "\n", '<input type="radio" name="', $meta_key, '" id="', $meta_key, '-', Register_Plus_Redux::sanitize_text($field_option), '" value="', esc_attr($field_option), '" ';
                             if ($meta_value === esc_attr($field_option)) {
                                 echo 'checked="checked" ';
                             }
                             echo '><label id="', $meta_key, '-', Register_Plus_Redux::sanitize_text($field_option), '-label" class="', $meta_key, '" for="', $meta_key, '-', Register_Plus_Redux::sanitize_text($field_option), '">&nbsp;', esc_html($field_option), '</label><br />';
                         }
                         break;
                     case 'textarea':
                         echo "\n", '<textarea name="', $meta_key, '" id="', $meta_key, '" cols="25" rows="5">', esc_textarea($meta_value), '</textarea>';
                         break;
                     case 'hidden':
                         echo "\n", '<input type="hidden" name="', $meta_key, '" id="', $meta_key, '" value="', esc_attr($meta_value), '" />';
                         break;
                     case 'text':
                         echo "\n", esc_html($meta_field['label']);
                         break;
                 }
             }
         }
     }
     if ('1' === $register_plus_redux->rpr_get_option('user_set_password')) {
         echo "\n", '<label id="pass1-label" for="pass1-label">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk')) {
             echo '*';
         }
         echo __('Password', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('pass1')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="password" autocomplete="off" name="pass1" id="pass1" />';
         if ('1' !== $register_plus_redux->rpr_get_option('disable_password_confirmation')) {
             echo "\n", '<label id="pass2-label" for="pass2-label">';
             if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk')) {
                 echo '*';
             }
             echo __('Confirm Password', 'register-plus-redux'), ':</label>';
             if ($errmsg = $errors->get_error_message('pass2')) {
                 echo '<p class="error">', $errmsg, '</p>';
             }
             echo "\n", '<input type="password" autocomplete="off" name="pass2" id="pass2" />';
         }
         if ('1' === $register_plus_redux->rpr_get_option('show_password_meter')) {
             echo "\n", '<div id="pass-strength-result">', $register_plus_redux->rpr_get_option('message_empty_password'), '</div>';
             echo "\n", '<p id="pass_strength_msg" style="display: inline;">', sprintf(__('Your password must be at least %d characters long. To make your password stronger, use upper and lower case letters, numbers, and the following symbols !@#$%%^&amp;*()', 'register-plus-redux'), absint($register_plus_redux->rpr_get_option('min_password_length'))), '</p>';
         }
     }
     if ('1' === $register_plus_redux->rpr_get_option('enable_invitation_code')) {
         $invitation_code = isset($_REQUEST['invitation_code']) ? (string) $_REQUEST['invitation_code'] : '';
         echo "\n", '<label id="invitation_code-label" for="invitation_code">';
         if ('1' === $register_plus_redux->rpr_get_option('required_fields_asterisk') && '1' === $register_plus_redux->rpr_get_option('require_invitation_code')) {
             echo '*';
         }
         echo __('Invitation Code', 'register-plus-redux'), ':</label>';
         if ($errmsg = $errors->get_error_message('invitation_code')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
         echo "\n", '<input type="text" name="invitation_code" id="invitation_code" value="', esc_attr($invitation_code), '" />';
         if ('1' === $register_plus_redux->rpr_get_option('require_invitation_code')) {
             echo "\n", '<p id="invitation_code_msg" style="display: inline;">', __('This website is currently closed to public registrations. You will need an invitation code to register.', 'register-plus-redux'), '</p>';
         } else {
             echo "\n", '<p id="invitation_code_msg" style="display: inline;">', __('Have an invitation code? Enter it here. (This is not required)', 'register-plus-redux'), '</p>';
         }
     }
     if ('1' === $register_plus_redux->rpr_get_option('show_disclaimer')) {
         $accept_disclaimer = isset($_REQUEST['accept_disclaimer']) ? '1' : '0';
         echo "\n", '<label id="disclaimer-label" for="disclaimer">', esc_html($register_plus_redux->rpr_get_option('message_disclaimer_title')), ':</label>';
         echo "\n", '<div id="disclaimer" style="display: inline;">', nl2br($register_plus_redux->rpr_get_option('message_disclaimer')), '</div>';
         if ('1' === $register_plus_redux->rpr_get_option('require_disclaimer_agree')) {
             echo "\n", '<label id="accept_disclaimer-label"><input type="checkbox" name="accept_disclaimer" id="accept_disclaimer" value="1"';
             if ($accept_disclaimer) {
                 echo ' checked="checked"';
             }
             echo ' />&nbsp;', esc_html($register_plus_redux->rpr_get_option('message_disclaimer_agree')), '</label>';
         }
         if ($errmsg = $errors->get_error_message('disclaimer')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
     }
     if ('1' === $register_plus_redux->rpr_get_option('show_license')) {
         $accept_license = isset($_REQUEST['accept_license']) ? '1' : '0';
         echo "\n", '<label id="license-label" for="license">', esc_html($register_plus_redux->rpr_get_option('message_license_title')), ':</label>';
         echo "\n", '<div id="license" style="display: inline;">', nl2br($register_plus_redux->rpr_get_option('message_license')), '</div>';
         if ('1' === $register_plus_redux->rpr_get_option('require_license_agree')) {
             echo "\n", '<label id="accept_license-label"><input type="checkbox" name="accept_license" id="accept_license" value="1"';
             if ($accept_license) {
                 echo ' checked="checked"';
             }
             echo ' />&nbsp;', esc_html($register_plus_redux->rpr_get_option('message_license_agree')), '</label>';
         }
         if ($errmsg = $errors->get_error_message('license')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
     }
     if ('1' === $register_plus_redux->rpr_get_option('show_privacy_policy')) {
         $accept_privacy_policy = isset($_REQUEST['accept_privacy_policy']) ? '1' : '0';
         echo "\n", '<label id="privacy_policy-label" for="privacy_policy">', esc_html($register_plus_redux->rpr_get_option('message_privacy_policy_title')), ':</label>';
         echo "\n", '<div id="privacy_policy" style="display: inline;">', nl2br($register_plus_redux->rpr_get_option('message_privacy_policy')), '</div>';
         if ('1' === $register_plus_redux->rpr_get_option('require_privacy_policy_agree')) {
             echo "\n", '<label id="accept_privacy_policy-label"><input type="checkbox" name="accept_privacy_policy" id="accept_privacy_policy" value="1"';
             if ($accept_privacy_policy) {
                 echo ' checked="checked"';
             }
             echo ' />&nbsp;', esc_html($register_plus_redux->rpr_get_option('message_privacy_policy_agree')), '</label>';
         }
         if ($errmsg = $errors->get_error_message('privacy_policy')) {
             echo '<p class="error">', $errmsg, '</p>';
         }
     }
     if (is_array($redux_usermeta)) {
         if (!$terms_exist) {
             foreach ($redux_usermeta as $meta_field) {
                 if ('terms' === $meta_field['display']) {
                     $terms_exist = TRUE;
                     break;
                 }
             }
         }
         if ($terms_exist) {
             foreach ($redux_usermeta as $meta_field) {
                 if ('terms' === $meta_field['display'] && '1' === $meta_field['show_on_registration']) {
                     $meta_value = isset($_REQUEST[$meta_key]) ? (string) $_REQUEST[$meta_key] : 'N';
                     $meta_key = (string) esc_attr($meta_field['meta_key']);
                     echo "\n", '<label id="', $meta_key, '-label">', esc_html($meta_field['label']), '</label><br />';
                     echo "\n", '<div id="', $meta_key, '-content" style="display: inline;">', nl2br($meta_field['terms_content']), '</div>';
                     if ('1' === $meta_field['require_on_registration']) {
                         echo "\n", '<label id="accept_', $meta_key, '-label"><input type="checkbox" name="', $meta_key, '" id="', $meta_key, '" value="Y"', checked($meta_value, 'Y'), ' />&nbsp;', esc_html($meta_field['terms_agreement_text']), '</label>';
                     }
                     if ($errmsg = $errors->get_error_message($meta_key)) {
                         echo '<p class="error">', $errmsg, '</p>';
                     }
                 }
             }
         }
     }
 }
Example #5
0
        public function rpr_login_head()
        {
            global $register_plus_redux;
            if ($register_plus_redux->rpr_get_option('custom_logo_url')) {
                if (ini_get('allow_url_fopen')) {
                    list($width, $height, $type, $attr) = getimagesize(esc_url($register_plus_redux->rpr_get_option('custom_logo_url')));
                }
                ?>
                <style type="text/css">
                    #login h1 a {
                        background-image: url("<?php 
                echo esc_url($register_plus_redux->rpr_get_option('custom_logo_url'));
                ?>
");
                        margin: 0 0 0 8px;
                        <?php 
                if (!empty($width)) {
                    echo 'width: ', $width, 'px;', "\n";
                }
                ?>
                        <?php 
                if (!empty($height)) {
                    echo 'height: ', $height, 'px;', "\n";
                }
                ?>
                        <?php 
                if (!empty($width) && !empty($height)) {
                    echo 'background-size: ', $width, 'px ', $height, 'px;', "\n";
                }
                ?>
                    }
                </style>
                <?php 
            }
            if (isset($_GET['checkemail']) && 'registered' === $_GET['checkemail'] && ('1' === $register_plus_redux->rpr_get_option('verify_user_admin') || '1' === $register_plus_redux->rpr_get_option('verify_user_email'))) {
                ?>
                <style type="text/css">
                    #loginform { display: none; }
                    #nav { display: none; }
                </style>
                <?php 
            }
            if (isset($_GET['action']) && 'register' === $_GET['action']) {
                /*.array[]mixed.*/
                $redux_usermeta = get_option('register_plus_redux_usermeta-rv2');
                $show_custom_date_fields = FALSE;
                if (is_array($redux_usermeta)) {
                    foreach ($redux_usermeta as $meta_field) {
                        if ('1' === $meta_field['show_on_registration']) {
                            $meta_key = esc_attr($meta_field['meta_key']);
                            if ('textbox' === $meta_field['display']) {
                                if (empty($show_custom_textbox_fields)) {
                                    $show_custom_textbox_fields = '#' . $meta_key;
                                } else {
                                    $show_custom_textbox_fields .= ', #' . $meta_key;
                                }
                            }
                            if ('select' === $meta_field['display']) {
                                if (empty($show_custom_select_fields)) {
                                    $show_custom_select_fields = '#' . $meta_key;
                                } else {
                                    $show_custom_select_fields .= ', #' . $meta_key;
                                }
                            }
                            if ('checkbox' === $meta_field['display']) {
                                /*.array[]string.*/
                                $field_options = explode(',', $meta_field['options']);
                                foreach ($field_options as $field_option) {
                                    if (empty($show_custom_checkbox_fields)) {
                                        $show_custom_checkbox_fields = '#' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . ', #' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . '-label';
                                    } else {
                                        $show_custom_checkbox_fields .= ', #' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . ', #' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . '-label';
                                    }
                                }
                            }
                            if ('radio' === $meta_field['display']) {
                                /*.array[]string.*/
                                $field_options = explode(',', $meta_field['options']);
                                foreach ($field_options as $field_option) {
                                    if (empty($show_custom_radio_fields)) {
                                        $show_custom_radio_fields = '#' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . ', #' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . '-label';
                                    } else {
                                        $show_custom_radio_fields .= ', #' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . ', #' . $meta_key . '-' . Register_Plus_Redux::sanitize_text($field_option) . '-label';
                                    }
                                }
                            }
                            if ('textarea' === $meta_field['display']) {
                                if (empty($show_custom_textarea_fields)) {
                                    $show_custom_textarea_fields = '#' . $meta_key;
                                } else {
                                    $show_custom_textarea_fields .= ', #' . $meta_key;
                                }
                            }
                            if ('text' === $meta_field['display']) {
                                if (empty($show_custom_text_fields)) {
                                    $show_custom_text_fields = '#login form #' . $meta_key . '-p';
                                } else {
                                    $show_custom_text_fields .= ', #login form #' . $meta_key . '-p';
                                }
                            }
                            if (!empty($meta_field['require_on_registration'])) {
                                if (empty($required_meta_fields)) {
                                    $required_meta_fields = '#' . $meta_key;
                                } else {
                                    $required_meta_fields .= ', #' . $meta_key;
                                }
                            }
                        }
                    }
                }
                if (is_array($register_plus_redux->rpr_get_option('show_fields'))) {
                    $show_fields = '#' . implode(', #', $register_plus_redux->rpr_get_option('show_fields'));
                }
                if (is_array($register_plus_redux->rpr_get_option('required_fields'))) {
                    $required_fields = '#' . implode(', #', $register_plus_redux->rpr_get_option('required_fields'));
                }
                echo "\n", '<style type="text/css">';
                if ('1' === $register_plus_redux->rpr_get_option('default_css')) {
                    if ('1' === $register_plus_redux->rpr_get_option('double_check_email')) {
                        echo "\n", '#user_email2 { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                    }
                    if (!empty($show_fields)) {
                        echo "\n", $show_fields, ' { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                    }
                    if (is_array($register_plus_redux->rpr_get_option('show_fields')) && in_array('about', $register_plus_redux->rpr_get_option('show_fields'))) {
                        echo "\n", '#description { font-size:18px; height: 60px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                        echo "\n", '#description_msg { font-size: smaller; }';
                    }
                    if (!empty($show_custom_textbox_fields)) {
                        echo "\n", $show_custom_textbox_fields, ' { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                    }
                    if (!empty($show_custom_select_fields)) {
                        echo "\n", $show_custom_select_fields, ' { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                    }
                    if (!empty($show_custom_checkbox_fields)) {
                        echo "\n", $show_custom_checkbox_fields, ' { font-size:18px; }';
                    }
                    if (!empty($show_custom_radio_fields)) {
                        echo "\n", $show_custom_radio_fields, ' { font-size:18px; }';
                    }
                    if (!empty($show_custom_textarea_fields)) {
                        echo "\n", $show_custom_textarea_fields, ' { font-size:18px; height: 60px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                    }
                    if (!empty($show_custom_text_fields)) {
                        echo "\n", $show_custom_text_fields, ' { font-size: larger; color: #777; margin-bottom:16px; }';
                    }
                    if ('1' === $register_plus_redux->rpr_get_option('user_set_password')) {
                        echo "\n", '#pass1, #pass2 { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                    }
                    if ('1' === $register_plus_redux->rpr_get_option('enable_invitation_code')) {
                        echo "\n", '#invitation_code { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:4px; border:1px solid #e5e5e5; background:#fbfbfb; }';
                        echo "\n", '#invitation_code_msg { font-size: smaller; color: #777; display: inline-block; margin-bottom:8px; }';
                    }
                }
                if ('1' === $register_plus_redux->rpr_get_option('show_disclaimer')) {
                    echo "\n", '#disclaimer { font-size:12px; display: block; width: 100%; padding: 3px; margin-top:2px; margin-right:6px; margin-bottom:8px; background-color:#fff; border:solid 1px #A7A6AA; font-weight:normal;';
                    if (strlen($register_plus_redux->rpr_get_option('message_disclaimer')) > 525) {
                        echo 'height: 160px; overflow: auto;';
                    }
                    echo ' }';
                }
                if ('1' === $register_plus_redux->rpr_get_option('show_license')) {
                    echo "\n", '#license { font-size:12px; display: block; width: 100%; padding: 3px; margin-top:2px; margin-right:6px; margin-bottom:8px; background-color:#fff; border:solid 1px #A7A6AA; font-weight:normal;';
                    if (strlen($register_plus_redux->rpr_get_option('message_license')) > 525) {
                        echo 'height: 160px; overflow: auto;';
                    }
                    echo ' }';
                }
                if ('1' === $register_plus_redux->rpr_get_option('show_privacy_policy')) {
                    echo "\n", '#privacy_policy { font-size:12px; display: block; width: 100%; padding: 3px; margin-top:2px; margin-right:6px; margin-bottom:8px; background-color:#fff; border:solid 1px #A7A6AA; font-weight:normal;';
                    if (strlen($register_plus_redux->rpr_get_option('message_privacy_policy')) > 525) {
                        echo 'height: 160px; overflow: auto;';
                    }
                    echo ' }';
                }
                if ('1' === $register_plus_redux->rpr_get_option('show_disclaimer') || '1' === $register_plus_redux->rpr_get_option('show_license') || '1' === $register_plus_redux->rpr_get_option('show_privacy_policy')) {
                    echo "\n", '.accept_check { display:block; margin-bottom:8px; }';
                }
                if ('1' === $register_plus_redux->rpr_get_option('user_set_password')) {
                    echo "\n", '#reg_passmail { display: none; }';
                    if ('1' === $register_plus_redux->rpr_get_option('show_password_meter')) {
                        echo "\n", '.login #pass-strength-result { width: 100%; margin-top: 0px; margin-right: 6px; margin-bottom: 8px; margin-left: 0px; border-width: 1px; border-style: solid; padding: 3px 0; text-align: center; font-weight: bold; display: block; }';
                        echo "\n", '#pass-strength-result { background-color: #eee; border-color: #ddd !important; }';
                        echo "\n", '#pass-strength-result.bad { background-color: #ffb78c; border-color: #ff853c !important; }';
                        echo "\n", '#pass-strength-result.good { background-color: #ffec8b; border-color: #fc0 !important; }';
                        echo "\n", '#pass-strength-result.short { background-color: #ffa0a0; border-color: #f04040 !important; }';
                        echo "\n", '#pass-strength-result.strong { background-color: #c3ff88; border-color: #8dff1c !important; }';
                    }
                    echo "\n", '#login form #pass_strength_msg { font-size: smaller; color: #777; margin-top: -8px; margin-bottom: 16px; }';
                }
                if ($register_plus_redux->rpr_get_option('required_fields_style')) {
                    echo "\n", '#user_login, #user_email { ', esc_html($register_plus_redux->rpr_get_option('required_fields_style')), '} ';
                    if ('1' === $register_plus_redux->rpr_get_option('double_check_email')) {
                        echo "\n", '#user_email2 { ', esc_html($register_plus_redux->rpr_get_option('required_fields_style')), ' }';
                    }
                    if (!empty($required_fields)) {
                        echo "\n", $required_fields, ' { ', esc_html($register_plus_redux->rpr_get_option('required_fields_style')), ' }';
                    }
                    if (is_array($register_plus_redux->rpr_get_option('required_fields')) && in_array('about', $register_plus_redux->rpr_get_option('required_fields'))) {
                        echo "\n", '#description { ', esc_html($register_plus_redux->rpr_get_option('required_fields_style')), ' }';
                    }
                    if (!empty($required_meta_fields)) {
                        echo "\n", $required_meta_fields, ' { ', esc_html($register_plus_redux->rpr_get_option('required_fields_style')), ' }';
                    }
                    if ('1' === $register_plus_redux->rpr_get_option('user_set_password')) {
                        echo "\n", '#pass1, #pass2 { ', esc_html($register_plus_redux->rpr_get_option('required_fields_style')), ' }';
                    }
                    if ('1' === $register_plus_redux->rpr_get_option('require_invitation_code')) {
                        echo "\n", '#invitation_code { ', esc_html($register_plus_redux->rpr_get_option('required_fields_style')), ' }';
                    }
                }
                if ($register_plus_redux->rpr_get_option('custom_registration_page_css')) {
                    echo "\n", esc_html($register_plus_redux->rpr_get_option('custom_registration_page_css'));
                }
                echo "\n", '</style>';
            } else {
                if ($register_plus_redux->rpr_get_option('custom_login_page_css')) {
                    echo "\n", '<style type="text/css">';
                    echo "\n", esc_html($register_plus_redux->rpr_get_option('custom_login_page_css'));
                    echo "\n", '</style>';
                }
            }
        }