Uppercase nicks to lowercase

Discussion forum for MOD Writers regarding MOD Development.
User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Uppercase nicks to lowercase

Post by Megakyoto » Sat Sep 19, 2015 11:57 pm

Hi again. I really don't know why but I hate uppercase nicks so I'd like to convert them to lower when they're longer than 4 chars. Don't ask me why, call it a mania.

Where exactly in the ucp file is the validation of the nick? Or is it in any other imported library?

Thanks.

User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: Uppercase nicks to lowercase

Post by Megakyoto » Sun Sep 20, 2015 3:57 am

Ok done.

In includes/ucp/ucp_register.php after $data = array(...

Code: Select all

// UPPERCASE nicks will be converted to lowercase
if($data['username']==strtoupper($data['username'])){
    $data['username'] = strtolower($data['username']);
}

User avatar
AmigoJack
Registered User
Posts: 4999
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Uppercase nicks to lowercase

Post by AmigoJack » Mon Sep 21, 2015 11:08 am

This is utmost wrong:
  1. wrong forum: you don't even say which version you're using
  2. wrong method: you'll break UTF-8
  3. wrong place: usernames can change
  4. wrong approach: why not using CSS to only "cure" what you have a problem with: the display?
  5. wrong behaviour: you're enforcing others your taste, without thinking about what you don't want to be forced to
The worst thing about censorship is ███████████

User avatar
3Di
Registered User
Posts: 11869
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Re: Uppercase nicks to lowercase

Post by 3Di » Mon Sep 21, 2015 12:10 pm

Megakyoto wrote:Ok done.

In includes/ucp/ucp_register.php after $data = array(...

Code: Select all

// UPPERCASE nicks will be converted to lowercase
if($data['username']==strtoupper($data['username'])){
    $data['username'] = strtolower($data['username']);
}
AmigoJack wrote:you're enforcing others your taste, without thinking about what you don't want to be forced to
following the amigojack's concept, that's IMHO common sense, you should create a condition.. like:

Code: Select all

if(($data['user_id'] = 'YOUR USER_ID' || $data['username'] == strtoupper($data['username']))
{
do your magic here... ;
}
 
Not tested, anyway the concept is: if you are logged in you will be able to see those usernames as you wish.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
3Di
Registered User
Posts: 11869
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

Re: Uppercase nicks to lowercase

Post by 3Di » Mon Sep 21, 2015 12:29 pm

of course the above NOT tested code doesn't go into includes/ucp/ucp_register.php .. maybe ;)

it is just a kind of 'proof of concept', so to speak.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: Uppercase nicks to lowercase

Post by Megakyoto » Tue Sep 22, 2015 3:22 am

There is more to my uppercase mania. I also hate subjects or messages in uppercase, so I'll put a condition if 80% of the subject or message is uppercase to change it to lowercase.

Basic netiquette.

User avatar
AmigoJack
Registered User
Posts: 4999
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Uppercase nicks to lowercase

Post by AmigoJack » Tue Sep 22, 2015 6:58 am

That will not only break UTF-8 but also URIs and anything else that's case sensitive, no matter if caps rage or not. But you'll surely go on ignoring what you don't understand.
The worst thing about censorship is ███████████

User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: Uppercase nicks to lowercase

Post by Megakyoto » Thu Sep 24, 2015 2:01 am

I may not understand it right now but that does not mean there is a need and it will be met.

So UTF-8 is not an excuse.

User avatar
AmigoJack
Registered User
Posts: 4999
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Uppercase nicks to lowercase

Post by AmigoJack » Thu Sep 24, 2015 7:07 am

You're tampering the data and totally changing its information: https://en.wikipedia.org/wiki/lun is another request than https://en.wikipedia.org/wiki/LUN. And for your rest you're only affecting latin letters. GOOD LUCK WITH THIS TEXT.
The worst thing about censorship is ███████████

User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: Uppercase nicks to lowercase

Post by Megakyoto » Sat Sep 26, 2015 7:55 pm

AmigoJack wrote:You're tampering the data and totally changing its information: https://en.wikipedia.org/wiki/lun is another request than https://en.wikipedia.org/wiki/LUN. And for your rest you're only affecting latin letters. GOOD LUCK WITH THIS TEXT.
For the records I only lowercase whatever is outside brackets and will fix the url issue since there is an autolink feature I forgot.

For anything other than plain ascii I'd ban the troll for subverting the rules.

I love this forum. :D

User avatar
AmigoJack
Registered User
Posts: 4999
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Uppercase nicks to lowercase

Post by AmigoJack » Sun Sep 27, 2015 12:19 am

Which brings up the question why you won't "solve" your initial problem with banning as well. Just don't blame people for being able to write names in their original form, like México, Straßburg, Москва́, ירושלים or 東京.
The worst thing about censorship is ███████████

User avatar
ViolaF
Registered User
Posts: 1374
Joined: Tue Aug 14, 2012 11:52 pm

Re: Uppercase nicks to lowercase

Post by ViolaF » Sun Sep 27, 2015 12:13 pm

http://php.net/manual/en/function.mb-st ... php#105753 *

If you dont need this * signs to convert to a lower counterpart
use always min. mb_strtolower() ** function, which preserve near all utf-8 letters:

Code: Select all

mb_strtolower($data['username'], 'UTF-8');
** http://php.net/manual/en/function.mb-strtolower.php

and to detect use mb_strtoupper($str, 'UTF-8'); *** ;)

*** http://php.net/manual/en/function.mb-strtoupper.php

Code: Select all

// UPPERCASE nicks will be converted to lowercase
if($data['username'] == mb_strtoupper($data['username'], 'UTF-8')){
    $data['username'] = mb_strtolower($data['username'], 'UTF-8');
}

User avatar
ViolaF
Registered User
Posts: 1374
Joined: Tue Aug 14, 2012 11:52 pm

Re: Uppercase nicks to lowercase

Post by ViolaF » Sun Sep 27, 2015 12:22 pm

..or do it just with CSS ;)

Put this in one of the main-css files, which works global:

Code: Select all

.username {
    text-transform: lowercase;
}
because the username-display is always using the class: username

Code: Select all

<a class="username" href="./memberlist.php?mode=viewprofile&u=1506761">Megakyoto</a>

User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: Uppercase nicks to lowercase

Post by Megakyoto » Sun Sep 27, 2015 4:15 pm

ViolaF wrote:If you dont need this * signs to convert to a lower counterpart
use always min. mb_strtolower() ** function, which preserve near all utf-8 letters
That's the right answer. Thanks.


Regarding CSS as suggested by other users, that's not an option, there are plenty of names with multiple words correctly capitalized where all lower would look horrible.

Perhaps some of definitely don't understand the issue since in this forum everybody behaves in a civilized manner, but believe me when I tell you if you start seeing THETROLLESTOFTHETROLLS or THEKINGOFTHEVAGINAS as nicks everywhere you would start reconsidering.

Remember most options are not against civilized user but agains trolls, in all their incarnations.

User avatar
david63
Jr. Extension Validator
Posts: 13154
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Uppercase nicks to lowercase

Post by david63 » Sun Sep 27, 2015 4:30 pm

Megakyoto wrote:Perhaps some of definitely don't understand the issue since in this forum everybody behaves in a civilized manner, but believe me when I tell you if you start seeing THETROLLESTOFTHETROLLS or THEKINGOFTHEVAGINAS as nicks everywhere you would start reconsidering.
If that is your problem then you are "shutting the stable door after the horse has bolted".

Stop it at source and you will have no need for all of this.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

Locked

Return to “[3.0.x] MOD Writers Discussion”

Who is online

Users browsing this forum: No registered users and 6 guests

cron