WordPress.org

Forums

Member Access
How to use this plugin for Custom Post Types (6 posts)

  1. sintls
    Member
    Posted 3 years ago #

    my theme has custom post types, what update should be made for custom post types. At present it is working on everything else but not custom post types.

    Thnx!

    http://wordpress.org/extend/plugins/member-access/

  2. Atlanta
    Member
    Posted 3 years ago #

    Hi, I would like to see this too.

    Nice clean plugin.

  3. carnini
    Member
    Posted 3 years ago #

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

  4. resigua
    Member
    Posted 3 years ago #

    I have the same problem.

  5. Zilkyan
    Member
    Posted 2 years ago #

    Hi, i would like to see this too.

  6. jcrea
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Member Access
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic