WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Access Areas
[resolved] Access default per content type (3 posts)

  1. Handoko
    Member
    Posted 11 months ago #

    I'm using this plugin in one of my 'real' website. But I don't know how to do it:
    - I've created a new custom content type "Product" using Pods plugin.
    - I created an access area "Temporary"
    - I want the all newly created Products always only can read and can edit by users that who can access "Temporary" area.

    How to do it?

    http://wordpress.org/plugins/wp-access-areas/

  2. podpirate
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Handoko,
    I didn't build in a feature like 'set access defaults for post type', and I do not plan to do this in the near future.
    You might like write a tiny plugin or mu-plugin, where you can set the defaults "by hand". It could look like this:

    function my_insert_post_data( $data , $postarr ) {
        extract( $data );
        if ( ! isset( $ID ) && $post_status == 'auto-draft' && $post_type == 'post' ) {
            // replace these with a wp-rolename, a capability or an access area of your choice
            $data['post_view_cap'] = 'my-access-area';
            $data['post_edit_cap'] = 'my-other-access-area';
            $data['post_comment_cap'] = 'my-third-access-area';
        }
        return $data;
    }
    add_filter( 'wp_insert_post_data' , 'my_insert_post_data' , 20 , 2 );

    You will need the access-areas corresponding capability.
    Just added a column in the Access-Areas table view, where you can copy-paste them.

  3. Handoko
    Member
    Posted 10 months ago #

    Thank you for your help. But I'm not good in PHP. For now, I will set the new posts private manually. If someday you have time and want to add new feature to the plugin, please consider it. I'm marking this topic as resolved.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.