• Resolved fredyms

    (@fredyms)


    I need to insert abot 200 new roles there is a way via SQL or php to insert a list of roles in bulk mode (not one by one)

    thanks in advance

    • This topic was modified 1 year, 10 months ago by fredyms.
    • This topic was modified 1 year, 10 months ago by fredyms.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Caseproof

    (@caseproof)

    Hi @fredyms

    I don’t know a plugin that allows you to add 200 new roles in bulk, but you can install Code Snippets plugin and run PHP code snippet similar to the one below once. This code will loop over roles in the array and add multiple roles with the same capabilities as Subscriber role:

    $roles = array(
        'basic' => 'Basic',
        'professional' => 'Professional',
        'advanced' => 'Advanced'
    );
    foreach( $roles as $role_name => $display_name ) {
        add_role( $role_name, $display_name, get_role( 'subscriber' )->capabilities );
    }

    I hope that helps.

    Thread Starter fredyms

    (@fredyms)

    Hi, thank you, it worked perfectly, the name of the role has completed ok, but the profile instead of role has put a sequential number.

    I would like the role field to be filled in with the same name as the role name.

    but it works and solved the problem.

    thank you very much for your support

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘insert profiles via SQL’ is closed to new replies.