How to Reset WordPress Protected Passwords

PPWP Password Suite allows your users to reset their expired passwords in the frontend of your site. Users only need to enter their email addresses and their passwords will become active again. So they don’t have to create and remember a new password.

This feature is perfect for sites that send passwords to users automatically via email marketing platforms such as ActiveCampaign or MailChimp.

Requirements:

How to reset passwords

To reset a password, the email input has to match with the one pre-defined under the “Label” column.

When users input their email into the password reset form, all expired passwords associating with this email will be reset automatically.

The new expiration time and usage limit values will be defined under your wp-config.php file.

define( 'PPWP_PWD_EXPIRY', 3 ); // days
define( 'PPWP_PWD_LIMIT', 2 ); // times of usage

If you don’t define these constants, reset passwords will never expire.

Please note that once a password is inactive, it cannot be used or reset.

Reset passwords of single pages

Use the sample shortcode below to display a password reset form anywhere on your site.

[ppwp_reset type="single" post_ids="1, 2, 3"]

This shortcode allows resetting passwords belonging to three posts with the post ids being 1, 2, 3.

The shortcode without post_ids attribute enables resetting expired passwords that match the corresponding emails in all single pages, posts, and custom post types.

Reset sitewide passwords

Use the shortcode with type=”sitewide” to reset expired sitewide passwords.

[ppwp_reset type="sitewide"]

Use custom password reset form

Instead of using our built-in shortcode to render the password reset form, you can use any contact forms which can connect with ActiveCampaign.

All that you need to do is set up automation which makes a call to our plugin API whenever an event for resting password happens, e.g. users submit a specific form.

Use the sample API below to reset all passwords belonging to post 1944 and 1916.

http://<your-website>/wp-json/ppwp-ps/v1/passwords/reset-by-email?type=single&post_ids=1944,1916

If you want to reset the sitewide passwords, use the sample API below instead.

http://<your-website>/wp-json/ppwp-ps/v1/passwords/reset-by-email?type=sitewide

Customize password reset form

Our password reset form can be translated and customized. Since there is no CSS styling, the form will match with your website theme beautifully.

In case you want to change the text form, add the following code snippet to your child theme’s functions.php and customize it to whatever you desire.

add_filter('ppwp_ps_customize_reset_form_text', 'ppwp_ps_customize_text', 10, 2);
function ppwp_ps_customize_text( $arr, $options ) {
    $arr['description'] = 'your-custom-text';
    $arr['email_label'] = 'your-custom-text';
    $arr['submit_label'] = 'your-custom-text';
    return $arr;
}
Lasted updated on May 14, 2020