Community Support Forums — WordPress® ( Users Helping Users ) — 2011-07-27T15:03:18-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14242 2011-07-27T15:03:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29312#p29312 <![CDATA[Re: conditional statement for user level logins?]]>
Now, you seem to want something almost custom to each page the user may not be allowed to. What I can suggest is to use conditionals in each protected post. WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals

Wrap the whole post in a condition that checks the right access to it and displays the content or a message if he doesn't have the access. Then each message can be custom to the specific post he's in.

Would that work better for what you want to accomplish?

Statistics: Posted by Cristián Lávaque — July 27th, 2011, 3:03 pm


]]>
2011-07-27T14:21:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29309#p29309 <![CDATA[Re: conditional statement for user level logins?]]>
in other words, if a post about "puppies, trees, and flowers" is level #0 and a post about "planes, trains, and automobiles" is level #1, when they are redirected to the membership options page, it's not obvious which level subscription that referring link was part of. obviously, i could tell from the url having a "=0" or "=1" but it's not as intuitive as I had hoped.

or maybe i'm not getting it...

Statistics: Posted by rwilki — July 27th, 2011, 2:21 pm


]]>
2011-07-27T13:59:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29301#p29301 <![CDATA[Re: conditional statement for user level logins?]]>

rwilki wrote:
is there any way people can know which level protected link they just clicked?


What do you mean?

Statistics: Posted by Cristián Lávaque — July 27th, 2011, 1:59 pm


]]>
2011-07-27T04:06:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29284#p29284 <![CDATA[Re: conditional statement for user level logins?]]>
I guess that will have to be from the shortcode I've wrapped. I was hoping not to have to wrap every post in shortcode, but I don't see a way around it...

thanks very much!

Statistics: Posted by rwilki — July 27th, 2011, 4:06 am


]]>
2011-07-27T03:35:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29282#p29282 <![CDATA[Re: conditional statement for user level logins?]]>
Code:
<?php if (!isset($_GET['s2member_level_required'])) { ?>
Message for someone that didn't arrive from a restricted page, maybe came clicking the link to the Membership Options Page in the navigation.
<?php } elseif ($_GET['s2member_level_required'] === '0') { ?>
Ask him to create a free account.
<?php } elseif ($_GET['s2member_level_required'] === '1') { ?>
Ask him to get a paid account. If he already has a free account, have him login first so he upgrades it.
<?php } ?>

Statistics: Posted by Cristián Lávaque — July 27th, 2011, 3:35 am


]]>
2011-07-27T03:26:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29279#p29279 <![CDATA[Re: conditional statement for user level logins?]]> <?php

if (!isset($_GET['s2member_level_required'])) {
// Message for someone that didn't arrive from a restricted page, maybe came clicking the link to the Membership Options Page in the navigation.
} elseif ($_GET['s2member_level_required'] === '0') {
// Ask him to create a free account.
} elseif ($_GET['s2member_level_required'] === '1') {
// Ask him to get a paid account. If he already has a free account, have him login first so he upgrades it.
}

?>

but nothing showed up...

Statistics: Posted by rwilki — July 27th, 2011, 3:26 am


]]>
2011-07-27T03:18:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29276#p29276 <![CDATA[Re: conditional statement for user level logins?]]> Statistics: Posted by Cristián Lávaque — July 27th, 2011, 3:18 am


]]>
2011-07-27T03:16:19-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29275#p29275 <![CDATA[Re: conditional statement for user level logins?]]> Parse error: syntax error, unexpected T_FOR in /home/ebrief/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()&#8217;d code on line 4

Statistics: Posted by rwilki — July 27th, 2011, 3:16 am


]]>
2011-07-27T03:05:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29273#p29273 <![CDATA[Re: conditional statement for user level logins?]]> Statistics: Posted by rwilki — July 27th, 2011, 3:05 am


]]>
2011-07-27T02:38:53-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29268#p29268 <![CDATA[Re: conditional statement for user level logins?]]> https://wordpress.org/extend/plugins/exec-php/

I don't know how to do it with shortcodes, sorry. :|

Statistics: Posted by Cristián Lávaque — July 27th, 2011, 2:38 am


]]>
2011-07-27T01:11:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29248#p29248 <![CDATA[Re: conditional statement for user level logins?]]>

Statistics: Posted by rwilki — July 27th, 2011, 1:11 am


]]>
2011-07-27T01:03:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29246#p29246 <![CDATA[Re: conditional statement for user level logins?]]> s2member_level_required at the end of those URLs, you can customize the message to have the user register for free or paying. E.g.:

Code:
<?php

if 
(!isset($_GET['s2member_level_required'])) {
    // Message for someone that didn't arrive from a restricted page, maybe came clicking the link to the Membership Options Page in the navigation.
} elseif ($_GET['s2member_level_required'] === '0') {
    // Ask him to create a free account.
} elseif ($_GET['s2member_level_required'] === '1') {
    // Ask him to get a paid account. If he already has a free account, have him login first so he upgrades it.
}

?>


I hope it helps. :)

Statistics: Posted by Cristián Lávaque — July 27th, 2011, 1:03 am


]]>
2011-07-26T10:32:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14242&p=29189#p29189 <![CDATA[conditional statement for user level logins?]]>
In other words,

If someone clicks on a link to a level#0 post, this is the url...
http://www.domain.com/membership-signup ... evel_req=0

If someone clicks on a link to a level#1 post, this is the url...
http://www.domain.com/membership-signup ... evel_req=1

so that they have a custom signup members page only showing the signup level they need.

Thanks,
Bob

Statistics: Posted by rwilki — July 26th, 2011, 10:32 am


]]>