Filter
uncanny-automator-pro
automator_pro_generate_random_email_lower_alphabets
Filters the default lowercase alphabet string used by the generator when creating random emails.
add_filter( 'automator_pro_generate_random_email_lower_alphabets', $callback, 10, 1 );
Description
Filters the string of lowercase alphabets used for generating random email addresses. Developers can modify this string to include or exclude specific characters when creating random email slugs.
Usage
add_filter( 'automator_pro_generate_random_email_lower_alphabets', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Example of how to filter the allowed characters for generating random email usernames.
* This example adds a few common digits to the allowed characters.
*/
add_filter(
'automator_pro_generate_random_email_lower_alphabets',
function( $allowed_chars ) {
// Add some commonly used digits to the allowed characters for the username part.
$allowed_chars .= '0123456789';
return $allowed_chars;
},
10, // Priority: Default is 10
1 // Accepted Args: The filter callback accepts 1 argument
);
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
uncanny-automator-pro/src/integrations/generator/actions/uoa-generate-random-email.php:142
public function generate_random_email( $domain, $include_numbers = false, $prefix = '' ) {
$numeric_part = $include_numbers ? wp_rand( 1000, 9999 ) : '';
$allowed_chars = apply_filters( 'automator_pro_generate_random_email_lower_alphabets', 'abcdefghijklmnopqrstuvwxyz' );
$ran_string = substr( str_shuffle( str_repeat( $allowed_chars, ceil( 6 / strlen( $allowed_chars ) ) ) ), 1, 6 );
return "{$prefix}{$ran_string}{$numeric_part}@{$domain}";
}