Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • James Wee
    Participant

    Dear Vladimir,

    The Custom Posts Types were handled by CPT UI. If you’re looking for the respective post’s capabilities, they are:

    Capability Types
    news
    events

    James Wee
    Participant

    Do test it out and share back your findings. If you want my code please let me know 🙂

    James Wee
    Participant

    Yes, but I have granted all privilege (including create_{posttype} ) for the post type “news” and “events”.

    And with this submenu setup alone it will not allow me to create news and events.

    
     $submenu_pages = array(
        array(
          'parent_slug'   => 'edit.php?post_type=news',
          'page_title'    => 'All News',
          'menu_title'    => 'All News',
          'capability'    => 'edit_newss',
          'menu_slug'     => 'edit.php?post_type=news',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
        array(
          'parent_slug'   => 'edit.php?post_type=news',
          'page_title'    => 'All Events',
          'menu_title'    => 'All Events',
          'capability'    => 'edit_eventss',
          'menu_slug'     => 'edit.php?post_type=events',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
      )
    

    I have to do something like this in order to enable create_{posttype} for the users. Why is that so?

    
      $submenu_pages = array(
        //edit.php 
        array(
          'parent_slug'   => 'edit.php?post_type=news',
          'page_title'    => 'All News',
          'menu_title'    => 'All News',
          'capability'    => 'edit_newss',
          'menu_slug'     => 'edit.php?post_type=news',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
        array(
          'parent_slug'   => 'edit.php?post_type=news',
          'page_title'    => 'All Events',
          'menu_title'    => 'All Events',
          'capability'    => 'edit_eventss',
          'menu_slug'     => 'edit.php?post_type=events',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
        //post-new.php HIDDEN
        array(
          'parent_slug'   => 'null', //Don't display on menu
          'page_title'    => 'Add News',
          'menu_title'    => 'Add News',
          'capability'    => 'create_newss',
          'menu_slug'     => 'post-new.php?post_type=news',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
        array(
          'parent_slug'   => 'null', //Don't display on menu
          'page_title'    => 'Add Events',
          'menu_title'    => 'Add Events',
          'capability'    => 'create_eventss',
          'menu_slug'     => 'post-new.php?post_type=events',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
      )
    
    James Wee
    Participant

    Oh damn, I did! I set the “Capability Type” in CPTUI with camelcase. Changing it now.

    BTW. Is it a WordPress requirement for have both the capabilities below in order for View and Create to work?
    edit_posttypename (edit.php)
    create_posttypename (post-new.php)

    Because I just created a new submenu called Programmes with Foundation, Diploma, Degree, Postgrad and it just kinda bugs me to create 4 edit.php and hide 4 post-new.php

    James Wee
    Participant

    Yes, it’s a typo on my part. Role Editor Plugin automatically adds an “s” to the back of all capabilities. (LOL)

    1. To rephrase, the custom post type capabilities are
    – create_Newss, edit_Newss and all other prefixes (delete, publish, read)
    – create_Eventss, edit_Eventss and all other prefixes (delete, publish, read)

    2. Nope, Admin Menu Access is not activated.

    I have sort of created my outcome by doing the following code below (setting “parent_slug” to null).
    This hides the “Add News” and “Add Events” buttons while giving the user the capability to create_Newss and create_Eventss. I don’t understand why, but if I don’t add the 2 buttons below, the user does not have permission to do create_Newss and create_Eventss.

    
        array(
          'parent_slug'   => 'null', //Don't display on menu
          'page_title'    => 'Add News',
          'menu_title'    => 'Add News',
          'capability'    => 'create_Newss',
          'menu_slug'     => 'post-new.php?post_type=news',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
        array(
          'parent_slug'   => 'null', //Don't display on menu
          'page_title'    => 'Add Events',
          'menu_title'    => 'Add Events',
          'capability'    => 'create_Eventss',
          'menu_slug'     => 'post-new.php?post_type=events',
          'function'      => null,// Uses the same callback function as parent menu. 
        ),
    
    James Wee
    Participant

    Okay, let’s rephrase everything again.

    I have 2 post types
    1. Pages
    2. Community (Custom Post Type)

    I’ve given full access (create delete edit publish read) on both post types. So the user can create and edit everything within the 2 post types listed above.

    But I only wanted the user to be able to edit post 1601 only in “Community” but everything else in “Pages”.

    So I went ahead and added “1601” in “Posts/Pages/Custom Post Types Editor Restrictions”
    with post ID (comma separated) : 1601 and press “Update User”.

    Now the user cannot see all posts in “Pages” and “Community” except post 1601 in “Community”. It’s like the URE is overwriting the Role Editor global settings when it is supposed to compliment it.

    Ideally when I set with post ID (comma separated) : 1601. I should:
    1. Page: Still be able to create and edit all posts – according to global role editor settings
    2. Community: Can only see post 1601 and cannot see all other posts.

    in reply to: Beautifying Custom Capabilities Section #2220
    James Wee
    Participant

    Good stuff. Look forward to the updates.

    in reply to: Beautifying Custom Capabilities Section #2216
    James Wee
    Participant

    Thanks for being very open about this.

    I actually like how the member plugin did it in a very organized and tabled way.
    Have a look here.
    https://s.w.org/plugins/members/screenshot-2.png?r=1393548

    The only request I want improved on top of their work is the use of “shift” key to multi-select many checkboxes, like how you can use the shift key to select checkboxes on Gmail.

Viewing 8 posts - 1 through 8 (of 8 total)