wp_authenticate example


function wp_login($username$password$deprecated = '') {
    _deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' );
    global $error;

    $user = wp_authenticate($username$password);

    if ( ! is_wp_error($user) )
        return true;

    $error = $user->get_error_message();
    return false;
}
else :
    _deprecated_function( 'wp_login', '2.5.0', 'wp_signon()' );
endif;


function user_pass_ok($user_login$user_pass) {
    _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
    $user = wp_authenticate( $user_login$user_pass );
    if ( is_wp_error( $user ) )
        return false;

    return true;
}

/** * Callback formerly fired on the save_post hook. No longer needed. * * @since 2.3.0 * @deprecated 3.5.0 */

    $secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie$credentials );

    global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie().     $auth_secure_cookie = $secure_cookie;

    add_filter( 'authenticate', 'wp_authenticate_cookie', 30, 3 );

    $user = wp_authenticate( $credentials['user_login']$credentials['user_password'] );

    if ( is_wp_error( $user ) ) {
        return $user;
    }

    wp_set_auth_cookie( $user->ID, $credentials['remember']$secure_cookie );
    /** * Fires after the user has successfully logged in. * * @since 1.5.0 * * @param string $user_login Username. * @param WP_User $user WP_User object of the logged-in user. */

    public function login( $username$password ) {
        if ( ! $this->is_enabled ) {
            $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
            return false;
        }

        if ( $this->auth_failed ) {
            $user = new WP_Error( 'login_prevented' );
        } else {
            $user = wp_authenticate( $username$password );
        }

        if ( is_wp_error( $user ) ) {
            $this->error = new IXR_Error( 403, __( 'Incorrect username or password.' ) );

            // Flag that authentication has failed once on this wp_xmlrpc_server instance.             $this->auth_failed = true;

            /** * Filters the XML-RPC user login error message. * * @since 3.5.0 * * @param IXR_Error $error The XML-RPC error message. * @param WP_Error $user WP_Error object. */
Home | Imprint | This part of the site doesn't use cookies.