public function process_registration() { do_action('popmake_alm_ajax_override_registration'); $user_login = $_POST['user_login']; $user_email = $_POST['user_email']; $user_pass = isset($_POST['user_pass']) ? $_POST['user_pass'] : wp_generate_password(12, false); $userdata = compact('user_login', 'user_email', 'user_pass'); $user = wp_insert_user($userdata); if (!isset($_POST['user_pass'])) { update_user_option($user, 'default_password_nag', true, true); // Set up the Password change nag. wp_new_user_notification($user, $user_pass); } if (is_wp_error($user)) { $response = array('success' => false, 'message' => $user->get_error_message()); } else { if (popmake_get_popup_ajax_registration($_POST['popup_id'], 'enable_autologin')) { $creds = array('user_login' => $user_login, 'user_password' => $user_pass, 'remember' => true); $user = wp_signon($creds); } $message = __('Registration complete.', 'popup-maker-ajax-login-modals'); if (!isset($_POST['user_pass'])) { $message .= ' ' . __('Please check your e-mail.', 'popup-maker-ajax-login-modals'); } $response = array('success' => true, 'message' => $message); } echo json_encode($response); die; }
public function fetch_register_user_id($fields) { if (popmake_get_popup_ajax_registration($_POST['popup_id'], 'enable_autologin')) { $creds = array('user_login' => $fields['username'], 'user_password' => $fields['password'], 'remember' => true); $user = wp_signon($creds); } }
function popmake_alm_ajax_registration_modal_shortcode($atts) { global $popmake_login_modal, $popmake_registration_modal, $popmake_recovery_modal, $user_email, $user_login; get_currentuserinfo(); $atts = shortcode_atts(array(), $atts); ob_start(); if (!is_multisite() && get_option('users_can_register') || in_array(get_site_option('registration'), array('all', 'blog', 'user'))) { $ajax_registration = popmake_get_popup_ajax_registration($popmake_registration_modal); include popmake_get_template_part('ajax-registration-form', null, false); } return ob_get_clean(); }
public function popup_data_attr($data_attr, $popup_id) { global $popmake_login_modal, $popmake_registration_modal, $popmake_recovery_modal; if (!in_array($popup_id, array($popmake_login_modal, $popmake_registration_modal, $popmake_recovery_modal))) { return $data_attr; } if ($popmake_login_modal == $popup_id) { $data_attr['meta']['ajax_login'] = popmake_get_popup_ajax_login($popup_id); if (popmake_get_popup_ajax_login($popup_id, 'force_login')) { $data_attr['meta']['close']['esc_press'] = false; $data_attr['meta']['close']['overlay_click'] = false; } } if ($popmake_registration_modal == $popup_id) { $data_attr['meta']['ajax_registration'] = popmake_get_popup_ajax_registration($popup_id); } if ($popmake_recovery_modal == $popup_id) { $data_attr['meta']['ajax_recovery'] = popmake_get_popup_ajax_recovery($popup_id); } return $data_attr; }
public function ajax_registration_override() { require_once WPPB_PLUGIN_DIR . '/front-end/class-formbuilder.php'; require_once WPPB_PLUGIN_DIR . '/front-end/register.php'; $register = wppb_front_end_register_handler(array()); $errors = $register->wppb_test_required_form_values($_REQUEST); ob_start(); echo $register; $form = ob_get_clean(); $response = array('success' => false); if (!empty($errors)) { $response['form'] = $form; } else { if (popmake_get_popup_ajax_registration($_POST['popup_id'], 'enable_autologin')) { $creds = array('user_login' => $_POST['username'], 'user_password' => $_POST['passw1'], 'remember' => true); $user = wp_signon($creds); } $response['success'] = true; } echo json_encode($response); die; }
function popmake_alm_footer_links($which = array()) { global $popmake_login_modal, $popmake_registration_modal, $popmake_recovery_modal; if (empty($which)) { return; } ob_start(); ?> <ul class='popmake-alm-footer-links'><?php foreach ($which as $key) { switch ($key) { case 'login': if (popmake_get_popup_ajax_login($popmake_login_modal, 'enabled')) { ?> <li><?php _e('Already have an account?', 'popup-maker-ajax-login-modals'); ?> <a href="<?php echo wp_login_url(); ?> " class="popmake-<?php echo $popmake_login_modal; ?> popswitch-login"><?php _e('Log in'); ?> </a></li><?php } break; case 'registration': $register = wp_register('', '', false); if (popmake_get_popup_ajax_registration($popmake_registration_modal, 'enabled') && !empty($register)) { ?> <li><?php _e('Don\'t have an account?', 'popup-maker-ajax-login-modals'); ?> <?php echo $register; ?> </li><?php } break; case 'recovery': if (popmake_get_popup_ajax_recovery($popmake_recovery_modal, 'enabled')) { ?> <li><?php _e('Lost your password?'); ?> <a href='<?php echo wp_lostpassword_url(); ?> ' class='popmake-<?php echo $popmake_recovery_modal; ?> popswitch-recovery'><?php _e('Click here', 'popup-maker-ajax-login-modals'); ?> </a></li><?php } break; } } do_action('popmake_alm_footer_links'); ?> </ul><?php return ob_get_clean(); }
public function registration_redirect_url($popup_id) { ?> <tr class="ajax_registration_enabled ajax_registration_redirect_enabled"> <th scope="row"> <label for="popup_ajax_registration_redirect_url"> <?php _e('Registration Redirect URL', 'popup-maker-ajax-login-modals'); ?> </label> </th> <td> <input type="text" class="regular-text" name="popup_ajax_registration_redirect_url" id="popup_ajax_registration_redirect_url" value="<?php esc_attr_e(popmake_get_popup_ajax_registration($popup_id, 'redirect_url')); ?> "/> <p class="description"><?php _e('If you want to redirect to another page after registration enter the url here. Leaving blank will keep user on the same page.', 'popup-maker-ajax-login-modals'); ?> </p> </td> </tr><?php }