/** * Registration Form Dialog * * Outputs the table-less form for new user * registration and existing user edits. * * @since 2.5.1 * * @uses apply_filters Calls 'wpmem_register_form_before' * @uses apply_filters Calls 'wpmem_register_form' * @uses apply_filters Calls 'wpmem_register_heading' * @uses apply_filters Calls 'wpmem_tos_link_txt' * * @param string $toggle * @param string $heading * @global string $wpmem_regchk * @global array $userdata * @return string $form */ function wpmem_inc_registration_NEW($toggle = 'new', $heading = '') { // fix the wptexturize remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'wpmem_texturize', 99); global $wpmem_regchk, $userdata; $heading = !$heading ? apply_filters('wpmem_register_heading', __('New Users Registration', 'wp-members')) : $heading; $form = apply_filters('wpmem_register_form_before', ''); $form .= '[wpmem_txt]<div id="wpmem_reg"> <a name="register"></a> <form name="form" method="post" action="' . get_permalink() . '" class="form">'; $form = WPMEM_USE_NONCE == 1 ? $form . wp_nonce_field('wpmem-validate-submit', 'wpmem-form-submit') : $form; $form .= ' <fieldset> <legend>' . $heading . '</legend>'; if ($toggle == 'edit') { $form = $form . '<label for="username" class="text">' . __('Username', 'wp-members') . '</label> <div class="div_text"><p class="noinput">' . $userdata->user_login . '</p></div>'; } else { $form = $form . '<label for="username" class="text">' . __('Choose a Username', 'wp-members') . '<font class="req">*</font></label> <div class="div_text"> <input name="log" type="text" value="' . stripslashes($_POST['log']) . '" class="username" id="username" /> </div>'; } $wpmem_fields = get_option('wpmembers_fields'); for ($row = 0; $row < count($wpmem_fields); $row++) { $do_row = $toggle == 'edit' && $wpmem_fields[$row][2] == 'password' ? false : true; if ($wpmem_fields[$row][2] == 'tos' && $toggle == 'edit' && get_user_meta($userdata->ID, 'tos', true)) { // makes tos field hidden on user edit page, unless they haven't got a value for tos $do_row = false; $form = $form . wpmem_create_formfield($wpmem_fields[$row][2], 'hidden', get_user_meta($userdata->ID, 'tos', true)); } if ($wpmem_fields[$row][4] == 'y' && $do_row == true) { if ($wpmem_fields[$row][2] != 'tos') { $class = $wpmem_fields[$row][3] == 'password' ? 'text' : $wpmem_fields[$row][3]; $form = $form . '<label for="' . $wpmem_fields[$row][2] . '" class="' . $class . '">' . $wpmem_fields[$row][1]; $form = $wpmem_fields[$row][5] == 'y' ? $form . '<font class="req">*</font>' : $form; $form = $form . '</label>'; } $form = $form . '<div class="div_' . $class . '">'; if ($toggle == 'edit' && $wpmem_regchk != 'updaterr') { $form = WPMEM_DEBUG == true ? $form . $wpmem_fields[$row][2] . " " : $form; switch ($wpmem_fields[$row][2]) { case 'description': $val = htmlspecialchars(get_user_meta($userdata->ID, 'description', 'true')); break; case 'user_email': $val = $userdata->user_email; break; case 'user_url': $val = esc_url($userdata->user_url); break; default: $val = htmlspecialchars(get_user_meta($userdata->ID, $wpmem_fields[$row][2], 'true')); break; } } else { $val = $_POST[$wpmem_fields[$row][2]]; } if ($wpmem_fields[$row][2] == 'tos') { if ($toggle == 'edit' && $wpmem_regchk != 'updaterr') { $chk_tos; // HUH? } else { $val = $_POST[$wpmem_fields[$row][2]]; } // should be checked by default? and only if form hasn't been submitted $val = !$_POST && $wpmem_fields[$row][8] == 'y' ? $wpmem_fields[$row][7] : $val; $form = $form . wpmem_create_formfield($wpmem_fields[$row][2], $wpmem_fields[$row][3], $wpmem_fields[$row][7], $val); $form = $wpmem_fields[$row][5] == 'y' ? $form . '<font class="req">*</font>' : $form; // determine if TOS is a WP page or not... $tos_content = stripslashes(get_option('wpmembers_tos')); if (stristr($tos_content, '[wp-members page="tos"')) { $tos_content = " " . $tos_content; $ini = strpos($tos_content, 'url="'); $ini += strlen('url="'); $len = strpos($tos_content, '"]', $ini) - $ini; $link = substr($tos_content, $ini, $len); $tos_pop = '<a href="' . $link . '" target="_blank">'; } else { $tos_pop = "<a href=\"#\" onClick=\"window.open('" . WP_PLUGIN_URL . "/wp-members/wp-members-tos.php','mywindow');\">"; } $form .= apply_filters('wpmem_tos_link_txt', sprintf(__('Please indicate that you agree to the %s TOS %s', 'wp-members'), $tos_pop, '</a>')); } else { // for checkboxes if ($wpmem_fields[$row][3] == 'checkbox') { $valtochk = $val; $val = $wpmem_fields[$row][7]; // if it should it be checked by default (& only if form not submitted), then override above... if ($wpmem_fields[$row][8] == 'y' && (!$_POST && $toggle != 'edit')) { $val = $valtochk = $wpmem_fields[$row][7]; } } // for dropdown select if ($wpmem_fields[$row][3] == 'select') { $valtochk = $val; $val = $wpmem_fields[$row][7]; } if (!isset($valtochk)) { $valtochk = ''; } $form = $form . wpmem_create_formfield($wpmem_fields[$row][2], $wpmem_fields[$row][3], $val, $valtochk); } $form = $form . '</div>'; } } if (WPMEM_CAPTCHA == 1 && $toggle != 'edit') { // don't show on edit page! $wpmem_captcha = get_option('wpmembers_captcha'); if ($wpmem_captcha[0] && $wpmem_captcha[1]) { $form = $form . '<div class="clear"></div> <div align="right" class="captcha">'; $form = $form . wpmem_inc_recaptcha($wpmem_captcha[0], $wpmem_captcha[2]); $form = $form . '</div>'; } } $var = $toggle == 'edit' ? 'update' : 'register'; $form .= '<input name="a" type="hidden" value="' . $var . '" />'; $form = $form . '<input name="redirect_to" type="hidden" value="' . get_permalink() . '" /> <div class="button_div"> <input name="reset" type="reset" value="' . __('Clear Form', 'wp-members') . '" class="buttons" /> <input name="submit" type="submit" value="' . __('Submit', 'wp-members') . '" class="buttons" /> </div>'; // @todo find a better place to put this /* $form = $form . '<font class="req">*</font>' . __( 'Required field', 'wp-members' ) . ' </fieldset></form>';*/ $form = $form . wpmem_inc_attribution(); $form = $form . '</div>[/wpmem_txt]'; $form = apply_filters('wpmem_register_form', $form); return $form; }
/** * Registration Form Dialog. * * Outputs the form for new user registration and existing user edits. * * @since 2.5.1 * * @param string $toggle (optional) Toggles between new registration ('new') and user profile edit ('edit'). * @param string $heading (optional) The heading text for the form, null (default) for new registration. * @global string $wpmem_regchk Used to determine if the form is in an error state. * @global array $userdata Used to get the user's registration data if they are logged in (user profile edit). * @return string $form The HTML for the entire form as a string. */ function wpmem_inc_registration($toggle = 'new', $heading = '', $redirect_to = null) { global $wpmem, $wpmem_regchk, $userdata; // Set up default wrappers. $defaults = array('heading_before' => '<legend>', 'heading_after' => '</legend>', 'fieldset_before' => '<fieldset>', 'fieldset_after' => '</fieldset>', 'main_div_before' => '<div id="wpmem_reg">', 'main_div_after' => '</div>', 'txt_before' => '[wpmem_txt]', 'txt_after' => '[/wpmem_txt]', 'row_before' => '', 'row_after' => '', 'buttons_before' => '<div class="button_div">', 'buttons_after' => '</div>', 'form_id' => '', 'form_class' => 'form', 'button_id' => '', 'button_class' => 'buttons', 'req_mark' => '<span class="req">*</span>', 'req_label' => '<span class="req">*</span>' . __('Required field', 'wp-members'), 'req_label_before' => '<div class="req-text">', 'req_label_after' => '</div>', 'show_clear_form' => false, 'clear_form' => __('Reset Form', 'wp-members'), 'submit_register' => __('Register'), 'submit_update' => __('Update Profile', 'wp-members'), 'strip_breaks' => true, 'use_nonce' => false, 'wrap_inputs' => true, 'n' => "\n", 't' => "\t"); /** * Filter the default form arguments. * * This filter accepts an array of various elements to replace the form defaults. This * includes default tags, labels, text, and small items including various booleans. * * @since 2.9.0 * * @param array An array of arguments to merge with defaults. Default null. * @param string $toggle Toggle new registration or profile update. new|edit. */ $args = apply_filters('wpmem_register_form_args', '', $toggle); // Merge $args with defaults. $args = wp_parse_args($args, $defaults); // Username is editable if new reg, otherwise user profile is not. if ($toggle == 'edit') { // This is the User Profile edit - username is not editable. $val = $userdata->user_login; $label = '<label for="username" class="text">' . __('Username') . '</label>'; $input = '<p class="noinput">' . $val . '</p>'; $field_before = $args['wrap_inputs'] ? '<div class="div_text">' : ''; $field_after = $args['wrap_inputs'] ? '</div>' : ''; } else { // This is a new registration. $val = isset($_POST['log']) ? stripslashes($_POST['log']) : ''; $label = '<label for="username" class="text">' . __('Choose a Username', 'wp-members') . $args['req_mark'] . '</label>'; $input = wpmem_create_formfield('log', 'text', $val, '', 'username'); } $field_before = $args['wrap_inputs'] ? '<div class="div_text">' : ''; $field_after = $args['wrap_inputs'] ? '</div>' : ''; // Add the username row to the array. $rows['username'] = array('order' => 0, 'meta' => 'username', 'type' => 'text', 'value' => $val, 'row_before' => $args['row_before'], 'label' => $label, 'field_before' => $field_before, 'field' => $input, 'field_after' => $field_after, 'row_after' => $args['row_after']); /** * Filter the array of form fields. * * The form fields are stored in the WP options table as wpmembers_fields. This * filter can filter that array after the option is retreived before the fields * are parsed. This allows you to change the fields that may be used in the form * on the fly. * * @since 2.9.0 * * @param array The array of form fields. * @param string $toggle Toggle new registration or profile update. new|edit. */ $wpmem_fields = apply_filters('wpmem_register_fields_arr', $wpmem->fields, $toggle); // Loop through the remaining fields. foreach ($wpmem_fields as $field) { // Start with a clean row. $val = ''; $label = ''; $input = ''; $field_before = ''; $field_after = ''; // Skips user selected passwords for profile update. $pass_arr = array('password', 'confirm_password', 'password_confirm'); $do_row = $toggle == 'edit' && in_array($field[2], $pass_arr) ? false : true; // Skips tos, makes tos field hidden on user edit page, unless they haven't got a value for tos. if ($field[2] == 'tos' && $toggle == 'edit' && get_user_meta($userdata->ID, 'tos', true)) { $do_row = false; $hidden_tos = wpmem_create_formfield($field[2], 'hidden', get_user_meta($userdata->ID, 'tos', true)); } // If the field is set to display and we aren't skipping, construct the row. if ($field[4] == 'y' && $do_row == true) { // Label for all but TOS. if ($field[2] != 'tos') { $class = $field[3] == 'password' ? 'text' : $field[3]; $label = '<label for="' . $field[2] . '" class="' . $class . '">' . __($field[1], 'wp-members'); $label = $field[5] == 'y' ? $label . $args['req_mark'] : $label; $label = $label . '</label>'; } // Gets the field value for both edit profile and submitted reg w/ error. if ($toggle == 'edit' && $wpmem_regchk != 'updaterr') { switch ($field[2]) { case 'description': $val = htmlspecialchars(get_user_meta($userdata->ID, 'description', 'true')); break; case 'user_email': case 'confirm_email': $val = sanitize_email($userdata->user_email); break; case 'user_url': $val = esc_url($userdata->user_url); break; case 'display_name': $val = sanitize_text_field($userdata->display_name); break; default: $val = sanitize_text_field(get_user_meta($userdata->ID, $field[2], 'true')); break; } } else { $val = isset($_POST[$field[2]]) ? $_POST[$field[2]] : ''; } // Does the tos field. if ($field[2] == 'tos') { $val = isset($_POST[$field[2]]) ? $_POST[$field[2]] : ''; // Should be checked by default? and only if form hasn't been submitted. $val = !$_POST && $field[8] == 'y' ? $field[7] : $val; $input = wpmem_create_formfield($field[2], $field[3], $field[7], $val); $input = $field[5] == 'y' ? $input . $args['req_mark'] : $input; // Determine if TOS is a WP page or not. $tos_content = stripslashes(get_option('wpmembers_tos')); if (wpmem_test_shortcode($tos_content, 'wp-members')) { $link = do_shortcode($tos_content); $tos_pop = '<a href="' . $link . '" target="_blank">'; } else { $tos_pop = "<a href=\"#\" onClick=\"window.open('" . WP_PLUGIN_URL . "/wp-members/wp-members-tos.php','mywindow');\">"; } /** * Filter the TOS link text. * * @since 2.7.5 * * @param string The link text. * @param string $toggle Toggle new registration or profile update. new|edit. */ $input .= apply_filters('wpmem_tos_link_txt', sprintf(__('Please indicate that you agree to the %s TOS %s', 'wp-members'), $tos_pop, '</a>'), $toggle); // In previous versions, the div class would end up being the same as the row before. $field_before = $args['wrap_inputs'] ? '<div class="div_text">' : ''; $field_after = $args['wrap_inputs'] ? '</div>' : ''; } else { // For checkboxes. if ($field[3] == 'checkbox') { $valtochk = $val; $val = $field[7]; // if it should it be checked by default (& only if form not submitted), then override above... if ($field[8] == 'y' && (!$_POST && $toggle != 'edit')) { $val = $valtochk = $field[7]; } } // For dropdown select. if ($field[3] == 'select') { $valtochk = $val; $val = $field[7]; } if (!isset($valtochk)) { $valtochk = ''; } // For all other input types. $input = wpmem_create_formfield($field[2], $field[3], $val, $valtochk); // Determine input wrappers. $field_before = $args['wrap_inputs'] ? '<div class="div_' . $class . '">' : ''; $field_after = $args['wrap_inputs'] ? '</div>' : ''; } } // If the row is set to display, add the row to the form array. if ($field[4] == 'y') { $rows[$field[2]] = array('order' => $field[0], 'meta' => $field[2], 'type' => $field[3], 'value' => $val, 'row_before' => $args['row_before'], 'label' => $label, 'field_before' => $field_before, 'field' => $input, 'field_after' => $field_after, 'row_after' => $args['row_after']); } } // If captcha is Really Simple CAPTCHA. if ($wpmem->captcha == 2 && $toggle != 'edit') { $row = wpmem_build_rs_captcha(); $rows['captcha'] = array('order' => '', 'meta' => '', 'type' => 'text', 'value' => '', 'row_before' => $args['row_before'], 'label' => $row['label'], 'field_before' => $args['wrap_inputs'] ? '<div class="div_text">' : '', 'field' => $row['field'], 'field_after' => $args['wrap_inputs'] ? '</div>' : '', 'row_after' => $args['row_after']); } /** * Filter the array of form rows. * * This filter receives an array of the main rows in the form, each array element being * an array of that particular row's pieces. This allows making changes to individual * parts of a row without needing to parse through a string of HTML. * * @since 2.9.0 * * @param array $rows An array containing the form rows. * @param string $toggle Toggle new registration or profile update. new|edit. */ $rows = apply_filters('wpmem_register_form_rows', $rows, $toggle); // Put the rows from the array into $form. $form = ''; $enctype = ''; foreach ($rows as $row_item) { $enctype = $row_item['type'] == 'file' ? "multipart/form-data" : $enctype; $row = $row_item['row_before'] != '' ? $row_item['row_before'] . $args['n'] . $row_item['label'] . $args['n'] : $row_item['label'] . $args['n']; $row .= $row_item['field_before'] != '' ? $row_item['field_before'] . $args['n'] . $args['t'] . $row_item['field'] . $args['n'] . $row_item['field_after'] . $args['n'] : $row_item['field'] . $args['n']; $row .= $row_item['row_after'] != '' ? $row_item['row_after'] . $args['n'] : ''; $form .= $row; } // Do recaptcha if enabled. if (($wpmem->captcha == 1 || $wpmem->captcha == 3) && $toggle != 'edit') { // don't show on edit page! // Get the captcha options. $wpmem_captcha = get_option('wpmembers_captcha'); // Start with a clean row. $row = ''; $row = '<div class="clear"></div>'; $row .= '<div align="right" class="captcha">' . wpmem_inc_recaptcha($wpmem_captcha['recaptcha']) . '</div>'; // Add the captcha row to the form. /** * Filter the HTML for the CAPTCHA row. * * @since 2.9.0 * * @param string The HTML for the entire row (includes HTML tags plus reCAPTCHA). * @param string $toggle Toggle new registration or profile update. new|edit. */ $form .= apply_filters('wpmem_register_captcha_row', $args['row_before'] . $row . $args['row_after'], $toggle); } // Create hidden fields. $var = $toggle == 'edit' ? 'update' : 'register'; $redirect_to = isset($_REQUEST['redirect_to']) ? esc_url($_REQUEST['redirect_to']) : ($redirect_to ? $redirect_to : get_permalink()); $hidden = '<input name="a" type="hidden" value="' . $var . '" />' . $args['n']; $hidden .= '<input name="redirect_to" type="hidden" value="' . $redirect_to . '" />' . $args['n']; if ($redirect_to != get_permalink()) { $hidden .= '<input name="wpmem_reg_page" type="hidden" value="' . get_permalink() . '" />' . $args['n']; } $hidden = isset($hidden_tos) ? $hidden . $hidden_tos . $args['n'] : $hidden; /** * Filter the hidden field HTML. * * @since 2.9.0 * * @param string $hidden The generated HTML of hidden fields. * @param string $toggle Toggle new registration or profile update. new|edit. */ $hidden = apply_filters('wpmem_register_hidden_fields', $hidden, $toggle); // Add the hidden fields to the form. $form .= $hidden; // Create buttons and wrapper. $button_text = $toggle == 'edit' ? $args['submit_update'] : $args['submit_register']; $buttons = $args['show_clear_form'] ? '<input name="reset" type="reset" value="' . $args['clear_form'] . '" class="' . $args['button_class'] . '" /> ' . $args['n'] : ''; $buttons .= '<input name="submit" type="submit" value="' . $button_text . '" class="' . $args['button_class'] . '" />' . $args['n']; /** * Filter the HTML for form buttons. * * The string passed through the filter includes the buttons, as well as the HTML wrapper elements. * * @since 2.9.0 * * @param string $buttons The generated HTML of the form buttons. * @param string $toggle Toggle new registration or profile update. new|edit. */ $buttons = apply_filters('wpmem_register_form_buttons', $buttons, $toggle); // Add the buttons to the form. $form .= $args['buttons_before'] . $args['n'] . $buttons . $args['buttons_after'] . $args['n']; // Add the required field notation to the bottom of the form. $form .= $args['req_label_before'] . $args['req_label'] . $args['req_label_after']; // Apply the heading. /** * Filter the registration form heading. * * @since 2.8.2 * * @param string $str * @param string $toggle Toggle new registration or profile update. new|edit. */ $heading = !$heading ? apply_filters('wpmem_register_heading', __('New User Registration', 'wp-members'), $toggle) : $heading; $form = $args['heading_before'] . $heading . $args['heading_after'] . $args['n'] . $form; // Apply fieldset wrapper. $form = $args['fieldset_before'] . $args['n'] . $form . $args['n'] . $args['fieldset_after']; // Apply attribution if enabled. $form = $form . wpmem_inc_attribution(); // Apply nonce. $form = defined('WPMEM_USE_NONCE') || $args['use_nonce'] ? wp_nonce_field('wpmem-validate-submit', 'wpmem-form-submit') . $args['n'] . $form : $form; // Apply form wrapper. $enctype = $enctype == 'multipart/form-data' ? ' enctype="multipart/form-data"' : ''; $post_to = $redirect_to ? $redirect_to : get_permalink(); $form = '<form name="form" method="post"' . $enctype . ' action="' . $post_to . '" id="' . $args['form_id'] . '" class="' . $args['form_class'] . '">' . $args['n'] . $form . $args['n'] . '</form>'; // Apply anchor. $form = '<a name="register"></a>' . $args['n'] . $form; // Apply main div wrapper. $form = $args['main_div_before'] . $args['n'] . $form . $args['n'] . $args['main_div_after'] . $args['n']; // Apply wpmem_txt wrapper. $form = $args['txt_before'] . $form . $args['txt_after']; // Remove line breaks if enabled for easier filtering later. $form = $args['strip_breaks'] ? str_replace(array("\n", "\r", "\t"), array('', '', ''), $form) : $form; /** * Filter the generated HTML of the entire form. * * @since 2.7.4 * * @param string $form The HTML of the final generated form. * @param string $toggle Toggle new registration or profile update. new|edit. * @param array $rows The rows array * @param string $hidden The HTML string of hidden fields */ $form = apply_filters('wpmem_register_form', $form, $toggle, $rows, $hidden); /** * Filter before the form. * * This rarely used filter allows you to stick any string onto the front of * the generated form. * * @since 2.7.4 * * @param string $str The HTML to add before the form. Default null. * @param string $toggle Toggle new registration or profile update. new|edit. */ $form = apply_filters('wpmem_register_form_before', '', $toggle) . $form; // Return the generated form. return $form; }
/** * Registration Form Dialog (Legacy) * * Outputs the table-based form for new user * registration and existing user edits. Broken out * as a separate function in 2.5.1 * * @since 2.5.1 * * @param string $toggle * @param string $heading * @return string $form */ function wpmem_inc_registration_OLD($toggle = 'new', $heading = '') { global $userdata, $wpmem_regchk; if (!$heading) { $heading = "<h2>" . __('New Users Registration', 'wp-members') . "</h2>"; } $form = '<div class="wpmem_reg"> <a name="register"></a> <form name="form2" method="post" action="' . get_permalink() . '">'; $form .= WPMEM_USE_NONCE == 1 ? wp_nonce_field('wpmem-validate-submit', 'wpmem-form-submit') : ''; $form .= ' <table width="400" border="0" cellspacing="0" cellpadding="4"> <tr align="left"> <td colspan="2">' . $heading . '</td> </tr>'; if ($toggle == 'edit') { $form = $form . '<tr> <td width="49%" align="right">' . __('Username', 'wp-members') . ':</td> <td width="51%" align="left">' . $userdata->user_login . '</td> </tr>'; } else { $form = $form . '<tr> <td width="49%" align="right">' . __('Choose a Username', 'wp-members') . '<font color="red">*</font></td> <td width="51%"><input name="log" type="text" value="' . stripslashes($_POST['log']) . '" /></td> </tr>'; } $form = $form . '<tr> <td colspan="2"> </td> </tr>'; $wpmem_fields = get_option('wpmembers_fields'); for ($row = 0; $row < count($wpmem_fields); $row++) { $do_row = true; if ($toggle == 'edit' && $wpmem_fields[$row][2] == 'password') { $do_row = false; } if ($wpmem_fields[$row][2] == 'tos' && $toggle == 'edit' && get_user_meta($userdata->ID, 'tos', true)) { // makes tos field hidden on user edit page, unless they haven't got a value for tos $do_row = false; $form = $form . wpmem_create_formfield($wpmem_fields[$row][2], 'hidden', get_user_meta($userdata->ID, 'tos', true)); } if ($wpmem_fields[$row][4] == 'y' && $do_row == true) { $form = $form . '<tr'; if ($wpmem_fields[$row][3] == 'textarea' || $wpmem_fields[$row][2] == 'tos') { $form = $form . ' valign="top"'; } $form = $form . '>'; $form = $form . '<td align="right">'; if ($wpmem_fields[$row][2] == 'tos') { if ($toggle == 'edit' && $wpmem_regchk != 'updaterr') { $chk_tos; // HUH? } else { $val = $wpmem_fieldval_arr[$row]; } // should be checked by default? and only if form hasn't been submitted if (!$_POST && $wpmem_fields[$row][8] == 'y') { $val = $wpmem_fields[$row][7]; } $form = $form . wpmem_create_formfield($wpmem_fields[$row][2], $wpmem_fields[$row][3], $wpmem_fields[$row][7], $val); } else { $form = $form . $wpmem_fields[$row][1] . ":"; if ($wpmem_fields[$row][5] == 'y') { $form = $form . '<font color="red">*</font>'; } } $form = $form . '</td> <td'; if ($wpmem_fields[$row][2] == 'tos' || $wpmem_fields[$row][3] == 'checkbox') { $form = $form . ' align="left"'; } $form = $form . '>'; if ($toggle == 'edit' && $wpmem_regchk != 'updaterr') { //if (WPMEM_DEBUG == true) { $form = $form . $wpmem_fields[$row][2]." "; } switch ($wpmem_fields[$row][2]) { case 'description': $val = htmlspecialchars(get_user_meta($userdata->ID, 'description', 'true')); break; case 'user_email': $val = $userdata->user_email; break; case 'user_url': $val = esc_url($userdata->user_url); break; default: $val = htmlspecialchars(get_user_meta($userdata->ID, $wpmem_fields[$row][2], 'true')); break; } } else { $val = $_POST[$wpmem_fields[$row][2]]; } if ($wpmem_fields[$row][2] == 'tos') { if ($wpmem_fields[$row][5] == 'y') { $form = $form . '<font color="red">*</font>'; } // determine if TOS is a WP page or not... $tos_content = stripslashes(get_option('wpmembers_tos')); if (strstr($tos_content, '[wp-members page="tos"')) { $tos_content = " " . $tos_content; $ini = strpos($tos_content, 'url="'); $ini += strlen('url="'); $len = strpos($tos_content, '"]', $ini) - $ini; $link = substr($tos_content, $ini, $len); $tos_pop = '<a href="' . $link . '" target="_blank">'; } else { $tos_pop = "<a href=\"#\" onClick=\"window.open('" . WP_PLUGIN_URL . "/wp-members/wp-members-tos.php','mywindow');\">"; } $form = $form . sprintf(__('Please indicate that you agree to the %s TOS %s', 'wp-members'), $tos_pop, '</a>'); } else { // for checkboxes if ($wpmem_fields[$row][3] == 'checkbox') { $valtochk = $val; $val = $wpmem_fields[$row][7]; // if it should it be checked by default (& only if form not submitted), then override above... if ($wpmem_fields[$row][8] == 'y' && (!$_POST && $toggle != 'edit')) { $val = $valtochk = $wpmem_fields[$row][7]; } } // for dropdown select if ($wpmem_fields[$row][3] == 'select') { $valtochk = $val; $val = $wpmem_fields[$row][7]; } $form = $form . wpmem_create_formfield($wpmem_fields[$row][2], $wpmem_fields[$row][3], $val, $valtochk); } $form = $form . '</td> </tr>'; } } if (WPMEM_CAPTCHA == 1 && $toggle != 'edit') { $wpmem_captcha = get_option('wpmembers_captcha'); if ($wpmem_captcha[0] && $wpmem_captcha[1]) { $form = $form . '<tr> <td colspan="2" align="right">'; $form = $form . wpmem_inc_recaptcha($wpmem_captcha[0], $wpmem_captcha[2]); $form = $form . '</td> </tr>'; } } $form = $form . '<tr><td colspan="2"> </td></tr> <tr> <td align="right"> </td> <td>'; if ($toggle == 'edit') { $form = $form . '<input name="a" type="hidden" value="update" />'; } else { $form = $form . '<input name="a" type="hidden" value="register" />'; } $form = $form . ' <input name="redirect_to" type="hidden" value="' . get_permalink() . '" /> <input name="Submit" type="submit" value="' . __('Submit', 'wp-members') . '" /> <input name="Reset" type="reset" value="' . __('Clear Form', 'wp-members') . '" /> </td> </tr> <tr> <td> </td> <td><font color="red">*</font> ' . __('Required field', 'wp-members') . '</td> </tr>'; $form = $form . wpmem_inc_attribution(); $form = $form . ' </table> </form> </div>'; return $form; }