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

  1. Handoko
    Posted 3 years 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?


  2. podpirate
    Plugin Author

    Posted 3 years 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
    Posted 3 years 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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Access Areas
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.