PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Different page whether logged in or not

s2Member Plugin. A Membership plugin for WordPress®.

Different page whether logged in or not

Postby cassel » May 7th, 2011, 9:22 am

I think i saw something about this, but i cannot find it again. If it has already been asked and addressed, please direct me to that thread.

I want to have one page that is visible to non-registered members, listing all the advantages of being registered (they will see what will be accessible for them), AND also, if they are members, show them the same list, BUT with also a pitch to what they can get if they BUY the package.

So it would look something like this:
- non-members will SEE the list and description of units 1-12 - no link and a "sales" pitch saying that if they register, they will be able to access the content of units 1-3
- members will SEE the same list and description of units 1-12, but with units 1-3 already linked and accessible, but then, a "sales" pitch saying they can get access to units 4-12 if they buy
- paying members will SEE the same list and description, but all the units, 1-12 will be linked and their content will be accessible, but no more "sales" pitch

The "problem" is that i want one of these pages to display, only, depending on their membership status. Is that feasible? If so, can you just guide me where i can find the specific information? if it is too advanced for me, i can just let the programmer work on it, but i still want to understand the basic of how it is done (even if i do not understand the actual coding involved).

Thanks
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby Cristián Lávaque » May 7th, 2011, 1:22 pm

Hi Cassel. :)

You can do this with conditionals, so instead of protecting the whole page from the metabox in the top-right corner of edit.php, you'd use conditionals right in the body of the page/post to decide what to display.

WP Admin -> s2Member -> API / Scripting -> Using Simple Conditionals
WP Admin -> s2Member -> API / Scripting -> Using Advanced Conditionals

http://www.s2member.com/api-scripting-overview-video/
http://www.s2member.com/advanced-conditionals-video/

I hope that helps.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Different page whether logged in or not

Postby cassel » May 7th, 2011, 1:31 pm

That is what i thought. Thanks.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby Cristián Lávaque » May 7th, 2011, 2:51 pm

No problem. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Different page whether logged in or not

Postby cassel » May 8th, 2011, 8:42 am

Ok re-reading your reply, you mention using the shortcodes IN the post/page to decide what to display. The "problem" i have is that i am using Headway Theme, and not everything is INSIDE those posts/pages. In fact, i have one leaf with what is typed in through WP, and other leafs with other content. Here is an example:

For viewers not logged in at all: http://digiscrapcampus.com/main/basic-teaser/
For logged in viewers: http://digiscrapcampus.com/main/basic/ (there should be units up to 12 listed)
For paid viewers: http://digiscrapcampus.com/main/basic-free/ (where all the units WILL be linked to accessible pages)

Each section of the page is a separate LEAF and not entered in the wp page/post. Could i still use the same type of conditionals?

P.S. this site is ONLY a test site. Nothing is real.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby Cristián Lávaque » May 8th, 2011, 11:20 am

I'm not familiar with your theme, sorry. If those leafs allows shortcodes, then you could use them there too, if not use advanced conditionals after you enable PHP in them. Your developer should be able to do it if you can't.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Different page whether logged in or not

Postby cassel » May 8th, 2011, 11:30 am

That is the thing: the developper is a bit stumped too! lol

We can get a conditional whether to display a page or not, but what we need is a way to NOT display the pages that are "below" the member's level. Maybe we should play with different versions of the conditionals.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby cassel » May 8th, 2011, 11:50 am

Ok.. trying to figure out something here (sorry, cannot figure out where are the instructions to put in the box): Is it possible to instruct s2Member to NOT display a specific page, and redirect instead?

For example if a person clicks on the "Course" tab:
Code: Select all
[s2If !is_user_logged_in()]
Display the content for all visitors, but hide the page for registered, and paid members
[/s2If]

[_s2If current_user_is(s2member_level0)]
Display the "sales page" for registered members, but, hide the specific "sales" page for visitors, and the page for paid members.
[/_s2If]

[_s2If current_user_is(s2member_level1)]
Display the page for Paid memers, but hide the previous two pages
[/_s2If]


Not sure my logic matches the coding, but that is the idea. Right now, i am mostly brainstorming. I THINK i can figure it out with the custom capabilities as to whether to display the Registered member page or the Paid member page, but i dont know how to NOT display the one for unregistered visitors.
Last edited by Cristián Lávaque on May 8th, 2011, 7:54 pm, edited 1 time in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby cassel » May 8th, 2011, 1:47 pm

Again, thinking outloud. I reviewed the video on Advanced conditionals, and i THINK i know what i need: I think it is something like this:

Code: Select all
<?php if (current_user_is("s2member_level1")) && (current_user_can("access_s2member_ccap_BASIC")){ ?>
    Display the content for the ccap Basic.
<?php } else if (current_user_is("s2member_level1")) { ?>
    Display the content for registered members only
<?php } else if (current_user_is("s2member_level0")){ ?>
    Display the content for registered members only
<?php } else { ?>
    Display the general "sales" page for general public
<?php ?>


Now, i would have to figure out how to code the different leafs into this... hum.... right?
Last edited by Cristián Lávaque on May 8th, 2011, 8:07 pm, edited 2 times in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby cassel » May 8th, 2011, 3:02 pm

Yeah... me again. Checking out the Headway Theme, they have leafs that are HTML/PHP... guess what they do? Yup, just what i need. Step by step, i will figure it out!

I managed to get one leaf for the non-logged in visitor to display the content with this code:
Code: Select all
<?php if (!is_user_logged_in()) { ?>
You should see this general public leaf
<?php ?>


And if the user is a registered member only, to display it with this code:
Code: Select all
<?php if (current_user_is("s2member_level0")) { ?>
You should see this leaf
<?php ?>


Now, i just have to figure out how to get the leaf to completely disappear if not to be displayed, instead of ending up with an empty leaf. I will keep you updated in this thread in case someone else has to deal with that theme. It is a GREAT theme to work with!
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby Cristián Lávaque » May 8th, 2011, 8:11 pm

I'm glad you figured your theme out for this. :)

Instead of removing it, in case that's not possible with a condition, why not just show something else?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Different page whether logged in or not

Postby cassel » May 8th, 2011, 8:19 pm

Yeah, i was thinking the exact same thing.
You can have a look at what i did so far on the site:
http://scrapbookcampus.com/ is the main site
http://scrapbookcampus.com/basic-tutori ... tshop-pro/ is the page where i used those conditionals. If you log in as member0 (pw= member0) you will see how the page is different.

Yayyy!!!! (i even found it WITHOUT the programmer beside me... thanks to Cristian!)
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Different page whether logged in or not

Postby Cristián Lávaque » May 8th, 2011, 9:26 pm

Well done! :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron