Is there a way to ban certain words from being used as nicknames? ie, Admin, Administrator, Owner, Webmaster, swearwords, etc.
There was a post about a year ago regarding this issue, but I tried the solution and no luck. It looks like the registration process is done through AJAX (perhaps only since v6) and is a little too complex for me to figure out myself...
Thanks. |
This is a good idea for another reason. Since the usernames also form the url, you could use such a blocking feature to make sure people don't take the name of a directory that already exists. So for example if someone picked the username "tools" for some reason, but you already had a directory called mysite/tools maybe something like this would help. Unless it already exists? If you have installed Dolphin in the root, and someone picks a username with the same name as one of your directories what happens? Rob |
Dolphin sorta kinda has something built in that we can use for this.. if you go in admin and then "builders" and "fields builder" you will see the join form builder. Click on "nickname" and then at the top of that box click on "advanced".. you will see this:
return ( preg_match( '/^[a-zA-Z0-9_-]+$/', $arg0 ) and !file_exists( $dir['root'] . $arg0 ) );
This is what Dolphin uses to check that a nickname is only numbers and letters and that it isn't a root directory... if we add this:
and !strstr($arg0,"rumproast")
then it will also check for the word in quotes... so you end up with this:
return ( preg_match( '/^[a-zA-Z0-9_-]+$/', $arg0 ) and !file_exists( $dir['root'] . $arg0 ) and !strstr($arg0,"rumproast"));
Now I know that box is going to get messy when you add about 20 or 30 of those conditional statements but this is an easy way to do it without changing any Dolphin code :-) Oh and don't forget to leave that ); at the end after you add your statements.
Mike BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin |
Wow that worked great thanks alot! I used this return ( preg_match( '/^[a-zA-Z0-9]+$/', $arg0 ) and !file_exists( $dir['root'] . $arg0 ) and !strstr($arg0,"-") and !strstr($arg0,"admin")and !strstr($arg0,"administrator") and !strstr($arg0,"_") and !strstr($arg0,"Owner") and !strstr($arg0,"fuck") and !strstr($arg0,"cunt") and !strstr($arg0,"webmaster") and !strstr($arg0,"guest")); I wanted to get rid of _ and - as well. :) |
You're welcome :-) BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin |
Hey mscott, DialMe.com - Your One and Only Source For Boonex Dolphin Tutorials and Resources |
Thank you Mike :-) This is a really useful post :-) Life is a fatal disease, sexually transmissible - Virginity is carcinogenic! Ask here for vaccine. |
So how would you do it to prevent a username of all numbers since this |
Dear all, i'd like that user could put in the nickname the following caracters: éèòàùì and more. Where can I add it? I tried to add here: return ( preg_match( '/^[a-zA-Z0-9_-]+$/', $arg0 ) and !file_exists( $dir['root'] . $arg0 ) ); but it didnt work. Thanks a lot |
Thanks Mike!! |
cool.. that sorted it :) |
Okay - here is a little function I wrote to use in dolphin - first - open utils.inc.php, goto the bottom and right before the last ?> add this function: function lookUpByArray($l_arr, $sCheck){ if ( $ID ) Add this: $badNicks = Array('*fuck*','shit','bitch'); Explanation of $badNicks array - you can use the * for any wildcards -example: fuck* will match fuckit fucker fuckstick, but not itfuck and *fuck matches ifuck itfuck wefuck, but not fucker So *fuck* covers all bases. You can add as many words as you like - just remember, always end the array without the comma - 'xxxx','xxxx','xxxx',) is wrong ('xxxx','xxxx','xxxx') is correct. Enjoy :) As always, simple and sweet - php is the instrument, I'm the artist :) Chris |
This must also be applied for the above filter to work: Okay - goto admin panel, field builder, click NickName, advanced - replace this: return ( preg_match( '/^[a-zA-Z0-9_-]+$/', $arg0 ) and !file_exists( $dir['root'] . $arg0 ) ); with return ( preg_match( '/^[a-zA-Z0-9_-]+$/', $arg0 ) && conf_nick($arg0) ); |
Topher, That works great except when you want to change the membership status of the person. When you go to save, it shows the NICKNAME as being already used and you would have to change it. If you delete all those changes that you recomended, it will save just fine. Maybe there is a way for that not to happen? |
I am having the same problem, I cannot upgrade memberships. Any solutions? Topher, That works great except when you want to change the membership status of the person. When you go to save, it shows the NICKNAME as being already used and you would have to change it. If you delete all those changes that you recomended, it will save just fine. Maybe there is a way for that not to happen? There are none so blind as those that will not see. |
Yes, it appears the reason is because on resave it evals the checksum. What is the name of the php file (in your url) when this error occurs. I have an idea :) Chris |
pedit.php?ID=35 Regards, Stuart I am having the same problem, I cannot upgrade memberships. Any solutions? Topher, That works great except when you want to change the membership status of the person. When you go to save, it shows the NICKNAME as being already used and you would have to change it. If you delete all those changes that you recomended, it will save just fine. Maybe there is a way for that not to happen? There are none so blind as those that will not see. |
Hello Topher, is there a fix for this error? Regards, Stuart I am having the same problem, I cannot upgrade memberships. Any solutions? Topher, That works great except when you want to change the membership status of the person. When you go to save, it shows the NICKNAME as being already used and you would have to change it. If you delete all those changes that you recomended, it will save just fine. Maybe there is a way for that not to happen? Yes - I think this will work - try it and report :) Inside of the conf_nick function - add this: (before any other part of the function). global $logged; if ($logged['admin']){return true;} |
Hello Topher, is there a fix for this error? Regards, Stuart I am having the same problem, I cannot upgrade memberships. Any solutions? Topher, That works great except when you want to change the membership status of the person. When you go to save, it shows the NICKNAME as being already used and you would have to change it. If you delete all those changes that you recomended, it will save just fine. Maybe there is a way for that not to happen? Yes - I think this will work - try it and report :) Inside of the conf_nick function - add this: (before any other part of the function). global $logged; if ($logged['admin']){return true;} I am not sure exactly where to paste code. I had an error with (utils.inc.php): /* Added badnick function (also in profiles.inc.php) */ There are none so blind as those that will not see. |
Wrong function :) In profiles.inc.php change: function conf_nick($nick, $ID = 0 ) function conf_nick($nick, $ID = 0 ) That should work - let me know. |
Nice one! works like a dream!! Many thanks Stuart Wrong function :) In profiles.inc.php change: function conf_nick($nick, $ID = 0 ) function conf_nick($nick, $ID = 0 ) That should work - let me know. There are none so blind as those that will not see. |
GREAT! ! |