S2会员专业版

I'm using a Pro API For Remote Operations php form which works well with a custom payment gateway, however, i'm stumbling at this final hurdle.

I simply want to check a user's 'wp_s2member_auto_eot_time' meta value then add a year to it.

I'm trying to use the below to achieve this but its throing up some errors.

 $startDate = get_user_meta ( $wp_s2member_auto_eot_time );
 $expire_on = date("Y", strtotime("+ 1 year, $startDate"));

This on its own works great:

 $expire_on = date("Y", strtotime("+ 1 year, $startDate"));

However, it doesnt update the existing date, it uses todays date and adds a year to it. I want it to add a year to the date that already shows in this meta value 'wp_s2member_auto_eot_time'.

Any help is hugely appreciated,

Thank you

After 'Diggy's' comment - i now have:

 $startDate = get_user_meta( $user_id, 'wp_s2member_auto_eot_time', true );
 $expire_on = date("Y", strtotime("+ 1 year, $startDate"));

This is still doing nothing though. Any help on what i have so far?

Thanks Diggy - It feels like i'm heading in the right direction.

You'll have to pass a user ID, a string for the meta key, and true as a third param to return the value of the meta field:

get_user_meta( $user_id, 'wp_s2member_auto_eot_time', true );