• Resolved carlosvai

    (@carlosvai)


    Hi! I had a very strange problem.
    Today, I was creating a test user from a mobile phone. Everything went fine, but in the WP dashboard I could no longer see the anything admin related.

    I went to the database to realize that my main admin user had changed its wp_user_role from 10 to 0. Changed back to 10 and everything was working fine again.

    A couple of things to note.
    1) My site has hundreds of users, and every day about 3 new accounts are created, never had a problem.
    2) I did not make any update of plugins or anything prior to this event.
    3) I’m using a snippet (since about 3 months, nothing new) to avoid admin login in frontend.

    add_action( 'um_submit_form_errors_hook_login', 'custom_submit_form_errors_hook_login', 10, 1 );
    
    function custom_submit_form_errors_hook_login( $args ) {
    
        if ( UM()->user()->get_role() == 'administrator' ) {
            UM()->form()->add_error( 'user_email', __( 'Restricted area ??', 'ultimate-member' ) );
        }
    }

    To be honest I can not tell 100% sure if this was a UM problem, but since the problem happened in the exact same time when I was creating a user I need to start from here.

    Wp version 6.3.1
    UM version 2.6.10

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support andrewshu

    (@andrewshu)

    Hello @carlosvai

    Could you reproduce this issue again? I recommend you to create a database backup before this.

    Regards.

    Thread Starter carlosvai

    (@carlosvai)

    Hi @andrewshu
    Unfortunately, I can’t (yet). I made a couple more users, but this did not happen again.
    I can add some more information, though.

    Besides the wp_user_role changed spontaneously to 0, there was a strange change in the wp_capabilities row.

    Before the issue, the value was
    a:2:{s:13:"administrator";b:1;s:16:"um_administrador";b:1;}
    After the issue it was
    a:2:{s:16:"um_administrador";b:1;s:10:"um_usuario";b:1;}

    Just in case, I changed it to the original WP value which is
    a:1:{s:13:"administrator";s:1:"1";}

    Not sure if that changed “because” of the wp_user_role value change, or if that was the cause.

    I’ll keep investigating since I don’t want this to happen again, or even worse, give someone else admin privileges.

    Thanks!

    Plugin Support andrewshu

    (@andrewshu)

    Hello @carlosvai

    This is strange. THe UM doesn’t use the “um_administrador” name. Also, I can’t reproduce this issue on my site.

    Please, let me know if you will find new details.

    Regards.

    Thread Starter carlosvai

    (@carlosvai)

    @andrewshu Thanks for your answer.
    The um_administrator was created by me long time ago, um_usuario too.
    It’s like the plugin assigned both roles and removed the default “administrator”.

    Anyway, I’m still investigating this issue in the main WP forum.
    If I find something out, I will share it here.

    Thanks again!

    Plugin Support andrewshu

    (@andrewshu)

    Hi @carlosvai

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. ??

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_user_role of Admin changed to 0’ is closed to new replies.