WordPress.org

Ready to get started?Download WordPress

Forums

Paid Memberships Pro
[resolved] Custom Post Types & Taxonomies (4 posts)

  1. codescribblr
    Member
    Posted 1 year ago #

    Can I use custom post types and custom taxonomies (instead of posts and categories) to allow or restrict members access?

    When you create a new membership level, you can choose a category to automatically give access to the new level. But there's no option to allow for custom post types or taxonomies there. Can this be done?

    http://wordpress.org/extend/plugins/paid-memberships-pro/

  2. strangerstudios
    Member
    Plugin Author

    Posted 1 year ago #

    Some info that may help you.

    To enable the "require membership" box for a CPT (which will let you lock down individual CPTs): http://www.paidmembershipspro.com/2012/07/add-pmpro-membership-level-meta-box-to-a-custom-post-type/

    To lock down a custom taxonomy, you can write some custom code to hook into the pmpro_has_membership_access_filter or pmpro_has_membership_access_filter_{posttype} hook.

    Here is an example doing something else, but might help:
    http://www.paidmembershipspro.com/tag/pmpro_has_membership_access_filter/

    If you sign up for support at http://www.paidmembershipspro.com, I can write up some more specific code for you.

    Hope this helps.

  3. wtoalabi
    Member
    Posted 10 months ago #

    Yes Jon!
    I just found our the solution!
    All you need to do is just locate:

    wp-content\plugins\paid-memberships-pro\includes\metaboxes.php
    Search inside for

    add_meta_box('pmpro_page_meta', _x('Require Membership', 'metabox heading', 'pmpro'), 'pmpro_page_meta', 'page', 'side');

    Now just change the 'page' to whatever is the code-name of your custom-type.

    For example, try to create a new custom type and if your address looks like this:

    http://your.com/wp-admin/post-new.php?post_type=myportfolios

    Then, "myportfolios" is your custom-type.

    Just replace the word "page" in the metabox above to myportfolios

    Thats all!

  4. Slocum Themes
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Jon,

    You have found a solution, but I would advise against modifying the plugin files as an update to the plugin will erase any changes you may have made. Please refer to the post Jason referenced above for adding a meta box to your custom post type. You'll want to keep your modifications to PMPro in your current theme, or a plugin to prevent over-writes.

    I'm going to resolve this thread. If you have any other questions, please feel free to open a new one.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic