0

do anybody know this kind of phenomenon? I do not have any user managing plugins installed in my WP, but after some interaction e.g. editing pages or creating postings (its not matter) WP changes for my logged in user the role from Administrator to Author. It already happens few times. I do also not know where to start with the root cause analysis. I will be happy for any kind of information which helps me to go the right direction. Thanks.

2
  • 1
    Can you edit your question and add the list of the plugins you have on your website ? You should start with removing all the plugins and see what happens. (By any chance, dont you have Authorizer activated ?).
    – PhpDoe
    Oct 1, 2023 at 11:30
  • 1
    I'd stick error_log() trace into any function that sets or changes role, or just everything set or update in the WP_User class, and the add/update/delete_user_meta functions too.
    – Rup
    Oct 1, 2023 at 12:26

1 Answer 1

0

sorry but do not have enough reputation on stackoverflow to add a comment under yours. So my reply then here.

I can list all my plugins but how I should reproduce it, because it happens randomly. And how should I put a error_log() in each function? I do not have the "Autorizer" so this should not be the issue.

I somewhere a general error log of WP to have a look on? I do not now where to start with the analysis. The deactive each plugin not helps, because I not know in which activity this role changing happening.

3
  • 1
    Did you write the question? You would have permission to comment if you logged in with that account.
    – Rup
    Oct 1, 2023 at 15:36
  • 1
    error_log() e.g. open wp-includes/user.php, find "function update_user_meta" which is line 1196 for me, and then inside the function braces add two lines error_log("update_user_meta user_id=$user_id meta_key=$meta_key meta_value=".print_r($meta_value,true)); and error_log(print_r(debug_backtrace(), true));. Then when it goes wrong look at your server error log for any update_user_meta calls that changed 'role'.
    – Rup
    Oct 1, 2023 at 15:50
  • Yes i am. I was not able to reach my old account. I will test your approach and will give an update. Thanks for the hint.
    – devreklim
    Oct 3, 2023 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.