ulgm_bulk_add_new_user_password_length
Filters the minimum password length for bulk-added new users.
add_filter( 'ulgm_bulk_add_new_user_password_length', $callback, 10, 1 );
Description
Filters the minimum required password length for newly added users in bulk. Developers can use this filter to enforce custom password complexity rules, increasing or decreasing the default minimum length. This hook is applied before the user is created.
Usage
add_filter( 'ulgm_bulk_add_new_user_password_length', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Filter the default minimum password length for bulk added users.
*
* This example increases the minimum password length to 10 characters.
*
* @param int $default_length The default minimum password length.
* @return int The modified minimum password length.
*/
add_filter( 'ulgm_bulk_add_new_user_password_length', function( $default_length ) {
// Increase the minimum password length to 10 characters.
$new_length = 10;
return $new_length;
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/classes/group-management/management-group-multi-add-users.php:117
src/classes/group-management/class-group-management-helpers.php:173
$validation_errors = apply_filters( 'ulgm_bulk_add_new_user_validation', array(), $user_data, 'bulk_add_users', $k );
if ( is_array( $validation_errors ) && ! empty( $validation_errors ) ) {
$error_results = array_merge( $error_results, $validation_errors );
continue;
}
$password_length = absint( apply_filters( 'ulgm_bulk_add_new_user_password_length', 6 ) );
if ( false === is_numeric( $password_length ) || $password_length <= 0 ) {
$password_length = 6;
}
if ( ! empty( $pass ) && strlen( $pass ) < $password_length ) {
$password_length_warnings[] = sprintf( __( 'Line #%1$d: Password did not include at least %2$d characters and was replaced with an auto-generated password.', 'uncanny-learndash-groups' ), $k + 1, $password_length );