Using S2If to display content based on EOT


I’m using s2member to offer annual memberships to a site with two different membership levels. I don’t use recurring subscriptions so people renew whenever they want to.

However, some people are asking to upgrade their membership from Level 1 to Level 2 mid-way through their annual membership.

Is there a way of using [s2if] to show different upgrade forms to people based on how far away their EOT is, e.g. if they’re in the first six months of their annual membership, they see Form A (with one price) and if they’re in the latter six months, they see Form B with a different price?

Or, is there an easier / different way of doing what I’m looking for?



I’d use the ezPHP plugin and straight PHP using get_user_field('s2member_auto_eot_time'); rather than [s2If] for this conditional. [s2If] only supports the conditional tags available in WordPress.

1 Like

I’m sorry to push this up - but I seem to be too stupid.

How can I use the get_user_field to ony echo “XXX” if EOT is less than 1 days away?

I tried the following but that is not working:

if(($s2member_auto_eot_time = get_user_field (“s2member_auto_eot_time”) <=3600 ))
echo “XXX”;

I seem to be too stupid to get that into proper PHP code

Okay - I finally got it - if anyone needs the code:

$your_date = ($s2member_auto_eot_time = get_user_field (“s2member_auto_eot_time”));
$now = time();
$datediff = ($your_date - $now);
$timeleft = round($datediff / (60 * 60 * 24));
if($timeleft >=0 && $timeleft <=8 )
echo “less than 8 days time left to EOT”;
if($timeleft >=9)
echo “More than 8 days to EOT”;
if($timeleft >=-100 && $timeleft <=-1 )
echo “EOT is in the Past - User not Demoted”;
if($timeleft <=-101)
echo “User has no EOT”;

1 Like