Support » Plugin: Google Authenticator » Deprecated function "get_userdatabylogin"

  • Resolved Mortanius

    (@mortanius)


    Hi Henrik Schack,

    Firstly thank you for the excellent plugin. I wanted to report a small error I found and a fix. I discovered the notice because I was working on some styling for the login screen and I installed your plugin on my dev environment to see how the styles looked with a third field on the login screen.

    The error message:
    Notice: get_userdatabylogin is deprecated since version 3.3! Use get_user_by(‘login’) instead. in D:\wamp\www\wordpress\wp-includes\functions.php on line 2841

    The problem:
    Line 171: $user = get_userdatabylogin( $username );

    Replace with:
    Line 171: $user = get_user_by(‘login’, $username );

    Hope that helps, thanks again for the awesome plugin!

    Thanks,

    Steven

    http://wordpress.org/extend/plugins/google-authenticator/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Henrik Schack

    (@henrikschack)

    Hi Mortanius
    Thanks a lot, I’ll add that to the next version

    Best regards
    Henrik Schack

    Glad to help, thanks again for your work on the plugin.

    Kind regards,

    Steven

    Also line 174;

    if ( trim(get_user_option( 'googleauthenticator_enabled', $user->ID ) ) == 'enabled' ) {

    Should be replaced with:

    if ( isset( $user->ID ) && trim(get_user_option( 'googleauthenticator_enabled', $user->ID ) ) == 'enabled' ) {

    Otherwise, it throws a notice error that the line is trying to get property of non-object on login screen since the get_user_by function return boolean(false) when the user is not logged in.

    Thanks,
    Fırat

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Deprecated function "get_userdatabylogin"’ is closed to new replies.