Logging in resets role to "Editor" instead of "Administrator" or "Shop Manager"
-
@d19dotca actually, since you narrowed the behavior down to https://github.com/heiglandreas/authLdap/commit/a175571fb95f4e33128bd48d322438f78e440e7 , that bit of code depends on
wp_capabilities
. Maybe that's what is different in both the instances.I think
SELECT meta_key, meta_value FROM wp_usermeta WHERE meta_key = 'wp_capabilities'
. From a casual reading, it seems that if it's not an array, the behavior has changed. -
@girish said in Logging in resets role to "Editor" instead of "Administrator" or "Shop Manager":
SELECT meta_key, meta_value FROM wp_usermeta WHERE meta_key = 'wp_capabilities'
Good idea! To be honest though I'm just guessing that's the change responsible for the change in behaviour, I'm not 100% certain.
Working site:
mysql> SELECT meta_key, meta_value FROM wp_usermeta WHERE meta_key = 'wp_capabilities'; +-----------------+---------------------------------+ | meta_key | meta_value | +-----------------+---------------------------------+ | wp_capabilities | a:1:{s:13:"administrator";b:1;} | +-----------------+---------------------------------+ 1 row in set (0.00 sec)
Non-working site:
mysql> SELECT meta_key, meta_value FROM wp_usermeta WHERE meta_key = 'wp_capabilities'; +-----------------+---------------------------------+ | meta_key | meta_value | +-----------------+---------------------------------+ | wp_capabilities | a:1:{s:13:"administrator";b:1;} | | wp_capabilities | a:1:{s:8:"customer";b:1;} | | wp_capabilities | a:1:{s:12:"shop_manager";b:1;} | | wp_capabilities | a:1:{s:8:"customer";b:1;} | | wp_capabilities | a:1:{s:8:"customer";b:1;} | | wp_capabilities | a:1:{s:8:"customer";b:1;} | | wp_capabilities | a:1:{s:8:"customer";b:1;} | | wp_capabilities | a:1:{s:8:"customer";b:1;} | | wp_capabilities | a:1:{s:8:"customer";b:1;} | +-----------------+---------------------------------+ 9 rows in set (0.00 sec)
Now the administrator role at top of both is my account, and the value seems identical in them.
-
@girish Okay, I was able to manually update the plugin in about 12+ sites without issues, they were non-Woocommerce sites. On every WooCommerce site I manage (4 of them), I ran into the same issue as originally reported.
So I guess the crux of the issue isn't necessarily the plugin all on it's own which may be why it works for some and not others... it's a combination of the plugin's code change plus something to do with WooCommerce, though I have no idea what that'd be exactly. There's other roles added in WooCommerce but that only touches newer users etc, not my original administrator account for example. Very strange.
I guess I may need to just report this upstream.
-
@girish @fbartels @marcusquinn - I just filed an issue in GitHub for the AuthLDAP plugin here, please feel free to add your thoughts or subscribe to it if you'd like updates as well: https://github.com/heiglandreas/authLdap/issues/221
-
@d19dotca thanks for opening the issue. I can confirm that i see this behaviour on my two WordPress installs (one prod one testing) which also has woocommerce installed. Since these websites are not really in production yet i have not tried to dig deeper into it (and everybody trying to login as admin also has cli access to easily upgrade their account again).
In my test it felt like the role was changed a bit after the actual login. E.g. i notice i am not and admin, i change the role of the account, i try again the next day and am only an editor again.
-
-