Hi there. Thanks for the great question.
Here is how I would handle this:1. Whenever you create your PayPal® Button Shortcode, use the "Buy Now / Lifetime" option down at the very bottom of the drop-down menu. Then change the
desc="" attribute in your Shortcode; removing references to "Lifetime". Then proceed to step #2.
2. Place a code snippet like this into the
functions.php file for your WordPress theme:
- Code: Select all
add_action(
"ws_plugin__s2member_during_configure_user_registration_front_side",
"my_fixed_EOT_time"
);
function my_fixed_EOT_time($vars)
{
$expire_on = strtotime("YYYY-MM-DD");
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
}
Just change the [
YYYY-MM-DD ] part. You could also add some conditional checks into your routine, to adjust the expiration dynamically, based on the current date, and/or any other factors that you would like to consider. If you are testing this script, you can do
print_r($vars) to get a full list of ALL defined variables that you have a reference to. There are MANY of them. $vars["user_id"] is just one.