latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Time/Date Specific Conditionals

Home Forums Community Forum Time/Date Specific Conditionals

This topic contains 6 replies, has 3 voices. Last updated by  John Cook 3 years, 1 month ago.

Topic Author Topic
Posted: Tuesday Nov 12th, 2013 at 6:55 am #61039
John Cook
Username: wisehippo

Hi all

I want to up-sell Webinars to existing Members using custom capabilities.

I need to be able to sell pre webinar Signups and post webinar Purchases basically for the same custom capability.

There are four states.

1. Before Event – NOT PURCHASED – Displays a Sign Up Button Image
2. Before Event – ALREADY PURCHASED – Shows “You, already signed-up to this event, don’t forget to set your alarm” type of message
3. After Event – NOT PURCHASED – displays a Buy Button Image
4. After Event – PURCHASED – Displays a list of Video Download Options, three button images

The Problem

How can I set a date and time for the event (a custom capability) so that the stages can be displayed accordingly.

I have had limited success using the ‘Shortcode Exe PHP’ Plugin to handle the Date specific stuff. See the following:

[s2If current_user_can(access_s2member_ccap_webinar2)]Download</p>
<p><a href="#"><img class="alignnone size-full wp-image-1850" title="Download an .mp4 video file of this Wise Hippo Instructors' Webinar" alt="Download an .mp4 video file of this Wise Hippo Instructors' Webinar" src="http://www.thewisehippo.com/wp-content/uploads/2013/11/mp4-button.png" width="96" height="21" /></a><a href="#"><img class="alignnone size-full wp-image-1850" title="Download a .webm video file of this Wise Hippo Instructors' Webinar" alt="Download a .webm video file of this Wise Hippo Instructors' Webinar" src="http://www.thewisehippo.com/wp-content/uploads/2013/11/webm-button.png" width="96" height="21" /></a><a href="#"><img class="alignnone size-full wp-image-1850" title="Download a .wmv video file of this Wise Hippo Instructors' Webinar" alt="Download a .wmv video file of this Wise Hippo Instructors' Webinar" src="http://www.thewisehippo.com/wp-content/uploads/2013/11/wmv-button.png" width="96" height="21" /></a>[/s2If][s2If !current_user_can(access_s2member_ccap_webinar3)]<strong>[Webinar2]</strong>[/s2If]

[Webinar2] is the ‘Shortcode Exe PHP’ shortcode. Here is the PHP in it.

date_default_timezone_set('Europe/London');
 
 $Webinar2 = date('16-10-2013 10:00');
 echo date('d-m-Y H:i', time()) &gt; $Webinar2 ? '<img class="alignnone size-full wp-image-1850" alt="View Button" src="http://www.thewisehippo.com/wp-content/uploads/2013/10/view-button.png" width="96" height="21" />' : '[s2Member-PayPal-Button level="*" ccaps="webinar2" desc="Webinar 2" ps="The_WiseHippo" lc="" cc="GBP" dg="0" ns="1" custom="www.thewisehippo.com" ra="0.01" rp="1" rt="L" rr="BN" image="http://www.thewisehippo.com/wp-content/uploads/2013/10/sign-up-now-button.png" output="button" /]';

The problems seems to be stage 2…if they have signed up for the event then it shows a list of downlood options but there are no downloads as the event has NOT taken place yet.

Maybe there is a way to use functioning shortcodes in the PHP in ‘Shortcode Exe PHP’ plugin. I can only get html to work in the above PHP code. If I enter the shortcodes nothing works!…just a thought!

I hope that’s enough info for ya’ll to understand my problem. Fingers crossed someone can help me here.

Many thanks


John

  • This topic was modified 3 years, 1 month ago by  John Cook.
  • This topic was modified 3 years, 1 month ago by  John Cook.

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Tuesday Nov 12th, 2013 at 5:28 pm #61053
cassel
Username: cassel

I am not that advanced in php coding but I had a similar situation where I needed some content to appear only on certain dates and then disappear to be replaced by other content. Here is a sample of the coding I used to set the time and date:

<?php
if (date("Ymd") < 20121103) {
  echo 'it is still too early for the event. Come back on November 3rd';
}
?>

<?php
if (date('H') == 22 && date("Ymd") == 20121021) {
  echo 'it is now 10pm on the 21st';
}
?>

<?php
if (date('H') < 13 && date("Ymd") == 20121022) {
  echo 'it is now before noon on the 22nd';
}
?>

<?php
if (date('H') > 12 && date("Ymd") == 20121022) {
  echo 'it is now after noon on the 22nd';
}
?>

So you can put whatever you want inside a conditional (like before date A, at midnight) and different content right after midnight. You can also include more conditionals since the PHP conditionals can be nested, so you can have all those date conditionals nested inside a “if user is logged in (and has a particular ccap)” , and offer more information “if user is not logged in”.

Do you think it would work?

Posted: Thursday Nov 14th, 2013 at 4:08 am #61122
John Cook
Username: wisehippo

Thank for that Cassel, I tried for few hours yesterday but just couldn’t get it to work though – I am not sure why. I am interested to know what you use to put your PHP code into a page/post.

The follwoing DOPES work…I add this code to a the ‘Shortcode Exe PHP’ Plugin and then add the plugins’ short code to the page/post but I am desperate to know how to add S2 Conditionals to the Can Access and Can’t Access areas int he code below. ‘Shortcode Exe PHP’ does NOT require the

<?php  ?>

Using the code below:
If it is BEFORE 10am on 13/11/20013 the Can Access is displayed
If it is AFTER 10am on 13/11/20013 then Can’t Access is displayed

date_default_timezone_set('Europe/London');
$event3 = date('13-11-2013 10:00');
echo date('d-m-Y H:i', time()) > $event3 ? 'Can access' : 'Can\'t Access';

Please help…URGENTLY….S2 Support can you???

With thanks


John

Posted: Thursday Nov 14th, 2013 at 6:10 am #61123
cassel
Username: cassel

I didn’t do anything special to put the php code: I simply use the Text tab when adding content in the WP page (not in the Visual tab).

Posted: Sunday Nov 17th, 2013 at 12:29 pm #61183

Could one use something like ShortCoder to create shortcodes which they then use to insert this code in the correct locations? I’m fairly sure it handles php code…

Thanks..

Posted: Sunday Nov 17th, 2013 at 6:58 pm #61189

What if you sold it as access to a specific page/post? The info for the webby is on it, before the events, and afterwards there is a replay or downloads or whatever…

Posted: Monday Nov 18th, 2013 at 6:04 am #61197
John Cook
Username: wisehippo

‘Shortcode Exe PHP’ does do this ‘short coding’ mentioned above but I need to get someone who can show me HOW to write the PHP to allow this to happen. These FOUR timed states!! HELP!

Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.