Function __global->process_username_discriminator

Definitions

sources/cns_members_action2.php

  • Given a username, append (or change) a discriminator if the username already exists.A discriminator is a # followed by 4 random letters or numbers suffixed at the end of a username (in rare cases, it might also contain a - or _).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$username SHORT_TEXT No No required parameter N/A N/A The desired name for the member profile
$username_only boolean No No False N/A N/A Whether we just want the username without a discriminator, and $username might contain a discriminator

Returns

  • A username with a discriminator if necessary
  • Type: SHORT_TEXT
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Given a username, append (or change) a discriminator if the username already exists.A discriminator is a # followed by 4 random letters or numbers suffixed at the end of a username (in rare cases, it might also contain a - or _).
 *
 * @param  SHORT_TEXT $username The desired name for the member profile
 * @param  boolean $username_only Whether we just want the username without a discriminator, and $username might contain a discriminator
 * @return SHORT_TEXT A username with a discriminator if necessary
 */

function process_username_discriminator(string $username, bool $username_only = false) : string