outputting end of term

My site has both automatic EOTs from PayPal and manual EOTs from people paying by cheque. So far as I can determine, these values are kept in different fields and I'm not clear exactly which fields are the most appropriate to use. Right now I've made this shortcode:
But I have a feeling that s2member has something that already does the above. I just can't find it. Is there such a thing, and if there is not, am I using the correct fields in my function?
Thanks,
Jen
- Code: Select all
function ASH_expiry_func( $atts ) {
$ts=get_user_field ("s2member_auto_eot_time");//EOT set manually
if(!$ts){
$ts=get_user_field(s2member_last_payment_time);//user paid by PayPal
if(current_user_can('administrator')){//admin will have no $ts
return 'n/a';
} else{
$eot=new DateTime("@$ts");
$eot->modify('+1 year');
}
} else {
$eot = date_create("@$ts");
}
return $eot->format('Y-m-d');
}
add_shortcode( 'ASH_expiry', 'ASH_expiry_func' );
But I have a feeling that s2member has something that already does the above. I just can't find it. Is there such a thing, and if there is not, am I using the correct fields in my function?
Thanks,
Jen