How it works...
WordPress doesn’t provide features for password expiry. Therefore, we can’t automatically expire or remove a user's password. So, we had to build a custom process where we defined an expiry date and asked the user to reset it and block logins until the reset is completed.
The first step is to add an expiry date to the password for each user. There are three events where the password is assigned or changed in WordPress. So, we have to add an expiry date to all three events where the password will be changed.
In step 2, we used the user_register action to call a custom function called wpcpp_ch12_register_password_expire_reset. This action is executed after creating a new user from the frontend or backend. So, we used the function ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access