WordPress.org

Forums

Google Authenticator
[resolved] Deprecated function "get_userdatabylogin" (4 posts)

  1. Mortanius
    Member
    Posted 2 years ago #

    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/

  2. Henrik Schack
    Member
    Plugin Author

    Posted 2 years ago #

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

    Best regards
    Henrik Schack

  3. Mortanius
    Member
    Posted 2 years ago #

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

    Kind regards,

    Steven

  4. Fırat Akandere
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Authenticator
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic