LLMS_Frontend_Password::check_password_reset_key( $key,  $login )

Checks the password reset key


Description Description


Return Return

(string) $user


Top ↑

Source Source

File: includes/forms/frontend/class.llms.frontend.password.php

	public static function check_password_reset_key( $key, $login ) {
		global $lifterlms,$wpdb;

		$key = preg_replace( '/[^a-z0-9]/i', '', $key );

		if ( empty( $key ) || ! is_string( $key ) ) {

			llms_add_notice( __( 'Invalid key', 'lifterlms' ), 'error' );
			return false;

		}

		if ( empty( $login ) || ! is_string( $login ) ) {

			llms_add_notice( __( 'Invalid key', 'lifterlms' ), 'error' );
			return false;

		}

		$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login ) );

		if ( empty( $user ) ) {

			llms_add_notice( __( 'Invalid key', 'lifterlms' ), 'error' );
			return false;

		}

		return $user;
	}


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: