WordPress.org

Ready to get started?Download WordPress

Forums

Capability Manager Enhanced
[resolved] Support For WordPress Custom Post Type (4 posts)

  1. Prasanth Panicker
    Member
    Posted 10 months ago #

    How do i get Custom Post Type in Types Additional Capabilities list ?

    Custom post type code pasted below

    function apg_newsletter_init()
    {

    $apg_newsletter= array(
    'name' => _x('PDF Newsletters', 'post type general name'),
    'singular_name' => _x('Newsletter', 'post type singular name'),
    'all_items' => __('All Newsletters'),
    'add_new' => _x('Add New newsletter', 'recipes'),
    'add_new_item' => __('Add New Newsletter'),
    'edit_item' => __('Edit Newsletter'),
    'new_item' => __('New Newsletter'),
    'view_item' => __('View Newsletter'),
    'search_items' => __('Search in Newsletters'),
    'not_found' => __('No Newsletters found'),
    'not_found_in_trash' => __('No Newsletter found in trash'),
    'parent_item_colon' => ''
    );
    $args = array(
    'labels' => $apg_newsletter,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'menu_position' => 20,
    'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields'),
    'has_archive' => 'Newsletters'
    );

    register_post_type('apgpdfnewsletters',$args);
    }

  2. K2Joom
    Member
    Posted 9 months ago #

    I am also interested to learn how to add custom post types.

    My theme includes custom post types for Galleries, Portfolio, which are created and displayed via a Page.
    Using s2Members to limit access to pages is a breeze, but we need to add edit capabilities to custom post types as we do not want any member to create pages, just galleries or portfolios.

    Any ideas?

  3. K2Joom
    Member
    Posted 9 months ago #

    OK, this might help.

    In capability-manager-enhanced/includes/admin.php if found this code which was commented out:

    if ( ( count($custom_types) || count($custom_tax) ) && ( $is_administrator || current_user_can( 'manage_pp_settings' ) ) ) {
    					$cap_properties[''] = array();
    					$force_distinct_ui = true;
    				}

    After uncommenting, the custom post types are now displayed in the capabilities manager, however no check boxes are displayed, so that will be the next task.

  4. kevinB
    Member
    Plugin Author

    Posted 9 months ago #

    No need to hack the plugin code. It's not making those capabilities available to you because you have not defined them.

    http://codex.wordpress.org/Function_Reference/register_post_type

    Set capability_type to your post_type or pass a capabilities array for more control. Or if you activate Press Permit Core and enable the post type for filtering, distinct capabilities will be auto-defined.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.