WordPress.org

Ready to get started?Download WordPress

Codex

Plugin API/Action Reference/wp authenticate

Description

This action is located inside of wp_signon. In contrast to the wp_login action, it is executed before the WordPress authentication process.

Location

Located in /wp-includes/user.php.

Example

You can use wp_authenticate to use a custom login mechanism before you involve WordPress.

add_action('wp_authenticate','check_custom_authentication');

function check_custom_authentication($username) {
        global $wpdb;

     	if(!username_exists($username)) {
		return;
	}
        $userinfo = get_user_by('login', $username);
        $property = $wpdb->prefix."capabilities";
        $caps = $userinfo->$property;
        foreach($caps as $role) {
              if($role=='special_authenticator') {
                    wpExternalLoginProcess($username,$_POST['pwd']);
              }
        }
}
This page is marked as incomplete. You can help Codex by expanding it.