Open sisaacrussell opened 7 months ago
I haven't looked into this properly yet, but I could not reproduce it with:
wp plugin install user-switching --activate
wp autologin-urls get-url 3
Success: http://localhost:8080/bh-wp-autologin-urls/?autologin=3~5zvco5ujlHL0
... when I visited that URL it worked as expected.
I'll take a deeper look soon (I haven't actually looked into those functions named in that stacktrace yet).
I think the correct fix for this is in the johnbillion/user-switching repo.
The login in this plugin occurs on the determine_current_user
action, which runs before plugins_loaded
, and fires the wp_login
action.
The user-switching plugin listens for wp-login
, user-switching.php#L1292-L1299, and checks for its cookie, user-switching.php#L1357-L1367, but the constants are defined on a function which doesn't run until plugins_loaded
, user-switching.php#L93-L113
I don't think there's any good reason to defer defining those constants until plugins_loaded
. Let me think about this for another couple of days and I'll open an issue in that repo.
Edit: related issue: https://github.com/johnbillion/user-switching/issues/40
Some discussion/progress on this issue: https://github.com/johnbillion/user-switching/issues/115
Bug Report
Testing this plugin on a site with the User Switching plugin installed throws the following error when visiting a link with the autologin enabled:
Refreshing the page once after receiving the error will then load the page with the user logged in. Auto-login works as expected without the User Switching plugin active.
Issue also raised on WP.org Support tab