Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ipokkel/d28dc24a9ec8ab459959d2d40414ea43 to your computer and use it in GitHub Desktop.
Save ipokkel/d28dc24a9ec8ab459959d2d40414ea43 to your computer and use it in GitHub Desktop.
<?php
/**
* Set the minimum password score for the PMPro Require Strong Passwords Add On.
*
* 1 is somewhat guessable (guesses < 10^8), provides some protection from unthrottled online attacks
* 2 is safely unguessable (guesses < 10^10), offers moderate protection from offline slow-hash scenario
* 3 is very unguessable (guesses >= 10^10) and provides strong protection from offline slow-hash scenario
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmprosp_minimum_password_score( $min_strength, $password_strength ) {
$custom_strength = 3; // Set the minimum password score here.
if ( $min_strength !== $custom_strength ) {
$min_strength = $custom_strength;
}
return $min_strength; // Set the minimum password score here.
}
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