function wpuf_settings_field_profile($form) { $user_roles = wpuf_get_user_roles(); $forms = get_posts(array('numberposts' => -1, 'post_type' => 'wpuf_profile')); $val = get_option('wpuf_profile', array()); ?> <p style="padding-left: 10px; font-style: italic; font-size: 13px;"> <strong><?php _e('Select profile/registration forms for user roles. These forms will be used to populate extra edit profile fields in backend.', 'wpuf'); ?> </strong> </p> <table class="form-table"> <?php foreach ($user_roles as $role => $name) { $current = isset($val['roles'][$role]) ? $val['roles'][$role] : ''; ?> <tr valign="top"> <th scrope="row"><?php echo $name; ?> </th> <td> <select name="wpuf_profile[roles][<?php echo $role; ?> ]"> <option value=""><?php _e(' - select - ', 'wpuf'); ?> </option> <?php foreach ($forms as $form) { ?> <option value="<?php echo $form->ID; ?> "<?php selected($current, $form->ID); ?> ><?php echo $form->post_title; ?> </option> <?php } ?> </select> </td> </tr> <?php } ?> </table> <?php }
/** * Display settings for user profile builder * * @return void */ function form_settings_profile() { global $post; $form_settings = wpuf_get_form_settings($post->ID); $email_verification = isset($form_settings['enable_email_verification']) ? $form_settings['enable_email_verification'] : 'no'; $role_selected = isset($form_settings['role']) ? $form_settings['role'] : 'subscriber'; $redirect_to = isset($form_settings['redirect_to']) ? $form_settings['redirect_to'] : 'post'; $message = isset($form_settings['message']) ? $form_settings['message'] : __('Registration successful', 'wpuf'); $update_message = isset($form_settings['update_message']) ? $form_settings['update_message'] : __('Profile updated successfully', 'wpuf'); $page_id = isset($form_settings['page_id']) ? $form_settings['page_id'] : 0; $url = isset($form_settings['url']) ? $form_settings['url'] : ''; $submit_text = isset($form_settings['submit_text']) ? $form_settings['submit_text'] : __('Register', 'wpuf'); $update_text = isset($form_settings['update_text']) ? $form_settings['update_text'] : __('Update Profile', 'wpuf'); ?> <table class="form-table"> <tr class="wpuf-post-type"> <th><?php _e('Enable Email Verfication', 'wpuf'); ?> </th> <td> <input type="hidden" name="wpuf_settings[enable_email_verification]" value="no"> <input type="checkbox" id="wpuf-enable_email_verification" name="wpuf_settings[enable_email_verification]" value="yes" <?php checked($email_verification, 'yes'); ?> > <label for="wpuf-enable_email_verification">Enable Email Verification</label> </td> </tr> <tr class="wpuf-post-type"> <th><?php _e('New User Role', 'wpuf'); ?> </th> <td> <select name="wpuf_settings[role]"> <?php $user_roles = wpuf_get_user_roles(); foreach ($user_roles as $role => $label) { printf('<option value="%s"%s>%s</option>', $role, selected($role_selected, $role, false), $label); } ?> </select> </td> </tr> <tr class="wpuf-redirect-to"> <th><?php _e('Redirect To', 'wpuf'); ?> </th> <td> <select name="wpuf_settings[redirect_to]"> <?php $redirect_options = array('same' => __('Same Page', 'wpuf'), 'page' => __('To a page', 'wpuf'), 'url' => __('To a custom URL', 'wpuf')); foreach ($redirect_options as $to => $label) { printf('<option value="%s"%s>%s</option>', $to, selected($redirect_to, $to, false), $label); } ?> </select> <div class="description"> <?php _e('After successfull submit, where the page will redirect to', 'wpuf'); ?> </div> </td> </tr> <tr class="wpuf-same-page"> <th><?php _e('Registration success message', 'wpuf'); ?> </th> <td> <textarea rows="3" cols="40" name="wpuf_settings[message]"><?php echo esc_textarea($message); ?> </textarea> </td> </tr> <tr class="wpuf-same-page"> <th><?php _e('Update profile message', 'wpuf'); ?> </th> <td> <textarea rows="3" cols="40" name="wpuf_settings[update_message]"><?php echo esc_textarea($update_message); ?> </textarea> </td> </tr> <tr class="wpuf-page-id"> <th><?php _e('Page', 'wpuf'); ?> </th> <td> <select name="wpuf_settings[page_id]"> <?php $pages = get_posts(array('numberposts' => -1, 'post_type' => 'page')); foreach ($pages as $page) { printf('<option value="%s"%s>%s</option>', $page->ID, selected($page_id, $page->ID, false), esc_attr($page->post_title)); } ?> </select> </td> </tr> <tr class="wpuf-url"> <th><?php _e('Custom URL', 'wpuf'); ?> </th> <td> <input type="url" name="wpuf_settings[url]" value="<?php echo esc_attr($url); ?> "> </td> </tr> <tr class="wpuf-submit-text"> <th><?php _e('Submit Button text', 'wpuf'); ?> </th> <td> <input type="text" name="wpuf_settings[submit_text]" value="<?php echo esc_attr($submit_text); ?> "> </td> </tr> <tr class="wpuf-update-text"> <th><?php _e('Update Button text', 'wpuf'); ?> </th> <td> <input type="text" name="wpuf_settings[update_text]" value="<?php echo esc_attr($update_text); ?> "> </td> </tr> <?php do_action('registration_setting', $form_settings, $post); ?> </table> <?php }
/** * Render registration settings */ public static function render_registration_settings() { global $post; $form_settings = wpuf_get_form_settings($post->ID); $email_verification = 'no'; $role_selected = 'subscriber'; $redirect_to = 'post'; $message = __('Registration successful', 'wpuf'); $update_message = __('Profile updated successfully', 'wpuf'); $page_id = 0; $url = ''; $submit_text = __('Register', 'wpuf'); $update_text = __('Update Profile', 'wpuf'); ?> <tr> <td colspan="2"> <?php self::get_pro_prompt(); ?> </td> </tr> <tr class="wpuf-post-type"> <th><?php _e('Enable Email Verfication', 'wpuf'); ?> </th> <td> <input type="hidden" name="" value="no"> <input disabled type="checkbox" id="wpuf-enable_email_verification" name="" value="yes" <?php checked($email_verification, 'yes'); ?> > <label for="wpuf-enable_email_verification">Enable Email Verification</label> </td> </tr> <tr class="wpuf-post-type"> <th><?php _e('New User Role', 'wpuf'); ?> </th> <td> <select disabled name=""> <?php $user_roles = wpuf_get_user_roles(); foreach ($user_roles as $role => $label) { printf('<option value="%s"%s>%s</option>', $role, selected($role_selected, $role, false), $label); } ?> </select> </td> </tr> <tr class="wpuf-redirect-to"> <th><?php _e('Redirect To', 'wpuf'); ?> </th> <td> <select disabled name=""> <?php $redirect_options = array('same' => __('Same Page', 'wpuf'), 'page' => __('To a page', 'wpuf'), 'url' => __('To a custom URL', 'wpuf')); foreach ($redirect_options as $to => $label) { printf('<option value="%s"%s>%s</option>', $to, selected($redirect_to, $to, false), $label); } ?> </select> <div class="description"> <?php _e('After successfull submit, where the page will redirect to', 'wpuf'); ?> </div> </td> </tr> <tr class="wpuf-same-page"> <th><?php _e('Registration success message', 'wpuf'); ?> </th> <td> <textarea disabled rows="3" cols="40" name=""><?php echo esc_textarea($message); ?> </textarea> </td> </tr> <tr class="wpuf-same-page"> <th><?php _e('Update profile message', 'wpuf'); ?> </th> <td> <textarea disabled rows="3" cols="40" name=""><?php echo esc_textarea($update_message); ?> </textarea> </td> </tr> <tr class="wpuf-page-id"> <th><?php _e('Page', 'wpuf'); ?> </th> <td> <select disabled name=""> <?php $pages = get_posts(array('numberposts' => -1, 'post_type' => 'page')); foreach ($pages as $page) { printf('<option value="%s"%s>%s</option>', $page->ID, selected($page_id, $page->ID, false), esc_attr($page->post_title)); } ?> </select> </td> </tr> <tr class="wpuf-url"> <th><?php _e('Custom URL', 'wpuf'); ?> </th> <td> <input disabled type="url" name="" value="<?php echo esc_attr($url); ?> "> </td> </tr> <tr class="wpuf-submit-text"> <th><?php _e('Submit Button text', 'wpuf'); ?> </th> <td> <input disabled type="text" name="" value="<?php echo esc_attr($submit_text); ?> "> </td> </tr> <tr class="wpuf-update-text"> <th><?php _e('Update Button text', 'wpuf'); ?> </th> <td> <input disabled type="text" name="" value="<?php echo esc_attr($update_text); ?> "> </td> </tr> <?php }