/**
  * Login Form Shortcode
  */
 public function wpaam_login_form($atts, $content = null)
 {
     extract(shortcode_atts(array('id' => '', 'label_username' => '', 'label_password' => '', 'label_remember' => '', 'label_log_in' => '', 'login_link' => '', 'psw_link' => '', 'register_link' => ''), $atts));
     // Set default values if options missing
     if (empty($id)) {
         $id = 'wpaam_loginform';
     }
     if (empty($label_username)) {
         $label_username = wpaam_get_username_label();
     }
     if (empty($label_password)) {
         $label_password = __('Password', 'wpaam');
     }
     if (empty($label_remember)) {
         $label_remember = __('Remember Me', 'wpaam');
     }
     if (empty($label_log_in)) {
         $label_log_in = __('Login', 'wpaam');
     }
     $args = array('echo' => true, 'redirect' => wpaam_get_login_redirect_url(), 'form_id' => esc_attr($id), 'label_username' => esc_attr($label_username), 'label_password' => esc_attr($label_password), 'label_remember' => esc_attr($label_remember), 'label_log_in' => esc_attr($label_log_in), 'id_username' => esc_attr($id) . 'user_login', 'id_password' => esc_attr($id) . 'user_pass', 'id_remember' => esc_attr($id) . 'rememberme', 'id_submit' => esc_attr($id) . 'wp-submit', 'login_link' => esc_attr($login_link), 'psw_link' => esc_attr($psw_link), 'register_link' => esc_attr($register_link));
     ob_start();
     // Show already logged in message
     if (is_user_logged_in()) {
         get_wpaam_template('already-logged-in.php', array('args' => $args, 'atts' => $atts));
         // Show login form if not logged in
     } else {
         get_wpaam_template('forms/login-form.php', array('args' => $args, 'atts' => $atts));
         // Display helper links
         do_action('wpaam_do_helper_links', $login_link, $register_link, $psw_link);
     }
     $output = ob_get_clean();
     return $output;
 }
Exemple #2
0
 /**
  * Display login form.
  *
  * @since 1.0.0
  * @access public
  * @return string
  */
 function wpaam_login_form($args = array())
 {
     $defaults = array('echo' => true, 'redirect' => wpaam_get_login_redirect_url(), 'form_id' => null, 'label_username' => wpaam_get_username_label(), 'label_password' => __('Password', 'wpaam'), 'label_remember' => __('Remember Me', 'wpaam'), 'label_log_in' => __('Login', 'wpaam'), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'login_link' => 'yes', 'psw_link' => 'yes', 'register_link' => 'yes');
     // Parse incoming $args into an array and merge it with $defaults
     $args = wp_parse_args($args, $defaults);
     // Show already logged in message
     if (is_user_logged_in()) {
         get_wpaam_template('already-logged-in.php', array('args' => $args));
         // Show login form if not logged in
     } else {
         get_wpaam_template('forms/login-form.php', array('args' => $args));
         // Display helper links
         do_action('wpaam_do_helper_links', $args['login_link'], $args['register_link'], $args['psw_link']);
     }
 }