MyBB Community Forums

Full Version: Can't edit username to less than 3 characters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Well you should have received access to some sort of webinterface to your database from your hosting provider, correct?
Usually this is phpMyAdmin.
So you log in to that interface and then you will see your database with all the tables of your mybb installation.
On the left in the navigation tree you click on the table "yourprefix_users" and look for the row with the user you want to change. Click on the little pencil, change the forumusername and leave everything else as it is. Save the change and your done.
Just curious, when you do try to edit the username, what error message do you get?
Is your settings.php chmoded correctly?

Last resort would be what the previous user said to just do it via phpmyadmin or any other mysql interface you may have.

In the interface, you can run a query. The query would something like this:

UPDATE mybb_users SET `username`='xx' WHERE `uid`=yy;

Where xx is the usename you want to change to and yy is the userid of the user you want to edit.

I haven't looked in the code to see if the username is needed to be changed anywhere else in the database but this is the main place the usernames are stored.

EDIT: Here is the list of queries you need to run to change the username everywhere:
UPDATE mybb_users SET `username`='xx' WHERE `uid`=yy;
UPDATE mybb_posts SET `username`='xx' WHERE `uid`=yy;
UPDATE mybb_threads SET `username`='xx' WHERE `uid`=yy;
UPDATE mybb_threads SET `lastposter`='xx' WHERE `lastposteruid`=yy;
UPDATE mybb_forums SET `lastposter`='xx' WHERE `lastposteruid`=yy;

xx is username you want to change to, yy is the userid
(2011-05-13, 08:30 AM)- G33K - Wrote: [ -> ]I haven't looked in the code to see if the username is needed to be changed anywhere else in the database but this is the main place the usernames are stored.

This method won't change it for existing threads/posts in mybb_threads and mybb_posts where the name *and* uid is stored.
(2011-05-13, 09:46 AM)linguist Wrote: [ -> ]
(2011-05-13, 08:30 AM)- G33K - Wrote: [ -> ]I haven't looked in the code to see if the username is needed to be changed anywhere else in the database but this is the main place the usernames are stored.

This method won't change it for existing threads/posts in mybb_threads and mybb_posts where the name *and* uid is stored.

Hence my disclaimer since I was pretty sure that the username is also used elsewhere in the tables just couldn't remember them off-head.

Once I get the chance to look at the source I'll update my above post with the other queries to run to take care of the username wherever its changed.
(2011-05-13, 08:30 AM)- G33K - Wrote: [ -> ]Just curious, when you do try to edit the username, what error message do you get?
Is your settings.php chmoded correctly?

Last resort would be what the previous user said to just do it via phpmyadmin or any other mysql interface you may have.

In the interface, you can run a query. The query would something like this:

UPDATE mybb_users SET `username`='xx' WHERE `uid`=yy;

Where xx is the usename you want to change to and yy is the userid of the user you want to edit.

I haven't looked in the code to see if the username is needed to be changed anywhere else in the database but this is the main place the usernames are stored.

The error message appears on the Edit User page (/admin/index.php?module=user-users&action=edit&uid=xx) after pressing the Edit User button.

The following errors were encountered:
The username you entered is of invalid length. Please enter a username between 3 and 20 characters.

I've made doubly sure that the minimum was set to 2 in the Board Settings before trying.

My settings.php is set at 644.
weird, i can create a user with a single alphabet also after setting in the admin cp minimum length =1

Try CHMOD'ing ./inc/settings.php to 666 and see if that works.
(2011-05-13, 12:10 PM)Shukaku Wrote: [ -> ]Try CHMOD'ing ./inc/settings.php to 666 and see if that works.

Nope. Sad
That 3 in the error message is the real value of the settings as mybb sees it:
//@see inc/datahandlers/user.php:102
$this->set_error('invalid_username_length', array($mybb->settings['minnamelength'], $mybb->settings['maxnamelength']));

Search for '$mybb->settings['minnamelength']' in /inc/settings.php. If that differs from the value in the AdminCP, try to deactivate all your plugins or disable the plugin system all together by adding the following line to /inc/init.php on a new line right after <?php:
define('NO_PLUGINS', 1);
Then save your settings again and check the value in the settings.php file again. If it works, it's a plugin that is causing the desync between your AdminCP settings and the settings file.
Before you try the no plugins above, can you go to the user registration settings and save them again after you chmod inc/settings.php to 666, this way if the settings file was not writable before it will update it with the current settings.

EDIT: I also updated my previous post with the sql queries that will change the username. Here they are again:

UPDATE mybb_users SET `username`='xx' WHERE `uid`=yy;
UPDATE mybb_posts SET `username`='xx' WHERE `uid`=yy;
UPDATE mybb_threads SET `username`='xx' WHERE `uid`=yy;
UPDATE mybb_threads SET `lastposter`='xx' WHERE `lastposteruid`=yy;
UPDATE mybb_forums SET `lastposter`='xx' WHERE `lastposteruid`=yy;

xx is username you want to change to, yy is the userid

Pages: 1 2