WordPress.org

Support

Support » Plugins and Hacks » Member Access » [Plugin: Member Access] How to use this plugin for Custom Post Types

[Plugin: Member Access] How to use this plugin for Custom Post Types

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, I would like to see this too.

    Nice clean plugin.

    same issue here, no info on how to use it for a custom post type.

    I have the same problem.

    Hi, i would like to see this too.

    This is what I found. If you don’t care about turning the feature off and on for individual posts of a custom post type, and you just want to make them all private, you can edit the MemberAccess.php file located in the plugins directory “/member-access/lib”.
    Around line 806:

    $visibility = $post->{'member_access_visibility'};
            if ('default' === $visibility) {
                if ('post' == $post->post_type && $plugin->getOption('posts_private')) {
                    $visibility = 'private';
                }
    	    if ('YourCustomPostType' == $post->post_type && $plugin->getOption('posts_private')) {
                    $visibility = 'private';
                }
                if ('page' == $post->post_type && $plugin->getOption('pages_private')) {
                    $visibility = 'private';
                }
            }
            return 'private' === $visibility;
        }

    As you can see in the middle section you can add your custom post type like that.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Member Access] How to use this plugin for Custom Post Types’ is closed to new replies.
Skip to toolbar