tbenyon
Forum Replies Created
-
Forum: Plugins
In reply to: [External Login] Pulling additional dataHey @sovrgn,
If you’re not sure what data is coming through, my suggestion is that you start by logging the data you are receiving.
Below I have added three lines of logs, two of which are just to help you find the results more easily in the log file.
function get_player_data($wp_user, $exlog_user_data) { error_log(‘-------------EXLOG-START------------------’); error_log(var_export($exlog_user_data, true)); $updated = update_user_meta( $wp_user, ‘lws_woovirtualwallet_amount’, $exlog_user_data[‘tokenscore’] ); // Checking if added ok if ($updated) { error_log(‘Additional field added’); } else { error_log(‘Unable to add additional field’); } error_log(‘-------------EXLOG-END------------------’); } add_action(‘exlog_hook_action_authenticated’, ‘get_player_data’, 10, 2);It is worth noting that
$exlog_user_datawill pull all fields that are in the users table you setup in the settings and not additional tables.Start by checking the error logs and let me know if you see what you expected.
Thanks,
Tom
Forum: Plugins
In reply to: [External Login] Unable to Login UsersAwesome – 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 🙂
Forum: Plugins
In reply to: [External Login] Unable to Login UsersHey @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_authenticatedhook. 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?
Forum: Plugins
In reply to: [External Login] Unable to Login UsersThat’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
Forum: Plugins
In reply to: [External Login] After authenticate first time gives wrong password!Awesome! Much appreciated @abufaris.
Good luck with your investigation!
Forum: Plugins
In reply to: [External Login] Unable to Login UsersHey @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 🙂
Forum: Plugins
In reply to: [External Login] 502 errorHey @rafcioyt,
I haven’t heard back so I’m going to assume this is resolved.
If this is not the case, please feel free to message back and we can talk more.
Thanks,
Tom
Forum: Plugins
In reply to: [External Login] After authenticate first time gives wrong password!Yeah – I wouldn’t expect the sleep to work but worth a try.
As we think this is a compatibility issue with another plugin you’re using I’m going to mark this as resolved as it’s not an issue with this plugin.
However, if anything leads you to believe this is not the case or if you have other thoughts or questions you want to discuss, please feel free to message back here 🙂
Thanks,
Tom
Forum: Plugins
In reply to: [External Login] Error 500 when testing connectionHey @sovrgn,
That’s great news! Thanks for getting back to me to let me know how you got on and well done for sorting it! 🙂
If it is all working now I’d be grateful if you could write a review or even buy me a beer.
Thanks again,
Tom 🙂
Forum: Plugins
In reply to: [External Login] After authenticate first time gives wrong password!No worries, had a quick look into the plugin.
The External Login plugin uses WordPress’
authenticatehook change how the username and password are validated in the plugin.
add_filter('authenticate', 'exlog_auth', 10, 3);It appears that Ultimate Member also use this hook in this line of code:
add_filter( 'authenticate', 'um_wp_form_errors_hook_ip_test', 10, 3 );The
10shown in both is the priority in which these should be called. Because they are the same, and hearing the experience you are getting, I imagine that the other plugin is winning the race.However, I speculate that if you changed the value to a
9in the External Login plugin, you may find this solves your problem.HOWEVER, I would strongly encourage you to test this fully as I do not know what other checks are happening.
If you did want to try this and see if it fixes your issue, you can make this change in the following file in the plugin:
external_login/login/authenticate.phpIf this does work for you, I could add a tweak to my code that allows you to specify the priority number. I wouldn’t want to change the value for everyone as it may be that it being set to 10 is what is making it work for other users different plugins.
If you do a test and it works let me know 🙂
Thanks,
Tom
Forum: Plugins
In reply to: [External Login] Error 500 when testing connectionHey @sovrgn,
This is frustrating – sorry to hear you’ve hit this hurdle.
The best place to be looking at for errors is probably the database server, but if not, checking the PHP error logs for your WordPress install may also shed some light.
I’m presuming this is while you’re using the ‘Test Connection’ button?
If you wanted to add additional logs, you could add them to the
exlog_test_query()function inexternal_login/login/db.php.I would be very surprised if this is an issue with the plugin itself but if you have more questions I’m happy to do what I can to help you debug this.
Either way – keep me posted, I’m sure we’ll get there 🙂
Forum: Plugins
In reply to: [External Login] After authenticate first time gives wrong password!Hey @abufaris,
This appears to be working fine on my local installation. I’ve just tested twice by setting the hashing type to none, creating a new user in the external database and logging in.
Both times I was logged straight in and the new user was created.
I don’t know what the Ultimate Member plugin does, but your first step to debugging would be to disable all your other plugins and see if this then works for you.
Let me know how you get on with this.
Thanks,
Tom 🙂
Forum: Plugins
In reply to: [External Login] Feature RequestsIf you’re happy with this solution – I think it is the best route. It adds complete flexibility for all use cases.
If this becomes a popular request I can re-evaluate.
Really glad the plugins working for you 🙂
If you have time, I’d be grateful if you could write a review or even buy me a beer.
Thanks and good luck with your project 🙂
Forum: Plugins
In reply to: [External Login] Feature RequestsHey Chris,
Apologies I misread your first message!
I could do a reverse of it I guess, it could be a toggle that let you use the fields to exclude OR include.
The problem is I can then see people wanting to say – include these but exclude those which is where things can get progressively messy and not easy for the average user. Just typing thoughts out loud but always welcome feedback and thoughts on how you see this working.
This can already be achieved with the hook I mentioned earlier. Note that the plugin blocks the user if it returns
true. Therefore in this case if theiridis not4, block them.function myExlogCustomExcluder($userData) { return $userData['id'] != 4; } add_filter('exlog_hook_filter_custom_should_exclude', 'myExlogCustomExcluder', 10, 1);If you’re not familiar with where to put this code this plugin may be of use:
https://en-gb.wordpress.org/plugins/code-snippets/Forum: Plugins
In reply to: [External Login] Feature RequestsHey @chriswebb2001,
This feature already exists. It’s the last block in the settings page.
Additionally if you need more complex logic for excluding users, check out the FAQ for the question regarding which hooks are available and see the ‘exlog_hook_filter_custom_should_exclude’ hook.
Let me know if this solves your issue or if you have any more questions 😊
Tom