MyBB Community Forums

Full Version: Help ME !!!!!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
Anyone know how to add user id in a register member and in time we install MyBB, and in no way replace cp admin user id but not in the user CP,
so we login using a user id instead of using the username,
ingredients if using the username when we change the username so when we login we have to log in using the new username,
so for those who know how to create a user id in a register and in the file and install it in the admin CP

OK Thanks !!



I apologize if I was wrong post
So you want users to only be able to log in using their user ID?
yes,
but the username still exist in the user CP and Admin CP
please change the text color. it is hurting my eyes.
(2011-09-17, 04:51 AM)ShiBoys Wrote: [ -> ]yes,
but the username still exist in the user CP and Admin CP
Shouldn't be too hard to do. I'll see what I can do.
huh ,
because it is difficult to me to ask if it is not difficult I'll do alone
It actually requires a pretty large rewrite to the login scheme, though it's doable using some trickey!

Open ./member.php

Find:
$mybb->input['username'] = $mybb->input['quick_username'];

Replace with:
$mybb->input['uid'] = $mybb->input['quick_uid'];

Find:
if(!username_exists($mybb->input['username']))

Replace with:
if(!user_exists($mybb->input['uid']))

Find:
$query = $db->simple_select("users", "loginattempts", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));

Replace with:
$query = $db->simple_select("users", "loginattempts", "uid='".$db->escape_string($mybb->input['uid'])."'", array('limit' => 1));

Find:
$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);

Replace with:
$user = validate_password_from_uid($mybb->input['uid'], $mybb->input['password']);

Find:
$db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true);

Replace with:
$db->update_query("users", array('loginattempts' => 'loginattempts+1'), "uid = '".$db->escape_string($mybb->input['uid'])."'", 1, true);

And then change your template file for the login and index page to reflect "uid" instead of "username"
but I do not want to change the username into user id but i want to add a user id in the current register and in the admin CP, the admin can change user id and when you log in using user id instead of username
The steps I outlined allow you to login using your user ID, for those other things I honestly am not understanding what you want as they are all already there.

You can create new users from within the administration panel, I don't believe there is a way to use a specific ID as the ID column is unique + auto incremented (though you might be able to change the query so it inserts an ID and then add some checks to it to ensure its not taken or something). If you want something like that, it's going to take a lot more core edits.

You are entirely sure you really need this?
yes,
I really need it