/** * Updates the user meta. * * @param int $user_id */ public static function edit_user_profile_update($user_id) { global $wpdb; if (!affiliates_user_is_affiliate($user_id)) { return; } require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings.php'; require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-registration.php'; $registration_fields = Affiliates_Settings_Registration::get_fields(); // remove fields not stored as user meta foreach (Affiliates_Registration::get_skip_meta_fields() as $key) { unset($registration_fields[$key]); } unset($registration_fields['first_name']); unset($registration_fields['last_name']); // update user meta if (!empty($registration_fields)) { foreach ($registration_fields as $name => $field) { $meta_value = isset($_POST[$name]) ? $_POST[$name] : ''; $meta_value = Affiliates_Utility::filter($meta_value); update_user_meta($user_id, $name, maybe_unserialize($meta_value)); } } // The affiliate entry must be updated using the profile_update action // as we don't have the updated user info here yet. }
/** * Registration form. * * @see Affiliates_Registration::$defaults for accepted parameters * * @param array $options form options * @return string rendered registration form */ public static function render_form($options = array()) { wp_enqueue_style('affiliates'); self::$submit_button_label = __('Sign Up', AFFILIATES_PLUGIN_DOMAIN); $output = ''; // // Existing affiliate // if ($is_affiliate = affiliates_user_is_affiliate()) { $output .= '<div class="affiliates-registration registered">'; $output .= '<p>'; $output .= __('You are already registered as an affiliate.', AFFILIATES_PLUGIN_DOMAIN); $output .= '</p>'; if (isset($options['registered_profile_link_url'])) { $output .= '<p>'; $output .= '<a href="' . esc_url($options['registered_profile_link_url']) . '">'; if (isset($options['registered_profile_link_text'])) { $output .= wp_filter_kses($options['registered_profile_link_text']); } else { $output .= __('Access your profile', AFFILIATES_PLUGIN_DOMAIN); } $output .= '</a>'; $output .= '</p>'; } $output .= '</div>'; return $output; } // // Registration closed // if (!get_option('aff_registration', get_option('users_can_register', false))) { $output .= '<p>' . __('Registration is currently closed.', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; return $output; } require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings.php'; require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-registration.php'; $registration_fields = Affiliates_Settings_Registration::get_fields(); // // Gather user info // $user = null; if ($is_logged_in = is_user_logged_in()) { $user = wp_get_current_user(); if (isset($registration_fields['first_name']) && $registration_fields['first_name']['enabled']) { $first_name = $user->first_name; $first_name = sanitize_user_field('first_name', $first_name, $user->ID, 'display'); $registration_fields['first_name']['value'] = $first_name; } if (isset($registration_fields['last_name']) && $registration_fields['last_name']['enabled']) { $last_name = $user->last_name; $last_name = sanitize_user_field('last_name', $last_name, $user->ID, 'display'); $registration_fields['last_name']['value'] = $last_name; } if (isset($registration_fields['user_login']) && $registration_fields['user_login']['enabled']) { $user_login = $user->user_login; $user_login = sanitize_user_field('user_login', $user_login, $user->ID, 'display'); $registration_fields['user_login']['value'] = $user_login; } if (isset($registration_fields['user_email']) && $registration_fields['user_email']['enabled']) { $user_email = $user->user_email; $user_email = sanitize_user_field('email', $user_email, $user->ID, 'display'); $registration_fields['user_email']['value'] = $user_email; } if (isset($registration_fields['user_url']) && $registration_fields['user_url']['enabled']) { $url = $user->user_url; $url = sanitize_user_field('user_url', $url, $user->ID, 'display'); $registration_fields['user_url']['value'] = $url; } } $submit_name = 'affiliates-registration-submit'; $nonce = 'affiliates-registration-nonce'; $nonce_action = 'affiliates-registration'; $send = false; $captcha = ''; $error = false; if (!empty($_POST[$submit_name])) { if (!wp_verify_nonce($_POST[$nonce], $nonce_action)) { $error = true; // fail but don't give clues } $captcha = !empty($_POST[Affiliates_Utility::get_captcha_field_id()]) ? $_POST[Affiliates_Utility::get_captcha_field_id()] : null; if (!Affiliates_Utility::captcha_validates($captcha)) { $error = true; // dumbot } // gather field values foreach ($registration_fields as $name => $field) { if ($field['enabled']) { $value = isset($_POST[$name]) ? $_POST[$name] : ''; $value = Affiliates_Utility::filter($value); if ($field['required'] && empty($value)) { $error = true; $output .= '<div class="error">'; $output .= __('<strong>ERROR</strong>', AFFILIATES_PLUGIN_DOMAIN); $output .= ' : '; $output .= sprintf(__('Please fill out the field <em>%s</em>.', AFFILIATES_PLUGIN_DOMAIN), $field['label']); $output .= '</div>'; } $registration_fields[$name]['value'] = $value; } } $error = apply_filters('affiliates_registration_error_validate', $error); if (!$error) { $userdata = array(); foreach ($registration_fields as $name => $field) { if ($registration_fields[$name]['enabled']) { $userdata[$name] = $registration_fields[$name]['value']; } } // don't try to create a new user on multiple renderings global $affiliate_user_id, $new_affiliate_registered, $stored_affiliate; if (!isset($affiliate_user_id)) { if (!$is_logged_in) { // allow plugins to be aware of new user account being created do_action('affiliates_before_register_affiliate', $userdata); // create the affiliate user account $affiliate_user_id = self::register_affiliate($userdata); $new_affiliate_registered = true; do_action('affiliates_after_register_affiliate', $userdata); } else { $affiliate_user_id = $user->ID; $new_affiliate_registered = true; } } // register as affiliate if (!is_wp_error($affiliate_user_id)) { // add affiliate entry $send = true; if (!isset($stored_affiliate)) { if ($new_affiliate_registered) { $affiliate_id = self::store_affiliate($affiliate_user_id, $userdata); // update user including meta self::update_affiliate_user($affiliate_user_id, $userdata); do_action('affiliates_stored_affiliate', $affiliate_id, $affiliate_user_id); } $stored_affiliate = true; } $is_widget = isset($options['is_widget']) && ($options['is_widget'] === true || $options['is_widget'] == 'true'); $redirect = isset($options['redirect']) && ($options['redirect'] === true || $options['redirect'] == 'true'); $redirect_url = empty($_REQUEST['redirect_to']) ? apply_filters('affiliates_registration_login_redirect_url', get_site_url(get_current_blog_id(), 'wp-login.php?checkemail=confirm')) : $_REQUEST['redirect_to']; if ($redirect && !$is_widget && !headers_sent()) { wp_safe_redirect($redirect_url); exit; } else { $output .= '<p>' . __('Thanks for signing up!', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; if (!$is_logged_in) { $output .= '<p>' . __('Please check your email for the confirmation link.', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; if ($redirect && !$is_widget) { $output .= '<script type="text/javascript">window.location="' . esc_url($redirect_url) . '";</script>'; } else { $output .= '<p>'; $output .= sprintf(__('Log in <a href="%s">here</a>.', AFFILIATES_PLUGIN_DOMAIN), esc_url(apply_filters('affiliates_registration_login_redirect_url', get_site_url(get_current_blog_id(), 'wp-login.php?checkemail=confirm')))); $output .= '</p>'; } } else { if (isset($options['registered_profile_link_url'])) { $output .= '<p>'; $output .= '<a href="' . esc_url($options['registered_profile_link_url']) . '">'; if (isset($options['registered_profile_link_text'])) { $output .= wp_filter_kses($options['registered_profile_link_text']); } else { $output .= __('Access your profile', AFFILIATES_PLUGIN_DOMAIN); } $output .= '</a>'; $output .= '</p>'; } } } } else { // is_wp_error( $affiliate_user_id ), user registration failed $error = true; $wp_error = $affiliate_user_id; if ($wp_error->get_error_code()) { $errors = array(); $messages = array(); foreach ($wp_error->get_error_codes() as $code) { $severity = $wp_error->get_error_data($code); foreach ($wp_error->get_error_messages($code) as $error) { if ('message' == $severity) { $messages[] = $error; } else { $errors[] = $error; } } } if (!empty($errors)) { $output .= '<div class="error">'; $output .= apply_filters('login_errors', implode('<br />', $errors)); $output .= '</div>'; } if (!empty($messages)) { $output .= '<div class="message">'; $output .= apply_filters('login_messages', implode('<br />', $messages)); $output .= '</div>'; } } } } } // Registration form if (!$send) { if (isset($options['terms_post_id'])) { $terms_post = get_post($options['terms_post_id']); if ($terms_post) { $terms_post_link = '<a target="_blank" href="' . esc_url(get_permalink($terms_post->ID)) . '">' . get_the_title($terms_post->ID) . '</a>'; $terms = sprintf(apply_filters('affiliates_terms_post_link_text', __('By signing up, you indicate that you have read and agree to the %s.', AFFILIATES_PLUGIN_DOMAIN)), $terms_post_link); } } $output .= '<div class="affiliates-registration" id="affiliates-registration">'; $output .= '<img id="affiliates-registration-throbber" src="' . AFFILIATES_PLUGIN_URL . 'images/affiliates-throbber.gif" style="display:none" />'; $output .= '<form id="affiliates-registration-form" method="post">'; $output .= '<div>'; $output .= apply_filters('affiliates_registration_before_fields', ''); $output .= self::render_fields($registration_fields); $output .= apply_filters('affiliates_registration_after_fields', ''); if (isset($terms)) { $output .= '<div class="terms">' . $terms . '</div>'; } $output .= Affiliates_Utility::captcha_get($captcha); $output .= wp_nonce_field($nonce_action, $nonce, true, false); if (isset($options['redirect_to'])) { $output .= '<input type="hidden" name="redirect_to" value="' . esc_url($options['redirect_to']) . '" />'; } $output .= '<div class="sign-up">'; $output .= '<input type="submit" name="' . $submit_name . '" value="' . self::$submit_button_label . '" />'; $output .= '</div>'; $output .= '</div>'; $output .= '</form>'; $output .= '</div>'; } return $output; }
/** * Affiliate field info. * * user_id - print for ... requires AFFILIATES_ADMIN... * name - field name or names, empty includes all by default * edit - yes or no * load_styles - yes or no * * @param array $atts * @param string $content * @return string */ public static function affiliates_fields($atts, $content = null) { $output = ''; if (is_user_logged_in()) { $atts = shortcode_atts(array('edit' => 'yes', 'load_styles' => 'yes', 'name' => '', 'user_id' => null), $atts); $atts['load_styles'] = strtolower(trim($atts['load_styles'])); if ($atts['load_styles'] == 'yes') { wp_enqueue_style('affiliates-fields'); } $atts['edit'] = strtolower(trim($atts['edit'])); $fields = null; if (!empty($atts['name'])) { $fields = array_map('strtolower', array_map('trim', explode(',', $atts['name']))); } if (current_user_can(AFFILIATES_ADMINISTER_AFFILIATES) && !empty($atts['user_id'])) { $user_id = intval(trim($atts['user_id'])); } else { $user_id = get_current_user_id(); } $user = get_user_by('id', $user_id); if (affiliates_user_is_affiliate($user_id)) { require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings.php'; require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-registration.php'; $registration_fields = Affiliates_Settings_Registration::get_fields(); if ($atts['edit'] != 'yes') { unset($registration_fields['password']); } if (!empty($fields)) { $_registration_fields = array(); foreach ($fields as $name) { if (isset($registration_fields[$name])) { $_registration_fields[$name] = $registration_fields[$name]; } } $registration_fields = $_registration_fields; } // handle form submission if ($atts['edit'] === 'yes') { if (!empty($_POST['affiliate-nonce']) && wp_verify_nonce($_POST['affiliate-nonce'], 'save')) { if (!empty($registration_fields)) { $error = false; // gather field values foreach ($registration_fields as $name => $field) { if ($field['enabled']) { $value = isset($_POST[$name]) ? $_POST[$name] : ''; $value = Affiliates_Utility::filter($value); if ($field['required'] && empty($value) && !(is_user_logged_in() && isset($field['type']) && $field['type'] == 'password')) { $error = true; $output .= '<div class="error">'; $output .= __('<strong>ERROR</strong>', AFFILIATES_PLUGIN_DOMAIN); $output .= ' : '; $output .= sprintf(__('Please fill out the field <em>%s</em>.', AFFILIATES_PLUGIN_DOMAIN), $field['label']); $output .= '</div>'; } $registration_fields[$name]['value'] = $value; // password check $type = isset($field['type']) ? $field['type'] : 'text'; if ($type == 'password') { if (!empty($value)) { $value2 = isset($_POST[$name . '2']) ? $_POST[$name . '2'] : ''; $value2 = Affiliates_Utility::filter($value2); if ($value !== $value2) { $error = true; $output .= '<div class="error">'; $output .= __('<strong>ERROR</strong>', AFFILIATES_PLUGIN_DOMAIN); $output .= ' : '; $output .= sprintf(__('The passwords for the field <em>%s</em> do not match.', AFFILIATES_PLUGIN_DOMAIN), $field['label']); $output .= '</div>'; } } } } } $userdata = array(); foreach ($registration_fields as $name => $field) { if ($registration_fields[$name]['enabled']) { $userdata[$name] = $registration_fields[$name]['value']; } } if (!$error) { $updated_user_id = Affiliates_Registration::update_affiliate_user($user_id, $userdata); if (is_wp_error($updated_user_id)) { $error_messages = implode('<br/>', $updated_user_id->get_error_messages()); if (!empty($error_messages)) { $output .= '<div class="error">'; $output .= $error_messages; $output .= '</div>'; } } else { $output .= '<div class="updated">'; $output .= __('Saved', AFFILIATES_PLUGIN_DOMAIN); $output .= '</div>'; } } } } } // show form $n = 0; if (!empty($registration_fields)) { if ($atts['edit'] === 'yes') { $output .= '<form class="affiliates-fields" method="post">'; $output .= '<div>'; } else { $output .= '<div class="affiliates-fields">'; $output .= '<div>'; } foreach ($registration_fields as $name => $field) { if ($field['enabled']) { $n++; $output .= '<div class="field">'; $output .= '<label>'; $output .= esc_html(stripslashes($field['label'])); // @todo i18n $type = isset($field['type']) ? $field['type'] : 'text'; $extra = $atts['edit'] != 'yes' ? ' readonly="readonly" ' : ''; switch ($name) { case 'user_login': $extra .= ' readonly="readonly" '; $value = $user->user_login; break; case 'user_email': $value = $user->user_email; break; case 'user_url': $value = $user->user_url; break; case 'password': $value = ''; break; default: $value = get_user_meta($user_id, $name, true); } $output .= sprintf('<input type="%s" class="%s" name="%s" value="%s" %s %s />', esc_attr($type), 'regular-text ' . esc_attr($name) . ($type != 'password' && $field['required'] ? ' required ' : ''), esc_attr($name), esc_attr(stripslashes($value)), $type != 'password' && $field['required'] ? ' required="required" ' : '', $extra); $output .= '</label>'; $output .= '</div>'; if ($type == 'password') { // the second passwort field is also not required $output .= '<div class="field">'; $output .= '<label>'; $output .= sprintf(__('Repeat %s', AFFILIATES_PLUGIN_DOMAIN), esc_html(stripslashes($field['label']))); // @todo i18n $output .= sprintf('<input type="%s" class="%s" name="%s" value="%s" %s %s />', esc_attr($type), 'regular-text ' . esc_attr($name), esc_attr($name . '2'), esc_attr($value), '', $extra); $output .= '</label>'; $output .= '</div>'; } } } if ($atts['edit'] === 'yes') { $output .= wp_nonce_field('save', 'affiliate-nonce', true, false); $output .= '<div class="save">'; $output .= sprintf('<input class="button" type="submit" name="save" value="%s" />', __('Save', AFFILIATES_PLUGIN_DOMAIN)); $output .= '</div>'; $output .= '</div>'; $output .= '</form>'; } else { $output .= '</div>'; $output .= '</div>'; } } } } return $output; }
/** * Fields: * * - first_name * - last_name * - user_login * - email * - url * * first name + last name => affiliate name * * Form options : * - terms_post_id * - redirect_to * - is_widget * * @param array $options form options * @return string rendered registration form */ static function render_form($options = array()) { $output = ''; $ext = ''; // currently not relevant if ($is_logged_in = is_user_logged_in()) { $user = wp_get_current_user(); // sanitize_user_object is deprecated in WP 3.3 beta3 //$user = sanitize_user_object( $user ); $first_name = $user->first_name; $first_name = sanitize_user_field('first_name', $first_name, $user->ID, 'display'); $last_name = $user->last_name; $last_name = sanitize_user_field('last_name', $last_name, $user->ID, 'display'); $user_login = $user->user_login; $user_login = sanitize_user_field('user_login', $user_login, $user->ID, 'display'); $email = $user->user_email; $email = sanitize_user_field('email', $email, $user->ID, 'display'); $url = $user->user_url; $url = sanitize_user_field('user_url', $url, $user->ID, 'display'); } else { $user = null; } if ($is_affiliate = affiliates_user_is_affiliate()) { $output .= '<div class="affiliates-registration registered">'; $output .= '<p>'; $output .= __('You are already registered as an affiliate.', AFFILIATES_PLUGIN_DOMAIN); $output .= '</p>'; if (isset($options['registered_profile_link_url'])) { $output .= '<p>'; $output .= '<a href="' . esc_url($options['registered_profile_link_url']) . '">'; if (isset($options['registered_profile_link_text'])) { $output .= wp_filter_kses($options['registered_profile_link_text']); } else { $output .= __('Access your profile', AFFILIATES_PLUGIN_DOMAIN); } $output .= '</a>'; $output .= '</p>'; } $output .= '</div>'; return $output; } if (!get_option('aff_registration', get_option('users_can_register', false))) { $output .= '<p>' . __('Registration is currently closed.', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; return $output; } $method = 'post'; $action = ""; $submit_name = 'affiliates-registration-submit'; $nonce = 'affiliates-registration-nonce'; $nonce_action = 'affiliates-registration'; $send = false; $first_name_class = ' class="required" '; $last_name_class = ' class="required" '; $user_login_class = ' class="required" '; $email_class = ' class="required" '; $url_class = ''; if (isset($options['terms_post_id'])) { $terms_post = get_post($options['terms_post_id']); if ($terms_post) { $terms_post_link = '<a target="_blank" href="' . esc_url(get_permalink($terms_post->ID)) . '">' . get_the_title($terms_post->ID) . '</a>'; $terms = sprintf(__('By signing up, you indicate that you have read and agree to the %s.', AFFILIATES_PLUGIN_DOMAIN), $terms_post_link); } } $captcha = ''; $error = false; if (!empty($_POST[$submit_name])) { if (!wp_verify_nonce($_POST[$nonce], $nonce_action)) { $error = true; // fail but don't give clues } $captcha = $_POST[Affiliates_Utility::get_captcha_field_id()]; if (!Affiliates_Utility::captcha_validates($captcha)) { $error = true; // dumbot } if (!$is_logged_in) { $first_name = isset($_POST['first_name']) ? Affiliates_Utility::filter($_POST['first_name']) : ''; $last_name = isset($_POST['last_name']) ? Affiliates_Utility::filter($_POST['last_name']) : ''; $user_login = isset($_POST['user_login']) ? Affiliates_Utility::filter($_POST['user_login']) : ''; $email = isset($_POST['email']) ? Affiliates_Utility::filter($_POST['email']) : ''; $url = isset($_POST['url']) ? Affiliates_Utility::filter($_POST['url']) : ''; } else { $first_name = $user->first_name; $last_name = $user->last_name; $user_login = $user->user_login; $email = $user->user_email; $url = $user->user_url; } if (empty($first_name)) { $first_name_class = ' class="required missing" '; $error = true; } if (empty($last_name)) { $last_name_class = ' class="required missing" '; $error = true; } if (empty($user_login)) { $user_login_class = ' class="required missing" '; $error = true; } if (empty($email) || !is_email($email)) { $email_class = ' class="required missing" '; $error = true; } $error = apply_filters('affiliates_registration_error_validate', $error); if (!$error) { $userdata = array('first_name' => $first_name, 'last_name' => $last_name, 'user_login' => $user_login, 'email' => $email, 'user_url' => $url); // don't try to create a new user on multiple renderings global $affiliate_user_id, $new_affiliate_registered; if (!isset($affiliate_user_id)) { if (!$is_logged_in) { // allow plugins to be aware of new user account being created do_action('affiliates_before_register_affiliate', $userdata); // create the affiliate user account $affiliate_user_id = self::register_affiliate($userdata); $new_affiliate_registered = true; do_action('affiliates_after_register_affiliate', $userdata); } else { $affiliate_user_id = $user->ID; $new_affiliate_registered = true; } } // register as affiliate if (!is_wp_error($affiliate_user_id)) { // add affiliate entry $send = true; if ($new_affiliate_registered) { $affiliate_id = self::store_affiliate($affiliate_user_id, $userdata); do_action('affiliates_stored_affiliate', $affiliate_id, $affiliate_user_id); } $is_widget = isset($options['is_widget']) && ($options['is_widget'] === true || $options['is_widget'] == 'true'); $redirect = isset($options['redirect']) && ($options['redirect'] === true || $options['redirect'] == 'true'); $redirect_url = empty($_REQUEST['redirect_to']) ? get_home_url(get_current_blog_id(), 'wp-login.php?checkemail=confirm') : $_REQUEST['redirect_to']; if ($redirect && !$is_widget && !headers_sent()) { wp_safe_redirect($redirect_url); exit; } else { $output .= '<p>' . __('Thanks for signing up!', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; if (!$is_logged_in) { $output .= '<p>' . __('Please check your email for the confirmation link.', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; if ($redirect && !$is_widget) { $output .= '<script type="text/javascript">window.location="' . esc_url($redirect_url) . '";</script>'; } else { $output .= '<p>' . sprintf(__('Log in <a href="%s">here</a>.', AFFILIATES_PLUGIN_DOMAIN), get_home_url(get_current_blog_id(), 'wp-login.php?checkemail=confirm')) . '</p>'; } } else { if (isset($options['registered_profile_link_url'])) { $output .= '<p>'; $output .= '<a href="' . esc_url($options['registered_profile_link_url']) . '">'; if (isset($options['registered_profile_link_text'])) { $output .= wp_filter_kses($options['registered_profile_link_text']); } else { $output .= __('Access your profile', AFFILIATES_PLUGIN_DOMAIN); } $output .= '</a>'; $output .= '</p>'; } } } } else { $error = true; $wp_error = $affiliate_user_id; if ($wp_error->get_error_code()) { $errors = ''; $messages = ''; foreach ($wp_error->get_error_codes() as $code) { switch ($code) { case 'empty_username': case 'invalid_username': case 'username_exists': $user_login_class = ' class="required missing" '; break; case 'empty_email': case 'invalid_email': case 'email_exists': $email_class = ' class="required missing" '; break; } $severity = $wp_error->get_error_data($code); foreach ($wp_error->get_error_messages($code) as $error) { if ('message' == $severity) { $messages .= ' ' . $error . "<br />\n"; } else { $errors .= ' ' . $error . "<br />\n"; } } } if (!empty($errors)) { echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n"; } if (!empty($messages)) { echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n"; } } } } } else { if (!$is_logged_in) { $first_name = ''; $last_name = ''; $user_login = ''; $email = ''; $url = ''; } } if (!$send) { $output .= '<div class="affiliates-registration" id="affiliates-registration' . $ext . '">'; $output .= '<img id="affiliates-registration-throbber' . $ext . '" src="' . AFFILIATES_PLUGIN_URL . 'images/affiliates-throbber.gif" style="display:none" />'; $output .= '<form id="affiliates-registration-form' . $ext . '" action="' . $action . '" method="' . $method . '">'; $output .= '<div>'; $field_disabled = ""; if ($is_logged_in) { $field_disabled = ' disabled="disabled" '; if (empty($first_name) || empty($last_name)) { $output .= '<p>'; $output .= sprintf(__('<p>Please fill in the required information in your <a href="%s">profile</a> first.</p>'), esc_url(admin_url("profile.php"))); $output .= '</p>'; } } $output .= apply_filters('affiliates_registration_before_fields', ''); $output .= '<label ' . $first_name_class . ' id="affiliates-registration-form' . $ext . '-first-name-label" for="first_name">' . __('First Name', AFFILIATES_PLUGIN_DOMAIN) . '</label>'; $output .= '<input ' . $field_disabled . ' id="affiliates-registration-form' . $ext . '-first-name" name="first_name" type="text" value="' . esc_attr($first_name) . '"/>'; $output .= '<label ' . $last_name_class . ' id="affiliates-registration-form' . $ext . '-last-name-label" for="last_name">' . __('Last Name', AFFILIATES_PLUGIN_DOMAIN) . '</label>'; $output .= '<input ' . $field_disabled . ' id="affiliates-registration-form' . $ext . '-last-name" name="last_name" type="text" value="' . esc_attr($last_name) . '"/>'; $output .= '<label ' . $user_login_class . ' id="affiliates-registration-form' . $ext . '-user-login-label" for="user_login">' . __('Username', AFFILIATES_PLUGIN_DOMAIN) . '</label>'; $output .= '<input ' . $field_disabled . ' id="affiliates-registration-form' . $ext . '-user-login" name="user_login" type="text" value="' . esc_attr($user_login) . '"/>'; $output .= '<label ' . $email_class . ' id="affiliates-registration-form' . $ext . '-email-label" for="email">' . __('Email', AFFILIATES_PLUGIN_DOMAIN) . '</label>'; $output .= '<input ' . $field_disabled . ' id="affiliates-registration-form' . $ext . '-email" name="email" type="text" value="' . esc_attr($email) . '"/>'; $output .= '<label ' . $url_class . ' id="affiliates-registration-form' . $ext . '-url-label" for="url">' . __('Website', AFFILIATES_PLUGIN_DOMAIN) . '</label>'; $output .= '<input ' . $field_disabled . ' id="affiliates-registration-form' . $ext . '-url" name="url" type="text" value="' . esc_attr($url) . '"/>'; $output .= apply_filters('affiliates_registration_after_fields', ''); if (isset($terms)) { $output .= '<p class="terms">' . $terms . '</p>'; } $output .= Affiliates_Utility::captcha_get($captcha); $output .= wp_nonce_field($nonce_action, $nonce, true, false); if (isset($options['redirect_to'])) { $output .= '<input type="hidden" name="redirect_to" value="' . esc_url($options['redirect_to']) . '" />'; } $output .= '<input type="submit" name="' . $submit_name . '" value="' . self::$submit_button_label . '" />'; $output .= '</div>'; $output .= '</form>'; $output .= '</div>'; } return $output; }