/** * Get instance. * * @return IBFW_User_Flow */ public static function get_instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
$form_action = untrailingslashit($form_action) . '/action/profile'; } else { $form_action = add_query_arg('action', 'profile', $form_action); } // Setup the form data. $curauth = wp_get_current_user(); $first_name = !isset($_POST['first_name']) ? $curauth->first_name : stripslashes($_POST['first_name']); $last_name = !isset($_POST['last_name']) ? $curauth->last_name : stripslashes($_POST['last_name']); $user_email = !isset($_POST['user_email']) ? $curauth->user_email : stripslashes($_POST['user_email']); $description = !isset($_POST['description']) ? $curauth->description : stripslashes($_POST['description']); // Display the success message. if (isset($_GET['updated']) && 'true' == $_GET['updated']) { echo '<div class="ib-edu-message success">' . __('Profile has been updated.', 'ib-educator') . '</div>'; } // Display errors. $ufw = IBFW_User_Flow::get_instance(); $errors = $ufw->get_errors(); if (is_wp_error($errors)) { foreach ($errors->get_error_messages() as $message) { echo '<div class="ib-edu-message error">' . $message . '</div>'; } } ?> <form class="ib-edu-form" action="<?php echo esc_url($form_action); ?> " method="post"> <?php wp_nonce_field('educator_edit_profile', 'educator_edit_profile_nonce'); ?> <input type="hidden" name="ibfw_ufw_action" value="update_profile">
<?php /** * Add custom user flow settings to the customizer. * * @param WP_Customize_Manager $wp_customize */ function educator_add_ufw_settings($wp_customize) { // Enable custom user flow. $wp_customize->add_setting('ib_ufw_enabled', array('default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint', 'sanitize_js_callback' => 'absint')); $wp_customize->add_control('educator_ufw_enabled', array('label' => __('Enable custom user flow', 'ib-educator-theme') . ' (beta)', 'section' => 'educator_login_settings', 'settings' => 'ib_ufw_enabled', 'type' => 'checkbox', 'priority' => 3)); // Enable captcha on registration form. $wp_customize->add_setting('ib_ufw_captcha', array('default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint', 'sanitize_js_callback' => 'absint')); $wp_customize->add_control('educator_ufw_captcha', array('label' => __('Enable captcha on registration form', 'ib-educator-theme'), 'section' => 'educator_login_settings', 'settings' => 'ib_ufw_captcha', 'type' => 'checkbox')); // Recaptcha site key. $wp_customize->add_setting('ib_ufw_site_key', array('default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('educator_ufw_site_key', array('label' => __('ReCaptcha Site Key', 'ib-educator-theme'), 'section' => 'educator_login_settings', 'settings' => 'ib_ufw_site_key', 'type' => 'text')); // Recaptcha secret key. $wp_customize->add_setting('ib_ufw_secret_key', array('default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_control('educator_ufw_secret_key', array('label' => __('ReCaptcha Secret Key', 'ib-educator-theme'), 'section' => 'educator_login_settings', 'settings' => 'ib_ufw_secret_key', 'type' => 'text')); } add_action('customize_register', 'educator_add_ufw_settings', 20); if (get_option('ib_ufw_enabled')) { require 'user-flow.php'; $ibfw_user_flow = IBFW_User_Flow::get_instance(); if (get_option('ib_ufw_captcha')) { $ibfw_user_flow->turnOnCaptcha(); } $ibfw_user_flow->processRequest(); }