Including "/" in Username (legalized)

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
scepterholders
Posts: 1
Joined: 2016-12-06 14:30

Including "/" in Username (legalized)

Post by scepterholders » 2016-12-06 14:46

Please how do I make "/" to be part of my username for example "2016/GD1234/P"

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Including "/" in Username (legalized)

Post by peebee » 2016-12-07 22:43

Regex is not my thing and this is not tested but I think it should work....

Find the following in admin/incFuntions.php (around line 719 in Appgini V5.51)

Code: Select all

function is_allowed_username($username){
		$username = trim(strtolower($username));
		if(!preg_match('/^[a-z0-9][a-z0-9 _.@]{3,19}$/', $username) || preg_match('/(@@|  |\.\.|___)/', $username)) return false;
		if(sqlValue("select count(1) from membership_users where lcase(memberID)='{$username}'")) return false;
		return $username;
	}
edit this regex part of that code to include your forward slash [a-z0-9][a-z0-9 _.@]

like so: [a-z0-9][a-z0-9 \/_.@]

If that doesn't work, there are tools for checking regular expressions, like this one: https://regex101.com

Post Reply