dokan_generate_username( string $name = ‘store’ )

Description #

Generates and returns an available username. If we pass an existing username, -1, -2 or -3 will be appended at the end of the username. So if the store is already using as a username it will return store-1, if store-1 also exists it will return store-2.

Return #

(string)

Params #

$name

     (string) (optional): The name to generate the username.

      default: store

Usage #

$name = 'John Doe';
echo dokan_generate_username( $name );  // will echo JohnDoe,
                                        // if JohnDoe already exists, it will echo JohnDoe-1

Leave a Reply

Your email address will not be published. Required fields are marked *