<fieldset> <label><?php _e('Your account', 'gam-event-manager'); ?> </label> <div class="field account-sign-in"> <?php $user = wp_get_current_user(); printf(__('You are currently signed in as <strong>%s</strong>.', 'gam-event-manager'), $user->user_login); ?> <a class="button" href="<?php echo apply_filters('submit_event_form_logout_url', wp_logout_url(get_permalink())); ?> "><?php _e('Sign out', 'gam-event-manager'); ?> </a> </div> </fieldset> <?php } else { $account_required = event_manager_user_requires_account(); $registration_enabled = event_manager_enable_registration(); $generate_username_from_email = event_manager_generate_username_from_email(); ?> <fieldset> <label><?php _e('Have an account?', 'gam-event-manager'); ?>
/** * Submit Step is posted */ public function submit_handler() { try { // Init fields $this->init_fields(); // Get posted values $values = $this->get_posted_fields(); if (empty($_POST['submit_event'])) { return; } // Validate required if (is_wp_error($return = $this->validate_fields($values))) { throw new Exception($return->get_error_message()); } // Account creation if (!is_user_logged_in()) { $create_account = false; if (event_manager_enable_registration()) { if (event_manager_user_requires_account()) { if (!event_manager_generate_username_from_email() && empty($_POST['create_account_username'])) { throw new Exception(__('Please enter a username.', 'gam-event-manager')); } if (empty($_POST['create_account_email'])) { throw new Exception(__('Please enter your email address.', 'gam-event-manager')); } } if (!empty($_POST['create_account_email'])) { $create_account = gam_event_manager_create_account(array('username' => empty($_POST['create_account_username']) ? '' : $_POST['create_account_username'], 'email' => $_POST['create_account_email'], 'role' => get_option('event_manager_registration_role'))); } } if (is_wp_error($create_account)) { throw new Exception($create_account->get_error_message()); } } if (event_manager_user_requires_account() && !is_user_logged_in()) { throw new Exception(__('You must be signed in to post a new listing.')); } // Update the event $this->save_event($values['event']['event_title'], $values['event']['event_description'], $this->event_id ? '' : 'preview', $values); $this->update_event_data($values); // Successful, show next step $this->step++; } catch (Exception $e) { $this->add_error($e->getMessage()); return; } }
extract($args); } $username = sanitize_user($username); $email = apply_filters('user_registration_email', sanitize_email($email)); if (empty($email)) { return new WP_Error('validation-error', __('Invalid email address.', 'gam-event-manager')); } if (empty($username)) { $username = sanitize_user(current(explode('@', $email))); } if (!is_email($email)) {