Update_user_option on successful login


We have an admin controlled user system where there are roles, but not open registration. We would like to do 2 things.

  1. add a required “terms agreement” checkbox to all login forms
  2. update a custom field in the user profile to show it has been checked

I cannot see how to add anything to the s2Member login form, but was able to add something to the normal WP login form, so need to get this sorted out.

I also can’t seem to get the update_user_option to fire at the correct time after we have a valid login.

I tried using the wp_login hook but it wasn’t impacted by the s2Member login form or custom role users.

I’ve also tried wp_authenticate, but this can’t return a logged in user before firing because of the firing order.

Any suggestions on both adding the custom field to the login form AND updating the value in the user profile after successful login?

Using Pro forms you can add terms agreement to the registration form. There is no out-of-the-box support for conditional login in s2member.

Regarding hooks see https://www.s2member.com/codex/stable/s2member/package-filters/