• LifterLMS
  • Knowledge Base
  • Academy
  • Blog
  • Podcast
  • Contributors

LifterLMS LifterLMS

Code Reference

  • Home
  • Code Reference
Skip to content
Filter by type:
Search
Browse: Home / Code Reference / Classes / LLMS_Controller_Login

LLMS_Controller_Login

User Login Form Controller

Contents

  • Description
    • Source
    • Changelog
  • Methods
  • User Contributed Notes

Description #Description


Source #Source

File: includes/forms/controllers/class.llms.controller.login.php

class LLMS_Controller_Login {

	/**
	 * Constructor
	 * @since    3.19.4
	 * @version  3.19.4
	 */
	public function __construct() {

		add_action( 'init', array( $this, 'login' ) );

	}

	/**
	 * Handle Login Form Submission
	 * @return   void
	 * @since    1.0.0
	 * @version  3.19.4
	 */
	public function login() {

		if ( ! llms_verify_nonce( '_llms_login_user_nonce', 'llms_login_user' ) ) {
			return;
		}

		$login = LLMS_Person_Handler::login( $_POST );

		// validation or login issues
		if ( is_wp_error( $login ) ) {
			foreach ( $login->get_error_messages() as $msg ) {
				llms_add_notice( $msg, 'error' );
			}
			return;
		}

		$redirect = isset( $_POST['redirect'] ) ? $_POST['redirect'] : get_permalink( llms_get_page_id( 'myaccount' ) );

		llms_redirect_and_exit( apply_filters( 'lifterlms_login_redirect', $redirect, $login ) );

	}

}

Expand full source code Collapse full source code View on GitHub


Top ↑

Changelog #Changelog

Changelog
Version Description
3.19.4 Introduced.

Top ↑

Methods #Methods

  • __construct — Constructor
  • login — Handle Login Form Submission

Top ↑

User Contributed Notes #User Contributed Notes

You must log in before being able to contribute a note or feedback.

© 2014 - 2019 LifterLMS · Privacy Policy · Terms and Conditions