Username Generator: Difference between revisions

From UmsWiki
Jump to navigation Jump to search
Kia (talk | contribs)
Kia (talk | contribs)
 
(11 intermediate revisions by 2 users not shown)
Line 16: Line 16:
[[File:UsernameGenerator Options AddString.jpg|none|thumb|765x765px]]
[[File:UsernameGenerator Options AddString.jpg|none|thumb|765x765px]]


===== Start index =====
===== Append =====
Append string to end.
 
=====Start index=====
This lets you specify the position in the string to insert "'''String to add'''". "'''String to add'''" will be appended if start index is larger than the length of the string.  
This lets you specify the position in the string to insert "'''String to add'''". "'''String to add'''" will be appended if start index is larger than the length of the string.  


====AutoNumber====
====AutoNumber====
This option lets you add a number to the username.
This option lets you add a number to the username.
[[File:UsernameGenerator Options AutoNumber.jpg|none|thumb|656x656px]]
[[File:UsernameGenerator Options AutoNumber.jpg|none|frame]]
 


You can define the starting number and pad left to make sure it has the correct length.
You can define the starting number and pad left to make sure it has the correct length.


If you set the start number to 1 and set pad left to 4, the number will be 0001
If you set the start number to 1 and set pad left to 4, the number will be 0001
If you check "'''Skip number on first occurence'''" it will not add the generated number string to the first username.


This number will automatically increase when a duplicate string is found in username.
This number will automatically increase when a duplicate string is found in username.
Line 74: Line 78:


-
-
.
[[File:UsernameGenerator Options ReplaceAllNonAlphanumeric.jpg|none|thumb|765x765px]]
[[File:UsernameGenerator Options ReplaceAllNonAlphanumeric.jpg|none|thumb|765x765px]]


Line 82: Line 88:
This uppercases the username.
This uppercases the username.
[[File:UsernameGenerator Options UpperCase.jpg|none|thumb|656x656px]]
[[File:UsernameGenerator Options UpperCase.jpg|none|thumb|656x656px]]
====Add random string of chars====
This option lets you add a fixed string to the username
[[File:UsernameGenerator Options AddRandomChars.jpg|none|frame]]
===== Characters to use from =====
Enter the characters to choose from when generating the string
===== Number of Characters =====
Choose the length of string
===== Append =====
Append string to end.
=====Start index=====
This lets you specify the position in the string to insert "'''String to add'''". "'''String to add'''" will be appended if start index is larger than the length of the string.
==== UniLogin ====
[[File:UsernameGenerator Options UniLogin.jpg|none|frame]]The value of UniLogin/UniID is only used if its 8 characters long.
The options added after this is in the setting will not be processed if it is 8 charaters long.
If the user does not have a UniLogin/UniID they will not get a username in UMS.
If UniLogin is found for user UMS will not check in SLI table for an existing username.
'''Pseudo logic'''
If <unilogin> is null -> Stop processing this user
If <unilogin> is 8 characters long, take <unilogin> as username and stop processing any other rules.
if <unilogin> is 10 characters long, does nothing with <unilogin> and start username generator logic


==Database replacements==
==Database replacements==
Line 131: Line 170:
Pad right 2 (J Hansen)  Username = JFHA
Pad right 2 (J Hansen)  Username = JFHA
[[File:Imagesdf.png|none|thumb|514x514px]]
[[File:Imagesdf.png|none|thumb|514x514px]]


Pad Right 4 (Jan H)  Username = JAHF
Pad Right 4 (Jan H)  Username = JAHF

Latest revision as of 12:55, 14 September 2023

This is used to generate usernames for users in UMS.

Steps

First you need to create some options for the setting your going to create later on.

Then add the database replacements.

Then create a setting with a list of prioritized options.

Finally add a username setting to the template that needs this.

Options

AddString

This option lets you add a fixed string to the username

Append

Append string to end.

Start index

This lets you specify the position in the string to insert "String to add". "String to add" will be appended if start index is larger than the length of the string.

AutoNumber

This option lets you add a number to the username.

You can define the starting number and pad left to make sure it has the correct length.

If you set the start number to 1 and set pad left to 4, the number will be 0001

If you check "Skip number on first occurence" it will not add the generated number string to the first username.

This number will automatically increase when a duplicate string is found in username.

eg - If the username starts with AB then it will return AB0001

AB0001 (first instance autonumber)

AC0001 (first instance autonumber)

AD0001 (first instance autonumber)

AB0002 (next instance autonumber)

The username number is stored in the database in the table "UsernameGenerator_Numbers"

DBField

This option lets you take a field from the database table ImportFromDB and use as a starting string.

LowerCase

This lowercases the username.

Pad

This lets you pad the username either left or right with a character you specify and a length.

If you pad 12 right and the username is AB it will return ABkkkkkkkkkk.

Replace

This lets you replace characters in the username with new characters or blank.


If you check "Use replace from database table" it will use this feature "Database replacements".


Replace all non alphanumeric

This will replace all characters in the username that are not within these ranges with the new string or blank

a-z

A-Z

0-9

-

.

Substring

This will replace a part of the username with a new string or blank.

Uppercase

This uppercases the username.

Add random string of chars

This option lets you add a fixed string to the username

Characters to use from

Enter the characters to choose from when generating the string

Number of Characters

Choose the length of string

Append

Append string to end.

Start index

This lets you specify the position in the string to insert "String to add". "String to add" will be appended if start index is larger than the length of the string.

UniLogin

The value of UniLogin/UniID is only used if its 8 characters long.

The options added after this is in the setting will not be processed if it is 8 charaters long.

If the user does not have a UniLogin/UniID they will not get a username in UMS.

If UniLogin is found for user UMS will not check in SLI table for an existing username.

Pseudo logic

If <unilogin> is null -> Stop processing this user

If <unilogin> is 8 characters long, take <unilogin> as username and stop processing any other rules.

if <unilogin> is 10 characters long, does nothing with <unilogin> and start username generator logic

Database replacements

Define the strings you want to have replace with new or blank string.

When it looks at a username it will run through all the rows and replace them if they are found.


Example as uni-login

2 first letters of first name followed by 2 first letters of last name and Autonumber.

Create these Option:

  • First name: Create option that retrieves first name from DBfield
  • Last Name : Create option that retrieves last name from DBfield
  • AutoNumber : Create option autonumber. As shown below in Autonumber picture
  • DB Replace: Create option DB replace, which change å, ø, å etc. As shown below in DB Replacement picture.
  • First 2 characters : Create option take first 2 characters. As shown below in first 2 characters picture.
  • First 4 characters : Create option take first 4 characters. As shown below in first 4 characters picture.
  • Pad Right 2: Create option Pad Right 2. As shown below in Pad Right 2 picture.
  • Pad Right 4: Create option Pad Right 4. As shown below in Pad Right 4 picture.
  • Replace all non alphanumeric
  • LowerCase ALL


Vicktor Jeppesen : VIJE0123

Tonny Thomsen : TOTH0124

Sultan Kirkegård SUKI0125


Autonumber starts at 123 and runs up. Padding character 0 and pad length 4. e.g. Sultan Kirkegård S U K I 0 1 2 3


DB Replacement.


First 2 characters.


First 4 characters

Pad right 2 (J Hansen) Username = JFHA

Pad Right 4 (Jan H) Username = JAHF


Settings

This is where you create a prioritized list options. This setting is then attached to a template.