Community Support Forums — WordPress® ( Users Helping Users ) — 2011-08-18T03:03:25-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14562 2011-08-18T03:03:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32252#p32252 <![CDATA[Re: Understanding the code...]]>
rwilki wrote:
I was hoping to put a button shortcode inside the echo for people to signup for paid access.


You mean something like this?

Code:
<?php if ($_GET['s2member_level_req'] == '0') { ?>

By registering now...

<?php } elseif ($_GET['s2member_level_req'] == '1') { ?>

[s2Member-PayPal-Button ... /]

<?php } ?>

Statistics: Posted by Cristián Lávaque — August 18th, 2011, 3:03 am


]]>
2011-08-17T22:45:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32215#p32215 <![CDATA[Re: Understanding the code...]]> Statistics: Posted by Bruce C — August 17th, 2011, 10:45 pm


]]>
2011-08-17T22:05:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32205#p32205 <![CDATA[Re: Understanding the code...]]>
Code:
<?php
if (!isset ($_GET["s2member_level_req"]))
   {
?>
<?php
   }
else if ($_GET["s2member_level_req"] === "0")
   {
?>
      You need to be at least a free member to do that.
<?php
   }
else if ($_GET["s2member_level_req"] === "1")
   {
?>
      You need to be level 1
<?php
   }
else
   {
?>
<?php
   }
?>

Statistics: Posted by Bruce C — August 17th, 2011, 10:05 pm


]]>
2011-08-17T21:48:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32200#p32200 <![CDATA[Re: Understanding the code...]]>
Sorry but two final questions for you. I'm using "Shortcode Exec PHP" plugin and I had to add the "Exec-PHP" plugin for the most recent code you just posted.

1] Do you think there is a way to use shortcode or to shortcode the php for the condition?
2] More importantly, I was hoping to put a button shortcode inside the echo for people to signup for paid access. I'm guessing that there are restrictions with code inside the echo " ". Do you think I can escape certain code characters or will it just not work?

Thanks SO VERY MUCH for you awesome geniusness!!!
Bob

Statistics: Posted by rwilki — August 17th, 2011, 9:48 pm


]]>
2011-08-17T21:36:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32194#p32194 <![CDATA[Re: Understanding the code...]]>
Here's the solution:

Code:
<?php
if (!isset ($_GET["s2member_level_req"])) {
//do nothing
}
else if ($_GET["s2member_level_req"] === "0")
   {
      echo "You need to be at least a free member to do that.";
   }
else if ($_GET["s2member_level_req"] === "1")
   {
      echo "You need to be level 1";
   }
else {
//do nothing
}
?>


Basically, you have to see if the s2member_level_req is set before you go through the conditionals.

Ace tested and approved!

Statistics: Posted by Bruce C — August 17th, 2011, 9:36 pm


]]>
2011-08-17T21:13:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32189#p32189 <![CDATA[Re: Understanding the code...]]>
I love the community and plugin. Just wish I could move on...

Statistics: Posted by rwilki — August 17th, 2011, 9:13 pm


]]>
2011-08-17T21:04:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32188#p32188 <![CDATA[Re: Understanding the code...]]> Statistics: Posted by Bruce C — August 17th, 2011, 9:04 pm


]]>
2011-08-17T20:25:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32185#p32185 <![CDATA[Re: Understanding the code...]]> Statistics: Posted by rwilki — August 17th, 2011, 8:25 pm


]]>
2011-08-17T19:58:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32179#p32179 <![CDATA[Re: Understanding the code...]]>
Hope that helps!

P.S.
Whenever the current member is NOT redirected from a page, the value defaults to a string of '0', therefore, you HAVE to use the === for the free subscribers, otherwise it will error.

Statistics: Posted by Bruce C — August 17th, 2011, 7:58 pm


]]>
2011-08-17T16:49:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32159#p32159 <![CDATA[Re: Understanding the code...]]>
the "By registering now..." does not appear when seeking level#0 content and "By signing up for Premium Access Pass..." doesn't not appear when seeking level#1 content.

Is there a shortcode for this condition?
Code:
<?php if ($_GET['s2member_seeking'] == '0') { ?>
and this one?
Code:
<?php } elseif ($_GET['s2member_seeking'] == '1') { ?>


The idea is that this is content that appears when people are NOT logged in and they're seeking the designated content...

Statistics: Posted by rwilki — August 17th, 2011, 4:49 pm


]]>
2011-08-17T04:14:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32119#p32119 <![CDATA[Re: Understanding the code...]]> elseif, do you have an if before the quoted code? If not, then you should start with an if.

Code:
<?php if ($_GET['s2member_level_req'] == '0') { ?>
By registering now...
<?php } elseif ($_GET['s2member_level_req'] == '1') { ?>
By signing up for Premium Access Pass...
<?php } ?>


I hope that helps. :)

Statistics: Posted by Cristián Lávaque — August 17th, 2011, 4:14 am


]]>
2011-08-17T03:37:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32107#p32107 <![CDATA[Re: Understanding the code...]]> Statistics: Posted by RJGonzalez — August 17th, 2011, 3:37 am


]]>
2011-08-17T02:25:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32085#p32085 <![CDATA[Re: Understanding the code...]]> Statistics: Posted by rwilki — August 17th, 2011, 2:25 am


]]>
2011-08-16T22:18:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32070#p32070 <![CDATA[Re: Understanding the code...]]>
Code:
<?php } elseif ($_GET['s2member_level_required'] === '1') { ?>


I might be i am wrong but should be this way?

Code:
<?php } elseif { ($_GET['s2member_level_required'] === '1') ?>


Hope that helps

Statistics: Posted by RJGonzalez — August 16th, 2011, 10:18 pm


]]>
2011-08-16T14:04:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14562&p=32057#p32057 <![CDATA[Understanding the code...]]>
This is my code. Shouldn't it hide the content from the level not required?
Code:
<?php } elseif ($_GET['s2member_seeking'] === '0') { ?>
By registering now...
<?php } elseif ($_GET['s2member_seeking'] === '1') { ?>
By signing up for Premium Access Pass...
<?php } ?>


I've also tried...
Code:
<?php } elseif ($_GET['s2member_level_required'] === '0') { ?>

and
Code:
<?php } elseif ($_GET['s2member_level_required'] === '1') { ?>


I would like the MOP page to only show the option needed for access to the protected post that was clicked. Making visible ONLY the message for the required level content, not both. To me, it's confusing if both membership options show up when the visitor is just trying to get to one article.

Statistics: Posted by rwilki — August 16th, 2011, 2:04 pm


]]>