• Resolved sovrgn

    (@sovrgn)


    Hi there,

    I’ve set up the DB and test connected. In the plugin however, there are several error notices in the database table mapping, specifically “Notice: Undefined index: required in /wp-content/plugins/external-login/views/form_elements/text_field.php on line 18
    />” on salt, email, first name, last name and role.

    I have assigned ‘subscriber’ to the role, but it doesn’t seem to register.

    When logging in the debug throws a few errors, particular in regards to the vacant fields like role etc.

    some of the errors include the login/db.php lines 96 to 98 and login/authenticate.php on line 39, throwing ‘trying to get property ID of non-object.

    A bit stuck here as my PHP is a bit rusty.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter sovrgn

    (@sovrgn)

    An update:

    Somehow two of the 4 users have been added to the users page in WordPress. This seemed to happen after adding (WP_ALLOW_MULTISITE, true) and refreshing the page.

    Hasn’t worked since, as in it hasn’t added the new users, so I have my doubts.
    What seems to be the error is the notice for undefined index, assuming that it is not mapping the right meta?

    Plugin Author tbenyon

    (@tbenyon)

    Hey @sovrgn,

    I have never tested the plugin (or worked with) multisite before.

    I imagine this is what is causing the issues.

    I’m going to leave this ticket open but it’s to take a chunk of development work to start to support this as I’ll have to:

    • Read up on multisite – I’ve never used it before
    • Find what changes are required to actually make this work with multisite
    • Potentially add more settings to control how multisite setups should behave
    • Add documentation for this
    • Get my local docker setup to work with multisite
    • Allow my automated tests to turn this on and off for different tests

    Unfortunately this is not going to be a quick one as I have a full time job and this is an unpaid side project.

    I’ll keep you posted but as I’m sure you can understand, support for multisite will not be a feature you’re going to see this week.

    Thanks,

    Tom ??

    Thread Starter sovrgn

    (@sovrgn)

    Hey Tom, fully understand and appreciate the work you have put in already!

    I’ve created a new WP site, so I’ll test it out from vanilla. Should also be set up to the one WP account, although I have a multisite set up, the site where the plugin will work is on it’s own installation.

    Will update or close in a few days once I get through it.

    Thanks

    SOVRGN

    Plugin Author tbenyon

    (@tbenyon)

    That’d be awesome! Would be great to get that definite confirmation that it’s a multisite issue.

    Multisite compatibility has been requested before but it’s not a feature I’m looking forward to implementing ??

    Might be a nice idea to detect it in the admin area and write a warning message that it is not supported. Will try and do that with the next release.

    I’ll await your confirmation before I mark this as resolved.

    Thanks SOVRGN,

    Tom

    Thread Starter sovrgn

    (@sovrgn)

    I’ve got it working.

    Pulls the users through to the WP db. What happens if someone resets their password from the profile page? Does it update the hash/salt on the external DB?

    Seems to be running fine, not really ‘multisite’ now as I have it on a subdomain and on sole WP installation.

    • This reply was modified 4 years, 5 months ago by sovrgn.
    Thread Starter sovrgn

    (@sovrgn)

    .

    Plugin Author tbenyon

    (@tbenyon)

    Hey @sovrgn,

    Nice one for getting it working ??

    Looks like it is a multisite issue.

    What happens if someone resets their password from the profile page? Does it update the hash/salt on the external DB?

    No. The system is designed for users who have an external system that is their ‘main source of truth’. The plugin just reads the latest data from there. One solution is to disable this feature for users or instead have the button redirect them to your other system.

    I did start to look at this as a feature but it is not currently available.

    This can be achieved however. In the WordPress hook that updates the database you could write a simple query to update the field.

    You can even use the External Login plugin tools to access the data required for the connection. If you look in the FAQ for the details on available hooks you’ll see an example shown for the exlog_hook_action_authenticated hook. It uses External Login to create a connection and delete a user from the external table when they are authenticated.

    
      // Uses the data provided to the plugin to create the database object and data required for a query
      $db_data = exlog_get_external_db_instance_and_fields('mysql');
    
      // A query of your choice
      $rows = $db_data["db_instance"]->delete(
        esc_sql($db_data["dbstructure_table"]),
        array( esc_sql($db_data["dbstructure_username"]) => esc_sql($exlog_user_data['user_login']) )
      );
    
      // Checking if the user was deleted
      if ($rows) {
        error_log('User Successfully deleted from external database');
      } else {
        error_log('Unable to delete user from external database');
      }
    

    You could do something similar in the update password hook that updates the database with a new password hash.

    Does this help?

    Thread Starter sovrgn

    (@sovrgn)

    Hi Tom,

    I did some testing and saw that it didn’t update.

    yes it does. I was thinking along the same lines however I like your idea behind the redirect. I’m glad it’s opensource, this means it can be customised without *hopefully* breaking.

    Will work out some other details, but this plugin looks to be about just right!

    Regards,

    SOVRGN

    Plugin Author tbenyon

    (@tbenyon)

    Awesome – if I ever support the feature in the plugin I’ll try and remember to come back and let you know on the off chance you’d rather the plugin handle all the logic.

    I’m glad the plugin is useful for you.

    If it all works I’d be grateful if you could write a review or even buy me a beer.

    Thanks again, and feel free to get back in contact if I can be of any further assistance.

    Tom ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Unable to Login Users’ is closed to new replies.