- 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