WordPress.org

Ready to get started?Download WordPress

Forums

default user role (2 posts)

  1. donmatthew
    Member
    Posted 1 year ago #

    Hi everyone!

    By some reason I can't manage to change the default user role under settings -> general. Maybe because we're using a plugin named "User role editor" (where you also can set the default role, but it doesn't work)

    So what I'm trying to do here is to add an action to change the default role from author to contributor, but it still doesn't seem to work.

    add_action('user_register','set_default_user_role');
    
    function set_default_user_role($user_id){
            $user = new WP_User( $user_id );
            return $user->set_role( 'contributor' );
    }

    any ideas?

  2. bcworkz
    Member
    Posted 1 year ago #

    Try directly changing the value in the options table, it's under the key 'default_role', use phpMyAdmin if necessary.

    It's disconcerting you can't change this, are you logged in as administrator? Did someone accidentally change your capabilities? Can you change this if the plugin is deactivated? If it's really a plugin issue, I would think the author would like to know about it.

Topic Closed

This topic has been closed to new replies.

About this Topic