• Resolved chuckmo

    (@chuckmo)


    Hello!

    First off, wonderful plugin and thank you for how active/responsive you are. Several beers coming your way from me.

    In my situation, our external database doesn’t have the concept of usernames, so I had hoped to match the external user by email. As far as I can tell, the plugin doesn’t support this, but I’ve found that by editing line 38 in login/authenticate.php to use “email” instead of “login”, I’m able to make it work just fine as long as I am specifying the external email column as the username column in my plugin settings.

    Could this be supported natively by the plugin without requiring my manual edit?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author tbenyon

    (@tbenyon)

    Hey @chuckmo,

    I really appreciate the beers ??

    You’ve actually inspired me to go out later for a pint so much appreciated.

    Before we look at this solution, can you lie to the plugin for me . . .

    In the field mappings, can you tell the plugin that the your email field is both the username and the password.

    I think this will solve your problem ??

    If not, get back to me ??

    Plugin Author tbenyon

    (@tbenyon)

    Hey @chuckmo,

    Just checking in to see if that resolved your issue?

    Thanks,

    Tom ??

    Plugin Author tbenyon

    (@tbenyon)

    Hey @chuckmo,

    I haven’t heard back so I’m going to mark this issue as resolved.

    If this is not the case, please don’t hesitate to get back in contact.

    Thanks,

    Tom ??

    Thread Starter chuckmo

    (@chuckmo)

    Totally spaced on this, sorry for not catching your reply!

    The issue is on the WP side, not the External DB side. The method I referred to is WP’s specifying to match the local user by login, whereas I need it to reference the email field on the WP user. I’m already doing what you suggested in terms of mapping the external DB email column to both email and username locally.

    Plugin Author tbenyon

    (@tbenyon)

    Hey @chuckmo,

    No need to apologise ??

    I think I understand what you mean. I presume you’re talking about this line:
    $user = $userobj->get_data_by('login', $response['wp_user_data']['username']);
    …which I think in your case you find fixes your issue if you change it to the following…
    $user = $userobj->get_data_by('email', $response['wp_user_data']['username']);.

    I am surprised this doesn’t work as already I would expect searching by ‘login’ to be the username would also work as $response['wp_user_data']['username'] should have been set to be the e-mail and $userobj->get_data_by('login' would be looking for the username which would be an e-mail address.

    To be honest I’m not sure I’m going to have time to look at this at the weekend so it may be the following one.

    Does that work for your are you in desperate need of this?

    Thanks,

    Tom ??

    Thread Starter chuckmo

    (@chuckmo)

    That is no problem at all. I’ve fixed it manually for the moment, so there is no rush. Just want to make sure future updates won’t require me to make the modification by hand each time.

    Thank you much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Feature request: Match external user by email instead of username’ is closed to new replies.