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 »

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 »

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: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Uppercase nicks to lowercase

Post by AmigoJack »

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 problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: Uppercase nicks to lowercase

Post by 3Di »

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.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: Uppercase nicks to lowercase

Post by 3Di »

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.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º 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 »

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: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Uppercase nicks to lowercase

Post by AmigoJack »

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 problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: Uppercase nicks to lowercase

Post by Megakyoto »

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: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Uppercase nicks to lowercase

Post by AmigoJack »

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 problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: Uppercase nicks to lowercase

Post by Megakyoto »

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: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Uppercase nicks to lowercase

Post by AmigoJack »

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 problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
ViolaF
I've Been Banned!
Posts: 1609
Joined: Tue Aug 14, 2012 11:52 pm

Re: Uppercase nicks to lowercase

Post by ViolaF »

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
I've Been Banned!
Posts: 1609
Joined: Tue Aug 14, 2012 11:52 pm

Re: Uppercase nicks to lowercase

Post by ViolaF »

..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 »

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
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Uppercase nicks to lowercase

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here

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