WordPress.org

Forums

WP-Members
Extending wp-members to custom post types (5 posts)

  1. jjarokerwo
    Member
    Posted 3 years ago #

    Hello Chad,

    I am using the wp-members plugin and would like it to protect custom post types. Right now, I can only protect plugins and pages.

    Can you suggest how the plugin can be extended to also block content on a custom post type?

    Thank you,
    Jon

    http://wordpress.org/extend/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    Hi Jon,

    I think I might have gotten an email from you as well?

    The answer is that it depends entirely upon how the theme utilizes the Loop in the custom post type that you are referring to. I wouldn't know without looking at the theme.

  3. @_regeek
    Member
    Posted 3 years ago #

    @Chad Butler - how can I unblock CPT through its declaration in functions.php? After installing your plugin CPT looks blocked.

  4. @_regeek
    Member
    Posted 3 years ago #

    @Chad Butler, I unlocked them in my case by making CPT inheriting post type behaviour and unchecking "block" by default. But it is still really interesting, can I somehow put "block/unblock" declaration into array of CPT definitions explicitly?

  5. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    There is a filter hook for the plugin as to whether it will block or unblock - wpmem_block. You might be able to do something using that filter.

    add_filter( 'wpmem_block', 'my_block_filter' );
    function my_block_filter( $block )
    {
        // the plugin's calculated value for blocking comes in
        // the parameter $block and will be a true/false boolean
    
        // you can do whatever in here to determine if you'll
        // change it or not. then just return a true/false boolean
        // when you are done...
    
        return $block;
    
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic