This topic has 4 replies, 3 voices, and was last updated 9 years by Andrei.

  • Author
  • #50977
     ianll
    Participant

    OK so the edit_posts capability needs to be granted to the role in order for the user to see / dd a post to the site. This is all fine and well except I do not want my users to be able to see and add the following post types (which are included when this capability is granted):

    – Posts (created by other users)
    – Clients
    – Testimonials
    – Portfolio
    – Grid Elements

    Also the comments and tools items would be nice to be able to remove or at least restrict to a higher role.

    Please advise if this can be accomplished and how best to do so.

    Thank you!

    #51041
     ianll
    Participant

    Can you provide any code that will allow me to change the required capabilities for the mentioned post types to author rather than contributor?

    #51293
     Laura
    Moderator

    Hello, maybe https://wordpress.org/plugins/capability-manager-enhanced/ can help you, let me know 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #51361
     ianll
    Participant

    Thanks Laura,
    This is a bad suggestion as this plugin has some serious security issues including allowing users to alter the capabilities of administrators.

    I’m going to have to alter some core theme files to set capabilities for your custom post types and grant permissions to admins and editors. I’d really rather not do this and will surely experience some issues after doing it. But without a way to go from all you friendly support folks this is what has to be done.

    So the post-types.php file included in your theme /wp-content/themes/kleo/lib/post-types.php, I’ll be able to alter a few of the post types (Portfolio, Testimonial, & clients) I need to alter capabilities on.
    [code]
    /**
    * Setup Clients post type
    * @since 1.0
    * @return void
    */
    public function setup_clients_post_type () {

    $args = array(
    ‘labels’ => $this->get_labels( ‘clients’, $this->labels[‘clients’][‘singular’], $this->labels[‘clients’][‘plural’], $this->labels[‘clients’][‘menu’] ),
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘show_in_menu’ => TRUE,
    ‘menu_icon’ => ‘dashicons-businessman’,
    ‘query_var’ => true,
    ‘rewrite’ => array( ‘slug’ => esc_attr( apply_filters( ‘kleo_clients_slug’, ‘clients’ ) )),
    ‘has_archive’ => true,
    ‘hierarchical’ => false,
    ‘menu_position’ => 20, // Below “Pages”
    ‘supports’ => array( ‘title’, ‘thumbnail’ )
    );

    register_post_type( ‘kleo_clients’, $args );

    $tag_args = array(
    “label” => _x(‘Client Tags’, ‘tag label’, “kleo_framework”),
    “singular_label” => _x(‘Client Tag’, ‘tag singular label’, “kleo_framework”),
    ‘public’ => true,
    ‘hierarchical’ => false,
    ‘show_ui’ => true,
    ‘show_in_nav_menus’ => false,
    ‘args’ => array( ‘orderby’ => ‘term_order’ ),
    ‘query_var’ => true
    );

    register_taxonomy( ‘clients-tag’, ‘kleo_clients’, $tag_args );
    [/code]

    Can you provide the proper code for this theme to add capabilities and map_meta so I do this properly and don’t break the theme? I need to restrict all these CPT’s to editor and administrator…

    These are the CPT’s I need to alter:
    – Posts (created by other users)
    – Clients
    – Testimonials
    – Portfolio
    – Grid Elements

    Thanks

    #52180
     Andrei
    Moderator

    Hi @ianll, instead of thinking of changing the CPT’s from our theme, which can be more than one, and from which you can loose some features, you should better focus on modifying the plugin itself, or request the plugin author to give you another solution for this case.

    Also, another approach would be to lock down the back end of your wordpress site for non-admin users.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?