• otta88sun

    (@otta88sun)


    Hi,
    i’m in trobule.

    I’ve 2 user roles (level 0 and 1) and i want let them delete ONLY a particular published custom post type.

    How can i do it? My role manager plugin let me choose only the option “allow delete published post”. And i check this them can delete every published posts, not only a particular custom post type.

    How can i do it? Thank you

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter otta88sun

    (@otta88sun)

    of course, i can ask in the same way:

    How can I change publish,edit,delete user permission only for a particular custom post type?

    Moderator cubecolour

    (@numeeja)

    Justin Tadlock has written about adding meta capabilities for custom post types at https://justintadlock.com/archives/2010/07/10/meta-capabilities-for-custom-post-types if you have that set up for your CPT you can then use Justin’s Members plugin to assign the capability to a role that you grant the users who are to manage it.

    Thread Starter otta88sun

    (@otta88sun)

    I already got a plugin for that, is called access manager and i can add cababilities too. But i don’t know ho can i add it… i think i’ve to set something in functions.php of theme… but sure, i’m totally in trouble…

    Moderator cubecolour

    (@numeeja)

    If you look at the code which defines your custom post type, you will probably find something like

    'capability_type' => 'page',

    Following the example in Justin’s article I linked to you can replace this with a custom capability type that you can define

    So for a CPT called ‘snippets’ we could replace 'capability_type' => 'page', with something like the following:

    'capability_type' => 'snippet',
    	'capabilities' => array(
    		'publish_posts' => 'publish_snippets',
    		'edit_posts' => 'edit_snippets',
    		'edit_others_posts' => 'edit_others_snippets',
    		'delete_posts' => 'delete_snippets',
    		'delete_others_posts' => 'delete_others_snippets',
    		'read_private_posts' => 'read_private_snippets',
    		'edit_post' => 'edit_snippet',
    		'delete_post' => 'delete_snippet',
    		'read_post' => 'read_snippet',
    	),

    I am not familiar with the plugin called ‘access manager’ and could not find one with that name in the plugin directory (although there are a few similarly named ones)

    In Justin’s Members plugin there is an easy way to add capabilities to a role, which in the case of my example allows me to add any or all of these capabilities to a role without needing to grant the equivalent capabilities for managing posts/pages.

    if you cannot find an option to do this in your plugin, you will need to ask the plugin author whether it is possible.

    Thread Starter otta88sun

    (@otta88sun)

    Thanks for answer but in this way i set it for all user while i need that only a particular group of user can delete a particoular CPT.

    For the CPT I use a plugin that easy a lot the work at me…

    so any solution?

    Moderator cubecolour

    (@numeeja)

    What plugin is it?

    If it already uses its own custom capability_type this would be less work to accomplish. If it doesn’t you would need this added. Your options are to

    1. Ask the plugin author whether they have plans to add a custom capability type and if not, perhaps ask whether they would be interested in doing it you sponsor the work with a donation.

    2. fork the plugin to make your own new custom version with its own capability_type. If that is beyond your comfort level, you could hire a developer to do the work for you.

    Thread Starter otta88sun

    (@otta88sun)

    So… “Type” is the plugin for CTP
    “Access Managar” let me manage user access (and present to add cababilities)…

    Moderator cubecolour

    (@numeeja)

    It is probably worth asking the plugin authors if they have any insights into how this can be achieved using their plugin

    Thread Starter otta88sun

    (@otta88sun)

    ok i’ll ask. Thank you

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Allow some roles to delete only some custom post type published’ is closed to new replies.