Premise landing pages is a really neat tool made by Copyblogger media and offers a bunch of neat features. Not only do they offer basic landing pages, but they offer things like membership creation (restrict content to members) as well as integration with BBPress and vBulletin to create users & login to the forums via oAuth. They now also support a bunch of different payment gateways so you can accept payments right through the plugin.
Before the release of version 2.4 it was a challenge to add membership support (restrict content) to custom post types. Now, it’s easy:
[wpgist url=”https://gist.github.com/protechig/5331127″]
Your timing is great; this is exactly what I’m looking for. One question though: at the risk of appearing a bit dense (It’s a bit late and I’m in need of sleep), are you adding those lines to functions.php, to another file, or creating a separate file (and if so, where did you put it)?
Thanks
Glen thanks for your feedback. In this case, it’s added into a custom plugin that I use to register the post type. I would add it to the file (and section) that registers the CPT, this could be a functions.php in your case. If you need some help, please don’t hesitate to contact me.
Hey Zachary,
Thanks for the code. I’ve tried putting this into a plugin for use on a website but it keeps returning an error:
Parse error: syntax error, unexpected ‘add_action’ (T_STRING) in on line 82
Line 82 is where ‘add_premise_member_support’ action can be found.
or similarly if the action is put below the function then it returns an error with the function:
Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in on line 82
I’m building this test on a local version of WordPress though don’t think that should make a difference.
I have managed to get it to work on the CPT but only though going into the Premise files themselves. I’m using Premise version 2.5.3
Premise > member-access > includes > admin > post-access-metabox
On line 17 there is the function function __construct which lists all of the post types Premise supports. So I’ve simply added the name of my CPT there. The line to copy and is where you change ‘post’ for your CPT name:
add_post_type_support( ‘post’, ‘premise-member-access’ );
Obviously the MAIN downside to this is that the next time Premise gets updated all of the CPT’s will need to be added again. It would be good to get this to work in the CPT plugin as you recommended to Glen.
Any ideas of why this wouldn’t work?
All the best,
Nate
Hello Nate,
It’s been a while since I’ve touched premise, so I’m not 100% sure what is causing this. You could add ‘premise-member-access’ to the post types supports key. The T_STRING error is usually a syntax problem in my experience.
Do you want to email me the file you’re working with zach@protechig.com? I’ll try to help you out 🙂
Thanks!
Zach
Hey Zach,
Sorry I haven’t gotten around to emailing you the file yet but I think I’ve worked out why it wasn’t working. I had to add the post_type variable inside the function then it’s worked.
Not sure if I can post code straight into the comment box so I’ve added it to a Pastebin http://pastebin.com/iW3YjB7q
The other annoyance at the moment is Premise isn’t listing the CPT posts/pages in the drop downs for the main settings (checkout, login and member profile or thank you page in a product). So that’s going to be the next thing to try and workout though I have a feeling it’ll be a bit beyond my skill.
All the best,
Nate
Hi, thanks for your post. You wrote that Premise has “integration with BBPress and vBulletin to create users & login to the forums via oAuth”.
Can you clarify how to integrate premise with bbpress forum sign up?
I have set up a Premise free product which creates a WP user and password; but when the user signs in they don’t have access to contribute to the bbpress forums.
I would like this to be automatic (not requiring moderator to approve forum access)
Am i on the wrong track here?
Many thanks
OK,I just found the missing step – need to set each forum to the member access level I set up. Now users can log in and contribute to those forums.
That sounds about right. I’ve never set it up to forms personally. Glad my post at least pointed you in the right direction!