Viewing 2 reply threads
  • Author
    Posts
    • #1711
      achowell
      Member

      I was wondering if I can include a function for adding roles into my Piklist plugin file? I’m asking because when I add the new role it causes a crash. I just created a hook and then put the function in above the filter for the piklist code. I was just experimenting with a new simple role here.

      //Hook to add new roles
      add_action( ‘admin_init’, ‘add_custom_role’ );
      
      //Creating the new roles
      function add_custom_role() {
      $designer = add_role( ‘desinger’, ‘Designer’, array(
      ‘read’ => true,
      ‘edit_posts’ => true,
      ‘delete_posts’ => false,
      ));

      Doesn’t seem to work when I add it into the piklist main plugin php file. Would appreciate some help on this. Thank you!

    • #1712
      Steve
      Keymaster

      @achowell– You should be able to place any code you want in the main plugin file. Not sure if it’s a copy/paste error but the add_custom_role() function is not closed.

    • #1713
      achowell
      Member

      Yeah, that was it, I was copying code from one file to another and forgot the closing bracket. Thanks for the catch!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.