Community Support Forums — WordPress® ( Users Helping Users ) — 2011-07-16T00:27:25-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14092 2011-07-16T00:27:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14092&p=28482#p28482 <![CDATA[Re: Nesting WordPress Shortcodes & Conditionals?]]>

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


]]>
2011-07-15T19:11:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14092&p=28455#p28455 <![CDATA[Re: Nesting WordPress Shortcodes & Conditionals?]]> Statistics: Posted by fcandillo — July 15th, 2011, 7:11 pm


]]>
2011-07-13T16:13:53-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14092&p=28314#p28314 <![CDATA[Re: Nesting WordPress Shortcodes & Conditionals?]]> if statement split into separate shortcodes, it doesn't look like that will work. Try searching Google for shortcode conditionals in WordPress and see if you find info on how to achieve it.

Statistics: Posted by Cristián Lávaque — July 13th, 2011, 4:13 pm


]]>
2011-07-13T07:23:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14092&p=28271#p28271 <![CDATA[Re: Nesting WordPress Shortcodes & Conditionals?]]>
Code:
function pay1_tag() {
   return '<?php if (current_user_is("s2member_level1")){ ?>';
   }

   add_shortcode('pay1', 'pay1_tag');


function pay2_tag() {
   return '<?php } else if (current_user_is("s2member_level0")){ ?>
                   The blocker message...
               <?php } else { ?>
                  The blocker message...
               <?php } ?> ';
   }

   add_shortcode('pay2', 'pay2_tag');


I have the following written in the post:

Teaser content...
[pay1]
Pay Content.......
[pay2]

Statistics: Posted by fcandillo — July 13th, 2011, 7:23 am


]]>
2011-07-13T02:17:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14092&p=28250#p28250 <![CDATA[Re: Nesting WordPress Shortcodes & Conditionals?]]> WP Admin -> s2Member -> API / Scripting -> Using Advanced Conditionals

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


]]>
2011-07-12T16:17:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14092&p=28215#p28215 <![CDATA[Re: Nesting WordPress Shortcodes & Conditionals?]]>
but, i would still be interested in knowing how to shorten the shortcode / simple conditionals.
thanks.

Statistics: Posted by fcandillo — July 12th, 2011, 4:17 pm


]]>
2011-07-12T11:26:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14092&p=28190#p28190 <![CDATA[Nesting WordPress Shortcodes & Conditionals?]]>
So, I will show some teaser content... and if the viewer has 'Level 1' access, then they will be shown the rest of the content. ** those that don't have access to the [pay] Premium content are shown a "blocker" message.

I understand how to do this with Simple Conditionals. However, want to take it a step further.

We are converting from another membership plugin and we already have shortcode tags in our posts written like the following:

Teaser content...
[pay]
Premium content
[/pay]

So far, using the S2Member plugin... I have figured out to do the following

Teaser content...
[s2If current_user_can(access_s2member_level1)]
Premium content...
[/s2If]
[s2If !current_user_can(access_s2member_level1)]
[blockermessage]
[/s2If]

here is my sandbox page example using the Simple Conditionals: https://museuminsider.co.uk/sandbox/sit ... y-tenders/

I created a [blocker] shortcode by adding to my functions.php -- include shortcode.php.... and then my [blocker] message is pulled from the shortcode.php

So the Question is...
Is is possible to duplicate the same using Simple or Advanced PHP conditionals... So that basically the following occurs:

[pay] = [s2If current_user_can(access_s2member_level1)]
[/pay] = [/s2If] [s2If !current_user_can(access_s2member_level1)] [blockermessage] [/s2If]

Then I don't have to change anything in the thousands of posts we have. ;)

Statistics: Posted by fcandillo — July 12th, 2011, 11:26 am


]]>