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.

Content Dripping based on rego date

Home Forums Community Forum Content Dripping based on rego date

This topic contains 1 reply, has 2 voices. Last updated by  Raam Dev 4 years, 4 months ago.

Topic Author Topic
Posted: Tuesday Aug 14th, 2012 at 8:54 pm #22043

I was hoping I could get some help with the code required to implement this scenario for content dripping.

I have a paid membership level that people can join at any time. I will be releasing member only content once a month. When a new member joins they will have access to each month’s content (which will be a page or post) from their sign up date. So if you joined in January – you can see every month from January to now. But if you joined in May you can only see from May to now.

The Login Welcome Page will be a listing of each month with a link to that month’s content. The current month will be at the top if the page.

Is this the best approach? I need to keep it simple as I won’t be the one updating the page each month – so it needs to be a snippet of code that the user can add at the top of the page each month and just edit.

So far I have this, but I need help with the code for comparing the member’s registration date.

<?php
if (current_user_is('s2member_level1') && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME < august 01 2012) {
    echo 'This is the content for this month. Here is the link';
} 

if (current_user_is('s2member_level1') && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME < july 01 2012) {
    echo ' This is the content for last month. Here is the link.';
} 

else {
    echo 'Sorry – you need to be a member to see this content.';
}
?>

Thank you for your help!

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Wednesday Aug 15th, 2012 at 8:45 am #22082
Raam Dev
Username: Raam
Staff Member

Hi Michelle,

The S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME returns the date in Unixtime format, so you’ll need to use the PHP mktime() function to convert a date to Unixtime so that it can be compared.

Also, if you only want to show the content for that month, you’ll need to compare a date range (greater than or equal to the 1st day of this month, earlier than or equal to the last day of this month).

I’ve updated your code example to reflect these two changes:

<?php
if (current_user_is('s2member_level1') && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME >= mktime(0, 0, 0, 8, 1, 2012) && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME <=  mktime(0, 0, 0, 8, 31, 2012)) {
    echo 'This is the content for this month. Here is the link';
} 

if (current_user_is('s2member_level1') && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME >= mktime(0, 0, 0, 7, 1, 2012) && S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME <=  mktime(0, 0, 0, 7, 31, 2012)) {
    echo ' This is the content for last month. Here is the link.';
} 

else {
    echo 'Sorry – you need to be a member to see this content.';
}
?>
Viewing 1 replies (of 1 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.