• Resolved the_lar

    (@the_lar)


    Hi,

    Quick question, I’m using TML for users to register but I need them to be able to create posts, so I want them to be authors and not subscribers. I have activation turned on so they are pending to begin with, but subsequently I need their role to go to author. Seems the default behaviour is ‘subscriber’ but is there any way to change this? I’ve tried this function:

    
    add_action('tml_new_user_registered', '\Bbc\set_user_to_author');
    function set_user_to_author($userID){
      $u = new \WP_User($userID);
      $u->remove_role('subscriber');
      $u->add_role('author');
      return;
    }
    

    But it doesn’t seem to work.

    Much appreciated
    Kevin

    • This topic was modified 7 years, 1 month ago by the_lar.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Set registrants as authors?’ is closed to new replies.