What hooks to use after EOT system events, upgrade, renewals?

Hello,
I need to insert data , update_user_option() , into a custom user profile field when they are demoted, renew or change their membership level.

I have tried hooking my function like this:

    add_action('ws_plugin__s2member_after_auto_eot_system', 'efti_membership_status_update');
add_action('ws_plugin__s2member_during_auto_eot_system_during_demote', 'efti_membership_status_update');

However it doesn’t seem to have fired.

Can anyone point out what hooks I could use to catch any membership upgrades, downgrades or renewals and run an action after?

Thanks

I suggest set_user_role. See https://developer.wordpress.org/reference/hooks/set_user_role/

Thanks. I used this in one case and it works great.

However it produces strange results when trying to capture the members last EOT date into an S2 Custom Field (I am doing this because I need to save it as a human readable date that can be exported with the user.) It seems like set_user_role() fires immediately on EOT, but there is a delay between that and when S2 member updates the EOT time and the Last EOT time. For example, when I use this:

get_user_field('s2member_last_auto_eot_time', $user_id)

and I hook it on set_user_role() I get : 01 January, 1970, every time.

If I wait for 10 minutes or so and run my function manually by hooking it to: edit_user_profile_update(), then s2member_last_auto_eot_time inserts the correct last EOT time.

Any thoughts on why this is?

The hook is fine. You need to change the priority of your function. It’s firing before s2Member. You need to make it fire later.