Missing permissions if use generated php code from AIO

Support MB Custom Post Type Missing permissions if use generated php code from AIOResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39896
    justdoit123justdoit123
    Participant

    Hi, i just find out that if i export php code and delete CPT created in Metabox Builder AIO

    that CPT will miss those permissions :
    Edit others
    Delete others
    Edit private
    Delete private
    Read private

    i use : Capability type: custom
    and use Admin menu editor to add capabilities to roles and see that missing permission
    only if i created in builder AIO and keep it there (not php code) it will have all permissions:
    Edit
    Delete
    Publish
    Edit published
    Delete published
    Edit others
    Delete others
    Edit private
    Delete private
    Read private

    see my screenshot
    https://vm.d.pr/i/EQgG81

    can you check and fix this ??

    #39897
    justdoit123justdoit123
    Participant

    my exported php code :

    <?php
    add_action( 'init', 'your_prefix_register_post_type' );
    function your_prefix_register_post_type() {
    	$labels = [
    		'name'                     => esc_html__( 'customers', 'your-textdomain' ),
    		'singular_name'            => esc_html__( 'customer', 'your-textdomain' ),
    		'add_new'                  => esc_html__( 'Add New', 'your-textdomain' ),
    		'add_new_item'             => esc_html__( 'Add New customer', 'your-textdomain' ),
    		'edit_item'                => esc_html__( 'Edit customer', 'your-textdomain' ),
    		'new_item'                 => esc_html__( 'New customer', 'your-textdomain' ),
    		'view_item'                => esc_html__( 'View customer', 'your-textdomain' ),
    		'view_items'               => esc_html__( 'View customers', 'your-textdomain' ),
    		'search_items'             => esc_html__( 'Search customers', 'your-textdomain' ),
    		'not_found'                => esc_html__( 'No customers found.', 'your-textdomain' ),
    		'not_found_in_trash'       => esc_html__( 'No customers found in Trash.', 'your-textdomain' ),
    		'parent_item_colon'        => esc_html__( 'Parent customer:', 'your-textdomain' ),
    		'all_items'                => esc_html__( 'All customers', 'your-textdomain' ),
    		'archives'                 => esc_html__( 'Customer Archives', 'your-textdomain' ),
    		'attributes'               => esc_html__( 'Customer Attributes', 'your-textdomain' ),
    		'insert_into_item'         => esc_html__( 'Insert into customer', 'your-textdomain' ),
    		'uploaded_to_this_item'    => esc_html__( 'Uploaded to this customer', 'your-textdomain' ),
    		'featured_image'           => esc_html__( 'Featured image', 'your-textdomain' ),
    		'set_featured_image'       => esc_html__( 'Set featured image', 'your-textdomain' ),
    		'remove_featured_image'    => esc_html__( 'Remove featured image', 'your-textdomain' ),
    		'use_featured_image'       => esc_html__( 'Use as featured image', 'your-textdomain' ),
    		'menu_name'                => esc_html__( 'Customers', 'your-textdomain' ),
    		'filter_items_list'        => esc_html__( 'Filter customers list', 'your-textdomain' ),
    		'filter_by_date'           => esc_html__( '', 'your-textdomain' ),
    		'items_list_navigation'    => esc_html__( 'Customers list navigation', 'your-textdomain' ),
    		'items_list'               => esc_html__( 'Customers list', 'your-textdomain' ),
    		'item_published'           => esc_html__( 'Customer published.', 'your-textdomain' ),
    		'item_published_privately' => esc_html__( 'Customer published privately.', 'your-textdomain' ),
    		'item_reverted_to_draft'   => esc_html__( 'Customer reverted to draft.', 'your-textdomain' ),
    		'item_scheduled'           => esc_html__( 'Customer scheduled.', 'your-textdomain' ),
    		'item_updated'             => esc_html__( 'Customer updated.', 'your-textdomain' ),
    	];
    	$args = [
    		'label'               => esc_html__( 'Customers', 'your-textdomain' ),
    		'labels'              => $labels,
    		'description'         => '',
    		'public'              => true,
    		'hierarchical'        => false,
    		'exclude_from_search' => false,
    		'publicly_queryable'  => true,
    		'show_ui'             => true,
    		'show_in_nav_menus'   => true,
    		'show_in_admin_bar'   => true,
    		'show_in_rest'        => true,
    		'query_var'           => true,
    		'can_export'          => true,
    		'delete_with_user'    => true,
    		'has_archive'         => true,
    		'rest_base'           => '',
    		'show_in_menu'        => true,
    		'menu_position'       => '',
    		'menu_icon'           => 'dashicons-admin-generic',
    		'capability_type'     => 'custom',
    		'supports'            => ['title', 'editor', 'thumbnail', 'author'],
    		'taxonomies'          => ['source-from'],
    		'rewrite'             => [
    			'slug'       => 'customer',
    			'with_front' => false,
    		],
    	];
    
    	register_post_type( 'customers', $args );
    }
    #39898
    justdoit123justdoit123
    Participant

    i use : Capability type: custom
    and use Admin menu editor to add capabilities to roles and see that missing permission

    #39921
    PeterPeter
    Moderator

    Hello,

    The setting 'capability_type' => 'custom' is supported when you use the builder. If you generate the PHP code to register the post type, you need to add the capabilities manually. Please read more on the documentation https://developer.wordpress.org/reference/functions/register_post_type/#capability_type

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.