Purpose
The username_helper function in UserSpice is used to generate a unique username based on the provided first name, last name, and email address.
Location
users/helpers/us_helpers.php
Parameters
#
Parameter
Data Type
Required
Description
1
$fname
string
Yes
The first name of the user.
2
$lname
string
Yes
The last name of the user.
3
$email
string
Yes
The email address of the user.
*
Returns
Data Type
Description of Returned Data
string
The generated unique username, or false if an error occurs.
Further Documentation:
Copy
// Generate a unique username for a user
$firstName = "John";
$lastName = "Doe";
$email = "johndoe@example.com";
$username = username_helper($firstName , $lastName , $email );
echo "Generated username: " . $username ;
In the example above, the function is called to generate a unique username for a user with the given first name, last name, and email address. The generated username is then stored in the variable
$username and can be used or displayed as needed.