• Hi,

    I’m customising a theme for a client and they require the user to login via the user’s url (user_url). I have tried using the get_user_by( ‘url’ ) but i cant seem to get it to work.

    Can anyone help, it would be appreciated.

    Stephen

Viewing 3 replies - 1 through 3 (of 3 total)
  • I guess you are trying for implementing an AJAX login.

    If I am right, then here is a good tutorial > https://natko.com/wordpress-ajax-login-without-a-plugin-the-right-way/

    Thread Starter sasherwood93

    (@sasherwood93)

    Hi,

    It’s not ajax unfortunately. It’s a function based in the theme’s functions to authenticate the user’s login details i.e $username & $password. I’m looking for the username to be equal to the user’s website url set in the user’s profile.

    Example: Client Login > Domain = www.remarpro.com; Password = WordPress;

    But thanks for the quick reply.

    Thread Starter sasherwood93

    (@sasherwood93)

    The code I’m attempting to use is as follows:

    add_action( 'wp_authenticate', 'user_url_login' );
    
    function user_url_login( $user, &$username, &$password )
    {
        $user = get_user_by ('email', $username );
    
        if( !empty( $user->user_url ) )
        {
            $username = $user->user_url;
        }
    }

    also want it so user dont have to type https://(www.remarpro.com) just (www.remarpro.com)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Login to site via url instead of username or email’ is closed to new replies.