Thank-you for reporting this important issue.
The code within this forum post is meant to mimic the way that s2Member’s Content Dripping works. A content drip based on s2Member’s default start date (S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
) would look like this:
<?php if(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS >= 30){ ?>
Drip content to Members that started paying you at least 30 days ago.
<?php } ?>
To use Content Dripping, or any PHP code within a WordPress Post/Page, you will need a plugin that allows you to execute PHP. Try
PHP Execution.
To mimic s2Member’s Content Dripping, you first need to establish the start point for your new content dripping (Note: These are Unix timestamps. See: http://www.unixtimestamp.com/).
You can find info in this post regarding creating/updating s2Member’s Custom Profile/Registration Fields, if that is how you’d like to save your start time.
Example:
<?php
$start_date = get_user_field('STDATE'); //Note: This assumes that you've saved your Start Date in s2Member's Custom Registration/Profile Fields array, as STDATE. If you have not, you will need to change this.
$start = strtotime('today', $start_date);
[/hilite]
Now, to find the amount of time that has elapsed between the time that you have set up, and now, you will want to subtract the time now from the start time. Timestamps are based on seconds, so to find the number of days between, you'll need to divide the remaining time by [hilite mono]864900[/hilite] ([hilite mono]24 hours[/hilite] x [hilite mono]60 minutes[/hilite] x [hilite mono]60 seconds[/hilite]).
The previous post does this on the fly. For clarity, I've changed the way that this is handled below.
<h5>Example:</h5>
<?php
$start_date = get_user_field('STDATE'); //Note: This assumes that you've saved your Start Date in s2Member's Custom Registration/Profile Fields array, as STDATE. If you have not, you will need to change this.
$start = strtotime('today', $start_date);
$now = time();
$time_to_check = ($now – $start)/86400; //Now, minus the start time, converted to days by dividing by 86400
[/hilite]
The above uses the Custom Profile/Registration Field [hilite code]'STDATE'[/hilite] to assign the variable [hilite code]$time_to_check[/hilite] a value. This value can now be used in place of s2Member's [hilite code]S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS[/hilite] within the page that you have set this up with.
<h5>Example of finished custom Content Drip:</h5>
<?php
$start_date = get_user_field('STDATE'); //Note: This assumes that you've saved your Start Date in s2Member's Custom Registration/Profile Fields array, as STDATE. If you have not, you will need to change this.
$start = strtotime('today', $start_date);
$now = time();
$time_to_check = ($now – $start)/86400; //Now, minus the start time, converted to days by dividing by 86400
?>
<?php if($time_to_check >= 7){ ?>
Drip content to Members that have spent at least 7 days on your site, after the custom field had been created.
<?php } ?>
The above code snippet should work correctly for you. Let us know if problems persist.