/** * add WP-Members fields to the WP user profile screen. * * @since 2.6.5 * * @global int $user_id */ function wpmem_user_profile() { global $wpmem, $user_id; /** * Filter the heading for the user profile additional fields. * * @since 2.9.1 * * @param string The default heading. */ ?> <h3><?php echo apply_filters('wpmem_user_profile_heading', __('Additional Information', 'wp-members')); ?> </h3> <table class="form-table"> <?php // Get fields. $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' ); // Get excluded meta. $exclude = wpmem_get_excluded_meta('user-profile'); foreach ($wpmem_fields as $meta) { $val = get_user_meta($user_id, $meta[2], true); $valtochk = ''; $chk_tos = true; if ($meta[2] == 'tos' && $val == 'agree') { $chk_tos = false; echo wpmem_create_formfield($meta[2], 'hidden', $val); } // Do we exclude the row? $chk_pass = in_array($meta[2], $exclude) ? false : true; if ($meta[4] == "y" && $meta[6] == "n" && $chk_tos && $chk_pass) { // If there are any required fields. $req = $meta[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : ''; $show_field = ' <tr> <th><label>' . __($meta[1], 'wp-members') . $req . '</label></th> <td>'; $val = get_user_meta($user_id, $meta[2], true); if ($meta[3] == 'checkbox' || $meta[3] == 'select') { $valtochk = $val; $val = $meta[7]; } $show_field .= wpmem_create_formfield($meta[2], $meta[3], $val, $valtochk) . ' </td> </tr>'; /** * Filter the field for user profile additional fields. * * @since 2.9.1 * * @parma string $show_field The HTML string of the additional field. */ echo apply_filters('wpmem_user_profile_field', $show_field); } } ?> </table><?php }
/** * 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; }
/** * Appends WP-Members registration fields to Users > Add New User screen. * * @since 2.9.0 */ function wpmem_do_wp_newuser_form() { global $wpmem; echo '<table class="form-table"><tbody>'; $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' ); $exclude = wpmem_get_excluded_meta('register'); foreach ($wpmem_fields as $field) { if ($field[6] == 'n' && !in_array($field[2], $exclude)) { $req = $field[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : ''; echo '<tr> <th scope="row"> <label for="' . $field[2] . '">' . __($field[1], 'wp-members') . $req . '</label> </th> <td>'; // determine the field type and generate accordingly. switch ($field[3]) { case 'select': $val = isset($_POST[$field[2]]) ? $_POST[$field[2]] : ''; echo wpmem_create_formfield($field[2], $field[3], $field[7], $val); break; case 'textarea': echo '<textarea name="' . $field[2] . '" id="' . $field[2] . '" class="textarea">'; echo isset($_POST[$field[2]]) ? esc_textarea($_POST[$field[2]]) : ''; echo '</textarea>'; break; case 'checkbox': $val = isset($_POST[$field[2]]) ? $_POST[$field[2]] : ''; $val = !$_POST && $field[8] == 'y' ? $field[7] : $val; echo wpmem_create_formfield($field[2], $field[3], $field[7], $val); break; default: echo '<input type="' . $field[3] . '" name="' . $field[2] . '" id="' . $field[2] . '" class="input" value="'; echo isset($_POST[$field[2]]) ? esc_attr($_POST[$field[2]]) : ''; echo '" size="25" />'; break; } echo '</td> </tr>'; } } echo '</tbody></table>'; }
/** * Add WP-Members fields to the WP user profile screen. * * @since 2.1 * * @global array $current_screen The WordPress screen object * @global int $user_ID The user ID */ function wpmem_admin_fields() { global $current_screen, $user_ID, $wpmem; $user_id = $current_screen->id == 'profile' ? $user_ID : $_REQUEST['user_id']; ?> <h3><?php /** * Filter the heading for additional profile fields. * * @since 2.8.2 * * @param string The default additional fields heading. */ echo apply_filters('wpmem_admin_profile_heading', __('WP-Members Additional Fields', 'wp-members')); ?> </h3> <table class="form-table"> <?php // Get fields. $wpmem_fields = $wpmem->fields; // get_option( 'wpmembers_fields' ); // Get excluded meta. $exclude = wpmem_get_excluded_meta('admin-profile'); /** * Fires at the beginning of generating the WP-Members fields in the user profile. * * @since 2.9.3 * * @param int $user_id The user's ID. * @param array $wpmem_fields The WP-Members fields. */ do_action('wpmem_admin_before_profile', $user_id, $wpmem_fields); foreach ($wpmem_fields as $meta) { $valtochk = ''; // Determine which fields to show in the additional fields area. $show = $meta[6] == 'n' && !in_array($meta[2], $exclude) ? true : false; $show = $meta[1] == 'TOS' && $meta[4] != 'y' ? null : $show; if ($show) { // Is the field required? $req = $meta[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : ''; $show_field = ' <tr> <th><label>' . __($meta[1], 'wp-members') . $req . '</label></th> <td>'; $val = htmlspecialchars(get_user_meta($user_id, $meta[2], true)); if ($meta[3] == 'checkbox' || $meta[3] == 'select') { $valtochk = $val; $val = $meta[7]; } $show_field .= wpmem_create_formfield($meta[2], $meta[3], $val, $valtochk) . ' </td> </tr>'; /** * Filter the profile field. * * @since 2.8.2 * * @param string $show_field The HTML string for the additional profile field. */ echo apply_filters('wpmem_admin_profile_field', $show_field); } } // See if reg is moderated, and if the user has been activated. if ($wpmem->mod_reg == 1) { $user_active_flag = get_user_meta($user_id, 'active', true); switch ($user_active_flag) { case '': $label = __('Activate this user?', 'wp-members'); $action = 1; break; case 0: $label = __('Reactivate this user?', 'wp-members'); $action = 1; break; case 1: $label = __('Deactivate this user?', 'wp-members'); $action = 0; break; } ?> <tr> <th><label><?php echo $label; ?> </label></th> <td><input id="activate_user" type="checkbox" class="input" name="activate_user" value="<?php echo $action; ?> " /></td> </tr> <?php } /* * If using subscription model, show expiration. * If registration is moderated, this doesn't show * if user is not active yet. */ if (defined('WPMEM_EXP_MODULE') && $wpmem->use_exp == 1) { if ($wpmem->mod_reg == 1 && get_user_meta($user_id, 'active', true) == 1 || $wpmem->mod_reg != 1) { wpmem_a_extenduser($user_id); } } ?> <tr> <th><label><?php _e('IP @ registration', 'wp-members'); ?> </label></th> <td><?php echo get_user_meta($user_id, 'wpmem_reg_ip', true); ?> </td> </tr> <?php /** * Fires after generating the WP-Members fields in the user profile. * * @since 2.9.3 * * @param int $user_id The user's ID. * @param array $wpmem_fields The WP-Members fields. */ do_action('wpmem_admin_after_profile', $user_id, $wpmem_fields); ?> </table><?php }
/** * Builds the captcha options. * * @since 2.4.0 */ function wpmem_a_build_captcha_options() { // Global settings. global $wpmem; $wpmem_captcha = get_option('wpmembers_captcha'); $url = home_url(); $help_link = __(sprintf('See the %sUsers Guide on CAPTCHA%s.', '<a href="http://rocketgeek.com/plugins/wp-members/users-guide/registration/using-captcha/" target="_blank">', '</a>'), 'wp-members'); ?> <div class="metabox-holder has-right-sidebar"> <div class="inner-sidebar"> <?php wpmem_a_meta_box(); ?> <div class="postbox"> <h3><span><?php _e('Need help?', 'wp-members'); ?> </span></h3> <div class="inside"> <strong><i><?php echo $help_link; ?> </i></strong> </div> </div> </div> <!-- .inner-sidebar --> <div id="post-body"> <div id="post-body-content"> <div class="postbox"> <h3><?php _e('Manage reCAPTCHA Options', 'wp-members'); ?> </h3> <div class="inside"> <form name="updatecaptchaform" id="updatecaptchaform" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <?php wp_nonce_field('wpmem-update-captcha'); ?> <table class="form-table"> <?php // if reCAPTCHA is enabled... if ($wpmem->captcha == 1) { $show_update_button = true; $private_key = isset($wpmem_captcha['recaptcha']) ? $wpmem_captcha['recaptcha']['private'] : ''; $public_key = isset($wpmem_captcha['recaptcha']) ? $wpmem_captcha['recaptcha']['public'] : ''; $captcha_theme = isset($wpmem_captcha['recaptcha']) ? $wpmem_captcha['recaptcha']['theme'] : ''; ?> <tr> <td colspan="2"> <p><?php _e('reCAPTCHA is a free, accessible CAPTCHA service that helps to digitize books while blocking spam on your blog.', 'wp-members'); ?> </p> <p><?php printf(__('reCAPTCHA asks commenters to retype two words scanned from a book to prove that they are a human. This verifies that they are not a spambot while also correcting the automatic scans of old books. So you get less spam, and the world gets accurately digitized books. Everybody wins! For details, visit the %s reCAPTCHA website%s', 'wp-members'), '<a href="http://www.google.com/recaptcha/intro/index.html" target="_blank">', '</a>'); ?> .</p> <p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('reCAPTCHA Keys', 'wp-members'); ?> </th> <td> <?php printf(__('reCAPTCHA requires an API key, consisting of a "public" and a "private" key. You can sign up for a %s free reCAPTCHA key%s', 'wp-members'), "<a href=\"https://www.google.com/recaptcha/admin#whyrecaptcha\" target=\"_blank\">", '</a>'); ?> .<br /> <?php _e('Public Key', 'wp-members'); ?> : <input type="text" name="wpmem_captcha_publickey" size="50" value="<?php echo $public_key; ?> " /><br /> <?php _e('Private Key', 'wp-members'); ?> : <input type="text" name="wpmem_captcha_privatekey" size="50" value="<?php echo $private_key; ?> " /> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Choose Theme', 'wp-members'); ?> </th> <td> <select name="wpmem_captcha_theme"><?php echo wpmem_create_formfield(__('Red', 'wp-members'), 'option', 'red', $captcha_theme); echo wpmem_create_formfield(__('White', 'wp-members'), 'option', 'white', $captcha_theme); echo wpmem_create_formfield(__('Black Glass', 'wp-members'), 'option', 'blackglass', $captcha_theme); echo wpmem_create_formfield(__('Clean', 'wp-members'), 'option', 'clean', $captcha_theme); ?> </select> </td> </tr> <?php // if reCAPTCHA v2 is enabled... } elseif ($wpmem->captcha == 3) { $show_update_button = true; $private_key = isset($wpmem_captcha['recaptcha']) ? $wpmem_captcha['recaptcha']['private'] : ''; $public_key = isset($wpmem_captcha['recaptcha']) ? $wpmem_captcha['recaptcha']['public'] : ''; ?> <tr valign="top"> <th scope="row"><?php _e('reCAPTCHA Keys', 'wp-members'); ?> </th> <td> <?php printf(__('reCAPTCHA requires an API key, consisting of a "site" and a "secret" key. You can sign up for a %s free reCAPTCHA key%s', 'wp-members'), "<a href=\"https://www.google.com/recaptcha/admin#whyrecaptcha\" target=\"_blank\">", '</a>'); ?> .<br /> <?php _e('Site Key', 'wp-members'); ?> : <input type="text" name="wpmem_captcha_publickey" size="50" value="<?php echo $public_key; ?> " /><br /> <?php _e('Secret Key', 'wp-members'); ?> : <input type="text" name="wpmem_captcha_privatekey" size="50" value="<?php echo $private_key; ?> " /> </td> </tr> <?php // If Really Simple CAPTCHA is enabled. } elseif ($wpmem->captcha == 2) { // Setup defaults. $defaults = array('characters' => 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789', 'num_char' => '4', 'dim_w' => '72', 'dim_h' => '30', 'font_color' => '0,0,0', 'bg_color' => '255,255,255', 'font_size' => '12', 'kerning' => '14', 'img_type' => 'png'); $args = isset($wpmem_captcha['really_simple']) && is_array($wpmem_captcha['really_simple']) ? $wpmem_captcha['really_simple'] : array(); $args = wp_parse_args($args, $defaults); // Explode colors. $font_color = explode(',', $args['font_color']); $bg_color = explode(',', $args['bg_color']); $show_update_button = true; if (is_plugin_active('really-simple-captcha/really-simple-captcha.php')) { ?> <tr> <th scope="row"><?php _e('Characters for image', 'wp-members'); ?> </th> <td><input name="characters" type="text" size="34" value="<?php echo $args['characters']; ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Number of characters', 'wp-members'); ?> </th> <td><input name="num_char" type="text" size="2" value="<?php echo $args['num_char']; ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Image dimensions', 'wp-members'); ?> </th> <td><?php _e('Width'); ?> <input name="dim_w" type="text" size="2" value="<?php echo $args['dim_w']; ?> " /> <?php _e('Height'); ?> <input name="dim_h" type="text" size="2" value="<?php echo $args['dim_h']; ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Font color of characters', 'wp-members'); ?> </th> <td>R:<input name="font_color_r" type="text" size="2" value="<?php echo $font_color[0]; ?> " /> G:<input name="font_color_g" type="text" size="2" value="<?php echo $font_color[1]; ?> " /> B:<input name="font_color_b" type="text" size="2" value="<?php echo $font_color[2]; ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Background color of image', 'wp-members'); ?> </th> <td>R:<input name="bg_color_r" type="text" size="2" value="<?php echo $bg_color[0]; ?> " /> G:<input name="bg_color_g" type="text" size="2" value="<?php echo $bg_color[1]; ?> " /> B:<input name="bg_color_b" type="text" size="2" value="<?php echo $bg_color[2]; ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Font size', 'wp-members'); ?> </th> <td><input name="font_size" type="text" value="<?php echo $args['font_size']; ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Width between characters', 'wp-members'); ?> </th> <td><input name="kerning" type="text" value="<?php echo $args['kerning']; ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Image type', 'wp-members'); ?> </th> <td><select name="img_type"> <option<?php echo $args['img_type'] == 'png' ? ' selected' : ''; ?> >png</option> <option<?php echo $args['img_type'] == 'gif' ? ' selected' : ''; ?> >gif</option> <option<?php echo $args['img_type'] == 'jpg' ? ' selected' : ''; ?> >jpg</option> </select> </td> </tr><?php } else { $show_update_button = false; ?> <tr> <td colspan="2"> <p><?php _e('To use Really Simple CAPTCHA, you must have the Really Simple CAPTCHA plugin installed and activated.', 'wp-members'); ?> </p> <p><?php _e(sprintf('You can download Really Simple CAPTCHA from the %swordpress.org plugin repository%s.', '<a href="http://wordpress.org/plugins/really-simple-captcha/">', '</a>'), 'wp-members'); ?> </p> </td> </tr><?php } } // End if RSC is selected. if ($show_update_button) { switch ($wpmem->captcha) { case 1: $captcha_type = 'recaptcha'; break; case 2: $captcha_type = 'really_simple'; break; case 3: $captcha_type = 'recaptcha2'; break; } ?> <tr valign="top"> <th scope="row"> </th> <td> <input type="hidden" name="wpmem_recaptcha_type" value="<?php echo $captcha_type; ?> " /> <input type="hidden" name="wpmem_admin_a" value="update_captcha" /> <?php submit_button(__('Update CAPTCHA Settings', 'wp-members')); ?> </td> </tr> <?php } ?> </table> </form> </div><!-- .inside --> </div> </div><!-- #post-body-content --> </div><!-- #post-body --> </div><!-- .metabox-holder --> <?php }
/** * Add WP-Members fields to the WP user profile screen. * * @since 2.1 * * @global array $current_screen The WordPress screen object * @global int $user_ID The user ID */ function wpmem_admin_fields() { global $current_screen, $user_ID, $wpmem; $user_id = $current_screen->id == 'profile' ? $user_ID : $_REQUEST['user_id']; ?> <h3><?php /** * Filter the heading for additional profile fields. * * @since 2.8.2 * * @param string The default additional fields heading. */ echo apply_filters('wpmem_admin_profile_heading', __('WP-Members Additional Fields', 'wp-members')); ?> </h3> <table class="form-table"> <?php // Get fields. $wpmem_fields = $wpmem->fields; // get_option( 'wpmembers_fields' ); // Get excluded meta. $exclude = wpmem_get_excluded_meta('admin-profile'); /** * Fires at the beginning of generating the WP-Members fields in the user profile. * * @since 2.9.3 * * @param int $user_id The user's ID. * @param array $wpmem_fields The WP-Members fields. */ do_action('wpmem_admin_before_profile', $user_id, $wpmem_fields); // Assemble form rows array. $rows = array(); foreach ($wpmem_fields as $meta) { $valtochk = ''; $values = ''; // Determine which fields to show in the additional fields area. $show = $meta[6] == 'n' && !in_array($meta[2], $exclude) ? true : false; $show = $meta[1] == 'TOS' && $meta[4] != 'y' ? null : $show; if ($show) { $val = get_user_meta($user_id, $meta[2], true); $val = $meta[3] == 'multiselect' || $meta[3] == 'multicheckbox' ? $val : htmlspecialchars($val); if ($meta[3] == 'checkbox') { $valtochk = $val; $val = $meta[7]; } if ('multicheckbox' == $meta[3] || 'select' == $meta[3] || 'multiselect' == $meta[3] || 'radio' == $meta[3]) { $values = $meta[7]; $valtochk = $val; } // Is this an image or a file? if ('file' == $meta[3] || 'image' == $meta[3]) { $attachment_url = wp_get_attachment_url($val); $empty_file = '<span class="description">' . __('None') . '</span>'; if ('file' == $meta[3]) { $input = $attachment_url ? '<a href="' . $attachment_url . '">' . $attachment_url . '</a>' : $empty_file; } else { $input = $attachment_url ? '<img src="' . $attachment_url . '">' : $empty_file; } // @todo - come up with a way to handle file updates - user profile form does not support multitype //$show_field.= ' <span class="description">' . __( 'Update this file:' ) . '</span><br />'; //$show_field.= wpmem_create_formfield( $meta[2] . '_update_file', $meta[3], $val, $valtochk ); } else { if ('select' == $meta[3] || 'radio' == $meta[3]) { $input = wpmem_create_formfield($meta[2], $meta[3], $values, $valtochk); } elseif ('multicheckbox' == $meta[3] || 'multiselect' == $meta[3]) { $delimiter = isset($meta[8]) ? $meta[8] : '|'; $input = $wpmem->forms->create_form_field(array('name' => $meta[2], 'type' => $meta[3], 'value' => $values, 'compare' => $valtochk, 'delimiter' => $delimiter)); } else { $meta[3] = 'hidden' == $meta[3] ? 'text' : $meta[3]; $input = wpmem_create_formfield($meta[2], $meta[3], $val, $valtochk); } } // Is the field required? $req = $meta[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : ''; $label = '<label>' . __($meta[1], 'wp-members') . $req . '</label>'; // Build the form rows for filtering. $rows[$meta[2]] = array('order' => $meta[0], 'meta' => $meta[2], 'type' => $meta[3], 'value' => $val, 'values' => $values, 'label_text' => __($meta[1], 'wp-members'), 'row_before' => '', 'label' => $label, 'field_before' => '', 'field' => $input, 'field_after' => '', 'row_after' => ''); } } /** * Filter for rows * * @since 3.1.0 * * @param array $rows * @param string $toggle */ $rows = apply_filters('wpmem_register_form_rows_admin', $rows, 'adminprofile'); // Handle form rows display from array. foreach ($rows as $row) { $show_field = ' <tr> <th>' . $row['label'] . '</th> <td>' . $row['field'] . '</td> </tr>'; /** * Filter the profile field. * * @since 2.8.2 * @since 3.1.1 Added $user_id and $row * * @param string $show_field The HTML string for the additional profile field. * @param string $user_id * @param array $row */ echo apply_filters('wpmem_admin_profile_field', $show_field, $user_id, $row); } /** * Fires after generating the WP-Members fields in the user profile. * * @since 2.9.3 * * @param int $user_id The user's ID. * @param array $wpmem_fields The WP-Members fields. */ do_action('wpmem_admin_after_profile', $user_id, $wpmem_fields); ?> </table><?php }
/** * builds the captcha options * * @since 2.4.0 */ function wpmem_a_build_captcha_options() { $wpmem_captcha = get_option('wpmembers_captcha'); $url = home_url(); ?> <div class="metabox-holder has-right-sidebar"> <div class="inner-sidebar"> <?php wpmem_a_meta_box(); ?> <div class="postbox"> <h3><span><?php _e('Need help?', 'wp-members'); ?> </span></h3> <div class="inside"> <strong><i>See the <a href="http://rocketgeek.com/plugins/wp-members/users-guide/registration/using-captcha/" target="_blank">Users Guide on reCAPTCHA</a>.</i></strong> </div> </div> </div> <!-- .inner-sidebar --> <div id="post-body"> <div id="post-body-content"> <div class="postbox"> <h3><?php _e('Manage reCAPTCHA Options', 'wp-members'); ?> </h3> <div class="inside"> <form name="updatecaptchaform" id="updatecaptchaform" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <?php wp_nonce_field('wpmem-update-captcha'); ?> <table class="form-table"> <tr> <td colspan="2"> <p><?php _e('reCAPTCHA is a free, accessible CAPTCHA service that helps to digitize books while blocking spam on your blog.', 'wp-members'); ?> </p> <p><?php printf(__('reCAPTCHA asks commenters to retype two words scanned from a book to prove that they are a human. This verifies that they are not a spambot while also correcting the automatic scans of old books. So you get less spam, and the world gets accurately digitized books. Everybody wins! For details, visit the %s reCAPTCHA website%s', 'wp-members'), '<a href="http://recaptcha.net/" target="_blank">', '</a>'); ?> .</p> <p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('reCAPTCHA Keys', 'wp-members'); ?> </th> <td> <?php printf(__('reCAPTCHA requires an API key, consisting of a "public" and a "private" key. You can sign up for a %s free reCAPTCHA key%s', 'wp-members'), "<a href=\"http://recaptcha.net/api/getkey?domain={$url}&app=wordpress\" target=\"_blank\">", '</a>'); ?> .<br /> <?php _e('Public Key', 'wp-members'); ?> : <input type="text" name="wpmem_captcha_publickey" size="50" value="<?php echo $wpmem_captcha[0]; ?> " /><br /> <?php _e('Private Key', 'wp-members'); ?> : <input type="text" name="wpmem_captcha_privatekey" size="50" value="<?php echo $wpmem_captcha[1]; ?> " /> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Choose Theme', 'wp-members'); ?> </th> <td> <select name="wpmem_captcha_theme"> <!--<?php echo wpmem_create_formfield(__('WP-Members', 'wp-members'), 'option', 'custom', $wpmem_captcha[2]); ?> --><?php echo wpmem_create_formfield(__('Red', 'wp-members'), 'option', 'red', $wpmem_captcha[2]); echo wpmem_create_formfield(__('White', 'wp-members'), 'option', 'white', $wpmem_captcha[2]); echo wpmem_create_formfield(__('Black Glass', 'wp-members'), 'option', 'blackglass', $wpmem_captcha[2]); echo wpmem_create_formfield(__('Clean', 'wp-members'), 'option', 'clean', $wpmem_captcha[2]); ?> <!--<?php echo wpmem_create_formfield(__('Custom', 'wp-members'), 'option', 'custom', $wpmem_captcha[2]); ?> --> </select> </td> </tr><!-- <tr valign="top"> <th scope="row">Custom reCAPTCHA theme</th> <td><input type="text" name="wpmem_settings_regurl" value="<?php echo $wpmem_regurl; ?> " size="50" /> <span class="description"><?php _e('Optional', 'wp-members'); ?> </span></td> </tr>--> <tr valign="top"> <th scope="row"> </th> <td> <input type="hidden" name="wpmem_admin_a" value="update_captcha" /> <input type="submit" name="save" class="button-primary" value="<?php _e('Update reCAPTCHA Settings', 'wp-members'); ?> »" /> </td> </tr> </table> </form> </div><!-- .inside --> </div> </div><!-- #post-body-content --> </div><!-- #post-body --> </div><!-- .metabox-holder --> <?php }
/** * Login Form Dialog * * Builds the table-less form used for * login, change password, and reset password. * * @since 2.5.1 * * @uses apply_filters Calls 'wpmem_login_form_before' * @uses apply_filters Calls 'wpmem_forgot_link' * @uses apply_filters Calls 'wpmem_reg_link' * @uses apply_filters Calls 'wpmem_login_form' * * @param string $page * @param array $arr * @return string $form */ function wpmem_login_form_NEW($page, $arr) { // are we redirecting somewhere? /*if( isset( $_REQUEST['redirect_to'] ) ) { $redirect_to = $_REQUEST['redirect_to']; } else { $redirect_to = get_permalink(); }*/ $redirect_to = isset($_REQUEST['redirect_to']) ? esc_url($_REQUEST['redirect_to']) : get_permalink(); // fix the wptexturize remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'wpmem_texturize', 99); $form = apply_filters('wpmem_login_form_before', ''); $form .= '[wpmem_txt]<div id="wpmem_login"> <a name="login"></a> <form action="' . get_permalink() . '" method="POST" class="form"> <fieldset> <legend>' . $arr[0] . '</legend> <label for="username">' . $arr[1] . '</label> <div class="div_text"> ' . wpmem_create_formfield($arr[3], $arr[2], '', '', $arr[9]) . ' </div> <label for="password">' . $arr[4] . '</label> <div class="div_text"> ' . wpmem_create_formfield($arr[6], $arr[5], '', '', $arr[10]) . ' </div> <input type="hidden" name="redirect_to" value="' . $redirect_to . '" />'; if ($arr[7] != 'login') { $form = $form . wpmem_create_formfield('formsubmit', 'hidden', '1'); } $form = $form . wpmem_create_formfield('a', 'hidden', $arr[7]); $form = $form . '<div class="button_div">'; if ($arr[7] == 'login') { $form = $form . '<input name="rememberme" type="checkbox" id="rememberme" value="forever" /> ' . __('Remember me', 'wp-members') . ' <input type="submit" name="Submit" value="' . $arr[8] . '" class="buttons" />'; } else { $form = $form . '<input type="submit" name="Submit" value="' . $arr[8] . '" class="buttons" />'; } $form = $form . '</div> <div class="clear"></div> <div align="right">'; if ((WPMEM_MSURL != null || $page == 'members') && $arr[7] == 'login') { $link = apply_filters('wpmem_forgot_link', wpmem_chk_qstr(WPMEM_MSURL) . 'a=pwdreset'); $form = $form . __('Forgot password?', 'wp-members') . ' <a href="' . $link . '">' . __('Click here to reset', 'wp-members') . '</a>'; } $form = $form . '</div> <div align="right">'; if (WPMEM_REGURL != null && $arr[7] == 'login') { $link = apply_filters('wpmem_reg_link', WPMEM_REGURL); $form = $form . __('New User?', 'wp-members') . ' <a href="' . $link . '">' . __('Click here to register', 'wp-members') . '</a>'; } $form = $form . '</div> <div class="clear"></div> </fieldset></form> </div>[/wpmem_txt]'; $form = apply_filters('wpmem_login_form', $form); return $form; }
/** * Builds the settings panel. * * @since 2.2.2 */ function wpmem_a_build_options() { global $wpmem; /** This filter is documented in wp-members/inc/email.php */ $admin_email = apply_filters('wpmem_notify_addr', get_option('admin_email')); $chg_email = __(sprintf('%sChange%s or %sFilter%s this address', '<a href="' . site_url('wp-admin/options-general.php', 'admin') . '">', '</a>', '<a href="http://rocketgeek.com/plugins/wp-members/users-guide/filter-hooks/wpmem_notify_addr/">', '</a>'), 'wp-members'); $help_link = __(sprintf('See the %sUsers Guide on plugin options%s.', '<a href="http://rocketgeek.com/plugins/wp-members/users-guide/plugin-settings/options/" target="_blank">', '</a>'), 'wp-members'); // Build an array of post types $post_types = get_post_types(array('public' => true, '_builtin' => false), 'names', 'and'); $post_arr = array('post' => 'Posts', 'page' => 'Pages'); if ($post_types) { foreach ($post_types as $post_type) { $cpt_obj = get_post_type_object($post_type); $post_arr[$cpt_obj->name] = $cpt_obj->labels->name; } } ?> <div class="metabox-holder has-right-sidebar"> <div class="inner-sidebar"> <?php wpmem_a_meta_box(); ?> <div class="postbox"> <h3><span><?php _e('Need help?', 'wp-members'); ?> </span></h3> <div class="inside"> <strong><i><?php echo $help_link; ?> </i></strong> </div> </div> <?php wpmem_a_rss_box(); ?> </div> <!-- .inner-sidebar --> <div id="post-body"> <div id="post-body-content"> <div class="postbox"> <h3><span><?php _e('Manage Options', 'wp-members'); ?> </span></h3> <div class="inside"> <form name="updatesettings" id="updatesettings" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <?php wp_nonce_field('wpmem-update-settings'); ?> <h3><?php _e('Content', 'wp-members'); ?> </h3> <ul> <?php // Content Blocking option group. $i = 0; $len = count($post_arr); foreach ($post_arr as $key => $val) { if ($key == 'post' || $key == 'page' || isset($wpmem->post_types) && array_key_exists($key, $wpmem->post_types)) { ?> <li<?php echo $i == $len - 1 ? ' style="border-bottom:1px solid #eee;"' : ''; ?> > <label><?php echo $i == 0 ? 'Content Blocking' : ' '; ?> </label> <?php $block = isset($wpmem->block[$key]) ? $wpmem->block[$key] : ''; $values = array(__('Do not block', 'wp-members') . '|0', __('Block', 'wp-members') . '|1'); echo wpmem_create_formfield('wpmem_block_' . $key, 'select', $values, $block); ?> <span><?php echo $val; ?> </span> </li> <?php $i++; } } // Show Excerpts, Login Form, and Registration Form option groups. $option_group_array = array('show_excerpt' => __('Show Excerpts', 'wp-members'), 'show_login' => __('Show Login Form', 'wp-members'), 'show_reg' => __('Show Registration Form', 'wp-members'), 'autoex' => __('Auto Excerpt:', 'wp-members')); foreach ($option_group_array as $item_key => $item_val) { $i = 0; $len = count($post_arr); foreach ($post_arr as $key => $val) { if ($key == 'post' || $key == 'page' || isset($wpmem->post_types) && array_key_exists($key, $wpmem->post_types)) { ?> <li<?php echo $i == $len - 1 ? ' style="border-bottom:1px solid #eee;"' : ''; ?> > <label><?php echo $i == 0 ? $item_val : ' '; ?> </label> <?php if ('autoex' == $item_key) { if (isset($wpmem->{$item_key}[$key]) && $wpmem->{$item_key}[$key]['enabled'] == 1) { $setting = 1; $ex_len = $wpmem->{$item_key}[$key]['length']; } else { $setting = 0; $ex_len = ''; } echo wpmem_create_formfield('wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting); ?> <span><?php echo $val; ?> </span> <span><?php _e('Number of words in excerpt:', 'wp-members'); ?> </span><input name="wpmem_autoex_<?php echo $key; ?> _len" type="text" size="5" value="<?php echo $ex_len; ?> " /> <?php } else { $setting = isset($wpmem->{$item_key}[$key]) ? $wpmem->{$item_key}[$key] : 0; echo wpmem_create_formfield('wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting); ?> <span><?php echo $val; ?> </span> <?php } ?> </li> <?php $i++; } } } ?> </ul> <?php if (WPMEM_EXP_MODULE == true) { $arr = array(array(__('Time-based expiration', 'wp-members'), 'wpmem_settings_time_exp', __('Allows for access to expire', 'wp-members'), 'use_exp'), array(__('Trial period', 'wp-members'), 'wpmem_settings_trial', __('Allows for a trial period', 'wp-members'), 'use_trial')); ?> <h3><?php _e('Subscription Settings', 'wp-members'); ?> </h3> <ul><?php for ($row = 0; $row < count($arr); $row++) { ?> <li> <label><?php echo $arr[$row][0]; ?> </label> <?php echo wpmem_create_formfield($arr[$row][1], 'checkbox', '1', $wpmem->{$arr[$row][3]}); ?> <?php if ($arr[$row][2]) { ?> <span class="description"><?php echo $arr[$row][2]; ?> </span><?php } ?> </li> <?php } } ?> </ul> <h3><?php _e('Other Settings', 'wp-members'); ?> </h3> <ul> <?php $arr = array(array(__('Notify admin', 'wp-members'), 'wpmem_settings_notify', sprintf(__('Notify %s for each new registration? %s', 'wp-members'), $admin_email, $chg_email), 'notify'), array(__('Moderate registration', 'wp-members'), 'wpmem_settings_moderate', __('Holds new registrations for admin approval', 'wp-members'), 'mod_reg'), array(__('Ignore warning messages', 'wp-members'), 'wpmem_settings_ignore_warnings', __('Ignores WP-Members warning messages in the admin panel', 'wp-members'), 'warnings')); for ($row = 0; $row < count($arr); $row++) { ?> <li> <label><?php echo $arr[$row][0]; ?> </label> <?php echo wpmem_create_formfield($arr[$row][1], 'checkbox', '1', $wpmem->{$arr[$row][3]}); ?> <?php if ($arr[$row][2]) { ?> <span class="description"><?php echo $arr[$row][2]; ?> </span><?php } ?> </li> <?php } ?> <li> <label><?php _e('Attribution', 'wp-members'); ?> </label> <?php echo wpmem_create_formfield('attribution', 'checkbox', '1', $wpmem->attrib); ?> <span class="description"><?php _e('Attribution is appreciated! Display "powered by" link on register form?', 'wp-members'); ?> </span> </li> <li> <label><?php _e('Enable CAPTCHA', 'wp-members'); ?> </label> <?php $captcha = array(__('None', 'wp-members') . '|0', 'reCAPTCHA|1', 'reCAPTCHA v2|3', 'Really Simple CAPTCHA|2'); echo wpmem_create_formfield('wpmem_settings_captcha', 'select', $captcha, $wpmem->captcha); ?> </li> <h3><?php _e('Pages'); ?> </h3> <?php $wpmem_logurl = $wpmem->user_pages['login']; if (!$wpmem_logurl) { $wpmem_logurl = wpmem_use_ssl(); } ?> <li> <label><?php _e('Login Page:', 'wp-members'); ?> </label> <select name="wpmem_settings_logpage" id="wpmem_logpage_select"> <?php wpmem_admin_page_list($wpmem_logurl); ?> </select> <span class="description"><?php _e('Specify a login page (optional)', 'wp-members'); ?> </span><br /> <div id="wpmem_logpage_custom"> <label> </label> <input class="regular-text code" type="text" name="wpmem_settings_logurl" value="<?php echo $wpmem_logurl; ?> " size="50" /> </div> </li> <?php $wpmem_regurl = $wpmem->user_pages['register']; if (!$wpmem_regurl) { $wpmem_regurl = wpmem_use_ssl(); } ?> <li> <label><?php _e('Register Page:', 'wp-members'); ?> </label> <select name="wpmem_settings_regpage" id="wpmem_regpage_select"> <?php wpmem_admin_page_list($wpmem_regurl); ?> </select> <span class="description"><?php _e('For creating a register link in the login form', 'wp-members'); ?> </span><br /> <div id="wpmem_regpage_custom"> <label> </label> <input class="regular-text code" type="text" name="wpmem_settings_regurl" value="<?php echo $wpmem_regurl; ?> " size="50" /> </div> </li> <?php $wpmem_msurl = $wpmem->user_pages['profile']; if (!$wpmem_msurl) { $wpmem_msurl = wpmem_use_ssl(); } ?> <li> <label><?php _e('User Profile Page:', 'wp-members'); ?> </label> <select name="wpmem_settings_mspage" id="wpmem_mspage_select"> <?php wpmem_admin_page_list($wpmem_msurl); ?> </select> <span class="description"><?php _e('For creating a forgot password link in the login form', 'wp-members'); ?> </span><br /> <div id="wpmem_mspage_custom"> <label> </label> <input class="regular-text code" type="text" name="wpmem_settings_msurl" value="<?php echo $wpmem_msurl; ?> " size="50" /> </div> </li> <h3><?php _e('Stylesheet'); ?> </h3> <li> <label><?php _e('Stylesheet'); ?> :</label> <select name="wpmem_settings_style" id="wpmem_stylesheet_select"> <?php wpmem_admin_style_list($wpmem->style); ?> </select> </li> <?php $wpmem_cssurl = $wpmem->cssurl; if (!$wpmem_cssurl) { $wpmem_cssurl = wpmem_use_ssl(); } ?> <div id="wpmem_stylesheet_custom"> <li> <label><?php _e('Custom Stylesheet:', 'wp-members'); ?> </label> <input class="regular-text code" type="text" name="wpmem_settings_cssurl" value="<?php echo $wpmem_cssurl; ?> " size="50" /> </li> </div> <br /></br /> <input type="hidden" name="wpmem_admin_a" value="update_settings"> <?php submit_button(__('Update Settings', 'wp-members')); ?> </ul> </form> </div><!-- .inside --> </div> <?php if ($post_types) { ?> <div class="postbox"> <h3><span><?php _e('Custom Post Types', 'wp-members'); ?> </span></h3> <div class="inside"> <form name="updatecpts" id="updatecpts" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <?php wp_nonce_field('wpmem-update-cpts'); ?> <table class="form-table"> <tr> <th scope="row"><?php _e('Add to WP-Members Settings', 'wp-members'); ?> </th> <td><fieldset><?php foreach ($post_arr as $key => $val) { if ('post' != $key && 'page' != $key) { $checked = isset($wpmem->post_types) && array_key_exists($key, $wpmem->post_types) ? ' checked' : ''; echo '<label for="' . $key . '"><input type="checkbox" name="wpmembers_handle_cpts[]" value="' . $key . '"' . $checked . ' />' . $val . '</label><br />'; } } ?> </fieldset> </td> </tr> <tr> <input type="hidden" name="wpmem_admin_a" value="update_cpts" /> <td colspan="2"><?php submit_button(__('Update Settings', 'wp-members')); ?> </td> </tr> </table> </form> </div> </div> <?php } ?> </div><!-- #post-body-content --> </div><!-- #post-body --> </div><!-- .metabox-holder --> <?php }
/** * Function to display the table of fields in the field manager tab. * * @since 2.8 * * @param array $wpmem_fields The array of fields */ function wpmem_a_field_table($wpmem_fields) { global $wpmem; ?> <div class="postbox"> <h3 class="title"><?php _e('Manage Fields', 'wp-members'); ?> </h3> <div class="inside"> <p><?php _e('Determine which fields will display and which are required. This includes all fields, both native WP fields and WP-Members custom fields.', 'wp-members'); ?> <br /><strong><?php _e('(Note: Email is always mandatory and cannot be changed.)', 'wp-members'); ?> </strong></p> <form name="updatefieldform" id="updatefieldform" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?> "> <?php wp_nonce_field('wpmem-update-fields'); ?> <table class="widefat" id="wpmem-fields"> <thead><tr class="head"> <th scope="col"><?php _e('Add/Delete', 'wp-members'); ?> </th> <th scope="col"><?php _e('Field Label', 'wp-members'); ?> </th> <th scope="col"><?php _e('Option Name', 'wp-members'); ?> </th> <th scope="col"><?php _e('Field Type', 'wp-members'); ?> </th> <th scope="col"><?php _e('Display?', 'wp-members'); ?> </th> <th scope="col"><?php _e('Required?', 'wp-members'); ?> </th> <th scope="col"><?php _e('Checked?', 'wp-members'); ?> </th> <th scope="col"><?php _e('Edit'); ?> </th> <th scope="col"><?php _e('Users Screen', 'wp-members'); ?> </th> </tr></thead> <?php // Get the user table fields array. $wpmem_ut_fields = get_option('wpmembers_utfields'); // Order, label, optionname, input type, display, required, native. $class = ''; for ($row = 0; $row < count($wpmem_fields); $row++) { $class = $class == 'alternate' ? '' : 'alternate'; ?> <tr class="<?php echo $class; ?> " valign="top" id="<?php echo $wpmem_fields[$row][0]; ?> "> <td width="10%"><?php $can_delete = $wpmem_fields[$row][2] == 'user_nicename' || $wpmem_fields[$row][2] == 'display_name' || $wpmem_fields[$row][2] == 'nickname' ? 'y' : 'n'; if ($can_delete == 'y' || $wpmem_fields[$row][6] != 'y') { ?> <input type="checkbox" name="<?php echo "del_" . $wpmem_fields[$row][2]; ?> " value="delete" /> <?php _e('Delete', 'wp-members'); } ?> </td> <td width="15%"><?php _e($wpmem_fields[$row][1], 'wp-members'); if ($wpmem_fields[$row][5] == 'y') { ?> <font color="red">*</font><?php } ?> </td> <td width="15%"><?php echo $wpmem_fields[$row][2]; ?> </td> <td width="10%"><?php echo $wpmem_fields[$row][3]; ?> </td> <?php if ($wpmem_fields[$row][2] != 'user_email') { ?> <td width="10%"><?php echo wpmem_create_formfield($wpmem_fields[$row][2] . "_display", 'checkbox', 'y', $wpmem_fields[$row][4]); ?> </td> <td width="10%"><?php echo wpmem_create_formfield($wpmem_fields[$row][2] . "_required", 'checkbox', 'y', $wpmem_fields[$row][5]); ?> </td> <?php } else { ?> <td colspan="2" width="20%"><small><i><?php _e('(Email cannot be removed)', 'wp-members'); ?> </i></small></td> <?php } ?> <td align="center" width="10%"><?php if ($wpmem_fields[$row][3] == 'checkbox') { echo wpmem_create_formfield($wpmem_fields[$row][2] . "_checked", 'checkbox', 'y', $wpmem_fields[$row][8]); } ?> </td> <td width="10%"><?php echo $wpmem_fields[$row][6] == 'y' ? 'native' : wpmem_fields_edit_link($wpmem_fields[$row][2]); ?> </td> <td align="center" width="10%"> <?php $wpmem_ut_fields_skip = array('user_email', 'confirm_email', 'password', 'confirm_password'); if (!in_array($wpmem_fields[$row][2], $wpmem_ut_fields_skip)) { ?> <input type="checkbox" name="ut_fields[<?php echo $wpmem_fields[$row][2]; ?> ]" value="<?php echo $wpmem_fields[$row][1]; ?> " <?php echo $wpmem_ut_fields && in_array($wpmem_fields[$row][1], $wpmem_ut_fields) ? 'checked' : false; ?> /> <?php } ?> </td> </tr><?php } ?> <tr class="nodrag nodrop"> <td> </td> <td><i><?php _e('Registration Date', 'wp-members'); ?> </i></td> <td><i>user_registered</i></td> <td colspan="4"> </td> <td><?php _e('native', 'wp-members'); ?> </td> <td align="center"> <input type="checkbox" name="ut_fields[user_registered]" value="Registration Date" <?php echo $wpmem_ut_fields && in_array('Registration Date', $wpmem_ut_fields) ? 'checked' : false; ?> /> </td> </tr> <?php if ($wpmem->mod_reg == 1) { ?> <tr class="nodrag nodrop"> <td> </td> <td><i><?php _e('Active', 'wp-members'); ?> </i></td> <td><i>active</i></td> <td colspan="5"> </td> <td align="center"> <input type="checkbox" name="ut_fields[active]" value="Active" <?php echo $wpmem_ut_fields && in_array('Active', $wpmem_ut_fields) ? 'checked' : false; ?> /> </td> </tr> <?php } ?> <tr class="nodrag nodrop"> <td> </td> <td><i><?php _e('Registration IP', 'wp-members'); ?> </i></td> <td><i>wpmem_reg_ip</i></td> <td colspan="5"> </td> <td align="center"> <input type="checkbox" name="ut_fields[wpmem_reg_ip]" value="Registration IP" <?php echo $wpmem_ut_fields && in_array('Registration IP', $wpmem_ut_fields) ? 'checked' : false; ?> /> </td> </tr> <?php if ($wpmem->use_exp == 1) { ?> <tr class="nodrag nodrop"> <td> </td> <td><i>Subscription Type</i></td> <td><i>exp_type</i></td> <td colspan="5"> </td> <td align="center"> <input type="checkbox" name="ut_fields[exp_type]" value="Subscription Type" <?php echo $wpmem_ut_fields && in_array('Subscription Type', $wpmem_ut_fields) ? 'checked' : false; ?> /> </td> </tr> <tr class="nodrag nodrop"> <td> </td> <td><i>Expires</i></td> <td><i>expires</i></td> <td colspan="5"> </td> <td align="center"> <input type="checkbox" name="ut_fields[expires]" value="Expires" <?php echo $wpmem_ut_fields && in_array('Expires', $wpmem_ut_fields) ? 'checked' : false; ?> /> </td> </tr> <?php } ?> </table><br /> <input type="hidden" name="wpmem_admin_a" value="update_fields" /> <input type="submit" name="save" class="button-primary" value="<?php _e('Update Fields', 'wp-members'); ?> »" /> </form> </div><!-- .inside --> </div> <?php }
/** * Login Form Dialog (Legacy) * * Builds the table-based form used for * login, change password, and reset password. * * @param string $page * @param array $arr * @return string $form */ function wpmem_login_form_OLD($page, $arr) { $form = '<div class="wpmem_login"> <a name="login"></a> <form name="form" method="post" action="' . get_permalink() . '"> <table width="400" border="0" cellspacing="0" cellpadding="4"> <tr align="left"> <td colspan="2"><h2>' . $arr[0] . '</h2></td> </tr> <tr> <td width="118" align="right">' . $arr[1] . '</td> <td width="166">' . wpmem_create_formfield($arr[3], $arr[2], '') . '</td> </tr> <tr> <td width="118" align="right">' . $arr[4] . '</td> <td width="166">' . wpmem_create_formfield($arr[6], $arr[5], '') . '</td> </tr>'; if ($arr[7] == 'login') { $form = $form . '<tr> <td width="118"> </td> <td width="166"><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> ' . __('Remember me', 'wp-members') . '</td> </tr>'; } $form = $form . '<tr> <td width="118"> </td> <td width="166"> <input type="hidden" name="redirect_to" value="' . get_permalink() . '" />'; if ($arr[7] != 'login') { $form = $form . wpmem_create_formfield('formsubmit', 'hidden', '1'); } $form = $form . wpmem_create_formfield('a', 'hidden', $arr[7]) . ' <input type="submit" name="Submit" value="' . $arr[8] . '" /> </td> </tr>'; if ((WPMEM_MSURL != null || $page == 'members') && $arr[7] == 'login') { $link = wpmem_chk_qstr(WPMEM_MSURL); $form = $form . '<tr> <td colspan="2">' . __('Forgot password?', 'wp-members') . ' <a href="' . $link . 'a=pwdreset">' . __('Click here to reset', 'wp-members') . '</a></td> </tr>'; } if (WPMEM_REGURL != null && $arr[7] == 'login') { $form = $form . '<tr> <td colspan="2">' . __('New User?', 'wp-members') . ' <a href="' . WPMEM_REGURL . '">' . __('Click here to register', 'wp-members') . '</a></td> </tr>'; } $form = $form . '</table> </form> </div>'; return $form; }
/** * add WP-Members fields to the WP user profile screen * * @since 2.1 * * @uses apply_filters Calls wpmem_admin_profile_field & @uses apply_filters Calls wpmem_admin_profile_heading * * @global array $current_screen The WordPress screen object * @global int $user_ID The user ID */ function wpmem_admin_fields() { global $current_screen, $user_ID; $user_id = $current_screen->id == 'profile' ? $user_ID : $_REQUEST['user_id']; ?> <h3><?php echo apply_filters('wpmem_admin_profile_heading', __('WP-Members Additional Fields', 'wp-members')); ?> </h3> <table class="form-table"> <?php $wpmem_fields = get_option('wpmembers_fields'); $valtochk = ''; for ($row = 0; $row < count($wpmem_fields); $row++) { /** determine which fields to show in the additional fields area */ $show = $wpmem_fields[$row][6] == 'n' && $wpmem_fields[$row][2] != 'password' ? true : false; $show = $wpmem_fields[$row][1] == 'TOS' && $wpmem_fields[$row][4] != 'y' ? null : $show; if ($show) { $show_field = ' <tr> <th><label>' . $wpmem_fields[$row][1] . '</label></th> <td>'; $val = htmlspecialchars(get_user_meta($user_id, $wpmem_fields[$row][2], 'true')); if ($wpmem_fields[$row][3] == 'checkbox' || $wpmem_fields[$row][3] == 'select') { $valtochk = $val; $val = $wpmem_fields[$row][7]; } $show_field .= wpmem_create_formfield($wpmem_fields[$row][2], $wpmem_fields[$row][3], $val, $valtochk) . ' </td> </tr>'; $valtochk = ''; // empty for the next field in the loop echo apply_filters('wpmem_admin_profile_field', $show_field); } } // see if reg is moderated, and if the user has been activated if (WPMEM_MOD_REG == 1) { $user_active_flag = get_user_meta($user_id, 'active', 'true'); switch ($user_active_flag) { case '': $label = __('Activate this user?', 'wp-members'); $action = 1; break; case 0: $label = __('Reactivate this user?', 'wp-members'); $action = 1; break; case 1: $label = __('Deactivate this user?', 'wp-members'); $action = 0; break; } ?> <tr> <th><label><?php echo $label; ?> </label></th> <td><input id="activate_user" type="checkbox" class="input" name="activate_user" value="<?php echo $action; ?> " /></td> </tr> <?php } // if using subscription model, show expiration // if registration is moderated, this doesn't show if user is not active yet. if (WPMEM_USE_EXP == 1) { if (WPMEM_MOD_REG == 1 && get_user_meta($user_id, 'active', 'true') == 1 || WPMEM_MOD_REG != 1) { wpmem_a_extenduser($user_id); } } ?> <tr> <th><label><?php _e('IP @ registration', 'wp-members'); ?> </label></th> <td><?php echo get_user_meta($user_id, 'wpmem_reg_ip', 'true'); ?> </td> </tr> </table><?php }
/** * add WP-Members fields to the WP user profile screen * * @since 2.6.5 * * @global int $user_id */ function wpmem_user_profile() { global $user_id; ?> <h3><?php _e('Additional Info', 'wp-members'); ?> </h3> <table class="form-table"> <?php $wpmem_fields = get_option('wpmembers_fields'); for ($row = 0; $row < count($wpmem_fields); $row++) { $val = get_user_meta($user_id, $wpmem_fields[$row][2], 'true'); $chk_tos = true; if ($wpmem_fields[$row][2] == 'tos' && $val == 'agree') { $chk_tos = false; echo wpmem_create_formfield($wpmem_fields[$row][2], 'hidden', $val); } $chk_pass = true; if ($wpmem_fields[$row][2] == 'password') { $chk_pass = false; } if ($wpmem_fields[$row][4] == "y" && $wpmem_fields[$row][6] == "n" && $chk_tos && $chk_pass) { // if there are any required fields, set a toggle to show indicator in last line if ($wpmem_fields[$row][5] == 'y') { $has_req = true; } ?> <tr> <th><label><?php echo $wpmem_fields[$row][1]; ?> </label></th> <td><?php $val = get_user_meta($user_id, $wpmem_fields[$row][2], 'true'); if ($wpmem_fields[$row][3] == 'checkbox' || $wpmem_fields[$row][3] == 'select') { $valtochk = $val; $val = $wpmem_fields[$row][7]; } echo wpmem_create_formfield($wpmem_fields[$row][2], $wpmem_fields[$row][3], $val, $valtochk); if ($wpmem_fields[$row][5] == 'y') { echo '<font color="red">*</font>'; } $valtochk = ''; // empty for the next field in the loop ?> </td> </tr> <?php } } if ($has_req) { ?> <tr> <th> </th> <td><font color="red">*</font> <?php _e('Indicates a required field', 'wp-members'); ?> </td> </tr><?php } ?> </table><?php }
/** * add WP-Members fields to the WP user profile screen. * * @since 2.6.5 * * @global int $user_id */ function wpmem_user_profile() { global $wpmem, $user_id; /** * Filter the heading for the user profile additional fields. * * @since 2.9.1 * * @param string The default heading. */ ?> <h3><?php echo apply_filters('wpmem_user_profile_heading', __('Additional Information', 'wp-members')); ?> </h3> <table class="form-table"> <?php // Get fields. $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' ); // Get excluded meta. $exclude = wpmem_get_excluded_meta('user-profile'); $rows = array(); foreach ($wpmem_fields as $meta) { $valtochk = ''; $values = ''; // Do we exclude the row? $chk_pass = in_array($meta[2], $exclude) ? false : true; if ($meta[4] == "y" && $meta[6] == "n" && $chk_pass) { $val = get_user_meta($user_id, $meta[2], true); if ($meta[3] == 'checkbox') { $valtochk = $val; $val = $meta[7]; } if ('multicheckbox' == $meta[3] || 'select' == $meta[3] || 'multiselect' == $meta[3] || 'radio' == $meta[3]) { $values = $meta[7]; $valtochk = $val; } // Is this an image or a file? if ('file' == $meta[3] || 'image' == $meta[3]) { $attachment_url = wp_get_attachment_url($val); $empty_file = '<span class="description">' . __('None') . '</span>'; if ('file' == $meta[3]) { $input = 0 < $attachment_url ? '<a href="' . $attachment_url . '">' . $attachment_url . '</a>' : $empty_file; } else { $input = 0 < $attachment_url ? '<img src="' . $attachment_url . '">' : $empty_file; } // @todo - come up with a way to handle file updates - user profile form does not support multitype //$show_field.= '<br /><span class="description">' . __( 'Update this file:' ) . '</span><br />'; //$show_field.= wpmem_create_formfield( $meta[2] . '_update_file', $meta[3], $val, $valtochk ); } else { if ($meta[2] == 'tos' && $val == 'agree') { $input = wpmem_create_formfield($meta[2], 'hidden', $val); } elseif ('multicheckbox' == $meta[3] || 'select' == $meta[3] || 'multiselect' == $meta[3] || 'radio' == $meta[3]) { $input = wpmem_create_formfield($meta[2], $meta[3], $values, $valtochk); } else { $input = wpmem_create_formfield($meta[2], $meta[3], $val, $valtochk); } } // If there are any required fields. $req = $meta[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : ''; $label = '<label>' . __($meta[1], 'wp-members') . $req . '</label>'; // Build the form rows for filtering. $rows[$meta[2]] = array('order' => $meta[0], 'meta' => $meta[2], 'type' => $meta[3], 'value' => $val, 'values' => $values, 'label_text' => __($meta[1], 'wp-members'), 'row_before' => '', 'label' => $label, 'field_before' => '', 'field' => $input, 'field_after' => '', 'row_after' => ''); } } /** * Filter for rows * * @since 3.1.0 * * @param array $rows * @param string $toggle */ $rows = apply_filters('wpmem_register_form_rows_profile', $rows, 'userprofile'); foreach ($rows as $row) { $show_field = ' <tr> <th>' . $row['label'] . '</th> <td>' . $row['field'] . '</td> </tr>'; /** * Filter the field for user profile additional fields. * * @since 2.9.1 * @since 3.1.1 Added $user_id and $row. * * @param string $show_field The HTML string of the additional field. * @param int $user_id * @param array $rows */ echo apply_filters('wpmem_user_profile_field', $show_field, $user_id, $row); } ?> </table><?php }
/** * Appends WP-Members registration fields to Users > Add New User screen. * * @since 2.9.0 * @since 3.1.1 Updated to support new (3.1.0) field types and user activation. */ function wpmem_do_wp_newuser_form() { global $wpmem; echo '<table class="form-table"><tbody>'; $wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' ); $exclude = wpmem_get_excluded_meta('register'); foreach ($wpmem_fields as $field) { $meta_key = $field[2]; if ($field[6] == 'n' && !in_array($meta_key, $exclude)) { $req = $field[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : ''; echo '<tr> <th scope="row"> <label for="' . $meta_key . '">' . __($field[1], 'wp-members') . $req . '</label> </th> <td>'; // determine the field type and generate accordingly. switch ($field[3]) { case 'select': $val = isset($_POST[$meta_key]) ? $_POST[$meta_key] : ''; echo wpmem_create_formfield($meta_key, $field[3], $field[7], $val); break; case 'textarea': echo '<textarea name="' . $meta_key . '" id="' . $meta_key . '" class="textarea">'; echo isset($_POST[$meta_key]) ? esc_textarea($_POST[$meta_key]) : ''; echo '</textarea>'; break; case 'checkbox': $val = isset($_POST[$meta_key]) ? $_POST[$meta_key] : ''; $val = !$_POST && $field[8] == 'y' ? $field[7] : $val; echo wpmem_create_formfield($meta_key, $field[3], $field[7], $val); break; case 'multiselect': case 'multicheckbox': case 'radio': $valtochk = isset($_POST[$meta_key]) ? $_POST[$meta_key] : ''; $formfield_args = array('name' => $meta_key, 'type' => $field[3], 'value' => $field[7], 'compare' => $valtochk, 'required' => 'y' == $field[5] ? true : false); if ('multicheckbox' == $field[3] || 'multiselect' == $field[3]) { $formfield_args['delimiter'] = isset($field[8]) ? $field[8] : '|'; } echo $wpmem->forms->create_form_field($formfield_args); break; case 'file': case 'image': break; default: echo '<input type="' . $field[3] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="input" value="'; echo isset($_POST[$meta_key]) ? esc_attr($_POST[$meta_key]) : ''; echo '" size="25" />'; break; } echo '</td> </tr>'; } } // If moderated registration is enabled, add checkbox to set user as active. if (1 == $wpmem->mod_reg) { echo '<tr> <th scope="row"> <label for="activate_user">' . __('Activate this user?', 'wp-members') . '</label> </th> <td>' . $wpmem->forms->create_form_field(array('name' => 'activate_user', 'type' => 'checkbox', 'value' => 1, 'compare' => '')) . '</td> </tr>'; } echo '</tbody></table>'; }