Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/9d7a26ebe54fed3ea43e52588a7b786d to your computer and use it in GitHub Desktop.
Save kimwhite/9d7a26ebe54fed3ea43e52588a7b786d to your computer and use it in GitHub Desktop.
increase the minimum password strength required during membership checkout or signup
<?php
/**
* Require a Stronger Password Score for Member Registration
*
* This recipe works with the PMPro Require Strong Passwords Add On to increase
* the minimum password strength required during membership checkout or signup.
*
*
* It also customizes the message shown to members when their password is rejected.
*
* Score Reference:
* 0 = very weak
* 1 = weak
* 2 = medium
* 3 = strong
*
* Add this code to a custom plugin or a snippet manager plugin such as Code Snippets.
* See: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/**
* Set the minimum acceptable password score to 3 (strong).
*/
function my_pmprosp_minimum_password_score( $min_strength, $password_strength ) {
$min_strength = 3; // Require strong or very strong passwords.
return $min_strength;
}
add_filter( 'pmprosp_minimum_password_score', 'my_pmprosp_minimum_password_score', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment