Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2010-01-18 11:53:38

scalemaster
Member
From: Russia, Balakovo
Registered: 2010-01-18
Posts: 5

Change username himself

Subj
Same as there

Offline

#2 2010-01-18 12:00:58

Reines
Lead developer
From: Scotland
Registered: 2008-05-11
Posts: 3,165
Website

Re: Change username himself

If you need help modifying your board to do this then let me know what version you're running and I can point you in the right direction. It isn't a feature that we are going to add to FluxBB itself though.

Offline

#3 2010-01-18 14:22:31

scalemaster
Member
From: Russia, Balakovo
Registered: 2010-01-18
Posts: 5

Re: Change username himself

Reines
My currently board version is 1.4-beta2. But migration to 1.4-rc1 soon.
Thanks!

--upd
Version not important. I am applying the principle to any version.

Last edited by scalemaster (2010-01-18 14:40:15)

Offline

#4 2010-01-18 14:48:59

Reines
Lead developer
From: Scotland
Registered: 2008-05-11
Posts: 3,165
Website

Re: Change username himself

This is totally untested, but give it a try...

In profile.php:

Find (around like 686):

                // Are we allowed to change usernames?
                if ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_rename_users'] == '1'))
                {
                    $form['username'] = trim($_POST['req_username']);
                    $old_username = trim($_POST['old_username']);

                    if (strlen($form['username']) < 2)
                        message($lang_prof_reg['Username too short']);
                    else if (pun_strlen($form['username']) > 25) // This usually doesn't happen since the form element only accepts 25 characters
                        message($lang_common['Bad request']);
                    else if (!strcasecmp($form['username'], 'Guest') || !strcasecmp($form['username'], $lang_common['Guest']))
                        message($lang_prof_reg['Username guest']);
                    else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $form['username']) || preg_match('/((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))/', $form['username']))
                        message($lang_prof_reg['Username IP']);
                    else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $form['username']))
                        message($lang_prof_reg['Username BBCode']);

                    // Check that the username is not already registered
                    $result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE username=\''.$db->escape($form['username']).'\' AND id!='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
                    if ($db->num_rows($result))
                        message($lang_profile['Dupe username']);

                    if ($form['username'] != $old_username)
                        $username_updated = true;
                }

Move it to below (around line 679):

$form = extract_elements(array('timezone', 'dst', 'language', 'time_format', 'date_format'));

Find (part of the chunk you just moved!):

if ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_rename_users'] == '1'))

Replace with:

if ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_rename_users'] == '1') || $pun_user['id'] == $id)

Find (around line 1057):

if ($pun_user['g_id'] == PUN_ADMIN || $pun_user['g_mod_rename_users'] == '1')

Replace with:

if ($pun_user['g_id'] == PUN_ADMIN || $pun_user['g_mod_rename_users'] == '1' || $pun_user['id'] == $id)

PS. These line numbers are taken from the latest SVN version so may not be exactly the same in beta-2, but they should be close at least.

Offline

#5 2010-01-18 14:55:26

scalemaster
Member
From: Russia, Balakovo
Registered: 2010-01-18
Posts: 5

Re: Change username himself

Oh, great!
The experiment will later, OK?

Offline

Board footer

Powered by FluxBB 1.5.0