PDA

View Full Version : Possible to use "Real Name" instead of Username?


Jabong82
03-07-2010, 03:10 AM
Is it possible in Vbulletin for users to have their real name as userIDs instead of some made up username? That way when they post in Forums their real name is shown instead of some made up name (just like a facebook or myspace etc)

Can we register them with real names?

Basically in the registration form, we would change "username" to real name, but I would think Vbulletin would have a problem because obviously two people can have the same name and it wouldn't allow it.

Is there any way around this? I know that we can allow people to use their email to login, but I don't see how I can get around the duplicate usernames.

Thanks in advance.

TimberFloorAu
03-07-2010, 05:21 AM
What difference does it make?

You only need to change the phrase username to realname just to keep things clean. Couple of templated edits, asking for people to enter their real name instead of a user name. Done.

Forum will not allow 2 people with same username or realname it makes little difference. They would have to add a middle initial or something.

However I think its a BAD move to get people to post their full name !
Unless you are a BY invitation only site, and even do it is begging security issues

Jabong82
03-07-2010, 07:14 AM
Thank you for your response. I guess its back to the drawing board!

Videx
03-08-2010, 01:39 AM
their real name is shown instead of some made up name (just like a facebook or myspace etc)You are mistaken. Neither FB nor Myspace force users to use 'real' names. Many do, but many make up names as well. There's nothing currently preventing your users from using 'real sounding' names. You're looking for a technical solution for a problem that doesn't exist.

Jabong82
03-08-2010, 05:01 AM
Hello thank you for your response.

I was doing some research into this and I saw there was a hack a long time ago about being able to use aliases ie login with "xxxx" but "yyyy" is displayed everywhere.

I saw that the hack was for an old version, is there anything like this available for 4.0?

Basically I would want people to be able to use their own names as opposed to some usernames when displayed. Thank you.

TimberFloorAu
03-08-2010, 06:32 AM
May I ask why you want people to use their real Names ?

Jabong82
03-08-2010, 06:49 AM
I use am interested in adding a social feed to my site (similar to facebook), and I would prefer if real names were to show up rather than usernames so its easier for people to keep track of each other.

shutterfreak
09-05-2010, 06:58 AM
I believe what the topic started meant, was a means to always render a display name (screen name) on the boards, and use the login name only for logging onto the boards. The display name can be the real name or any other handle a member uses on the Net.

I bet this will be much simpler to implement than hunting for all occurrences of user name and replacing them with something else. The problem is: how?

I think a solution is to modify the user table and add a displayname column and an unique index on this column. The vBulletin authentication and access control code would then the only consumer of the username field.

FWIW I also came across the vBulletin 2/3 hack to display a profile field instead of the user name (http://www.vbulletin.com/forum/showthread.php?45174-HOW-Use-a-display-name-instead-of-a-username). However the hack cannot readily be applied on vBulletin 4 since I believe the template engine changed in vBulletin 4 (the variable names and the syntax are different).

--------------- Added 1283720093 at 1283720093 ---------------

I made it work on vBulletin 4.0.6. This patch basically authenticates the login name instead of the user name. It requires adding one column to the user table and an edit of a core vBulletin file. Hence the following warning:

WARNING: DO NOT ATTEMPT THE FOLLOWING IF YOU ARE NOT ACQUAINTED WITH SQL AND PHP.

Step 1: add an indexed loginname column to the user table and to the strikes table:
ALTER TABLE user ADD loginname varchar(100) NOT NULL DEFAULT '';
CREATE INDEX loginname ON user(loginname);
ALTER TABLE strikes ADD loginname varchar(100) NOT NULL DEFAULT '';
CREATE INDEX loginname ON strikes(loginname);


The index is needed for performance reasons.

Step 2: set the loginname value for all users to the current username value:
UPDATE user SET loginname = username;

Step 3: set the username for one test user you can log on with to the display name. In my case, the display name is stored as field5 in the userfield table. Updating only the user name from a test user with user ID = 1234 can be done in my case with the following SQL query:
UPDATE user SET username = (SELECT field5 from userfield where userid = 1234) where userid = 1234;

Step 4: go to your webserver and locate the file "includes/functions_login.php". 4.1. Copy that file to functions_login.php.orig so you can revert your edit should something go wrong
4.2. Apply the following patch to functions_login.php:
--- functions_login.php.orig Mon Aug 30 15:37:07 2010
+++ functions_login.php Thu Sep 9 18:12:35 2010
@@ -93,16 +93,18 @@

if (!empty($username))
{
+ // FYI - the 'strikes' table records strikes for a given username,
+ // hence we add a 'loginname' column to the 'strikes' table.
$strikes_user = $vbulletin->db->query_first("
SELECT COUNT(*) AS strikes
FROM " . TABLE_PREFIX . "strikes
WHERE strikeip = '" . $vbulletin->db->escape_string(IPADDRESS) . "'
- AND username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'
+ AND loginname = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($loginname)) . "'
");

if ($strikes_user['strikes'] == 4) // We're about to add the 5th Strike for a user
{
- if ($user = $vbulletin->db->query_first("SELECT userid, username, email, languageid FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string($username) . "' AND usergroupid <> 3"))
+ if ($user = $vbulletin->db->query_first("SELECT userid, username, email, languageid FROM " . TABLE_PREFIX . "user WHERE loginname = '" . $vbulletin->db->escape_string($loginname) . "' AND usergroupid <> 3"))
{
$ip = IPADDRESS;
eval(fetch_email_phrases('accountlocked', $user['languageid']));
@@ -114,9 +116,9 @@
/*insert query*/
$vbulletin->db->query_write("
INSERT INTO " . TABLE_PREFIX . "strikes
- (striketime, strikeip, username)
+ (striketime, strikeip, username, loginname)
VALUES
- (" . TIMENOW . ", '" . $vbulletin->db->escape_string(IPADDRESS) . "', '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "')
+ (" . TIMENOW . ", '" . $vbulletin->db->escape_string(IPADDRESS) . "', '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "', '" . $vbulletin->db->escape_string(htmlspecialchars_uni($loginname)) . "')
");
$strikes++;

@@ -128,7 +130,7 @@
{
global $vbulletin;

- $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "strikes WHERE strikeip = '" . $vbulletin->db->escape_string(IPADDRESS) . "' AND username='" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'");
+ $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "strikes WHERE strikeip = '" . $vbulletin->db->escape_string(IPADDRESS) . "' AND loginname='" . $vbulletin->db->escape_string(htmlspecialchars_uni($loginname)) . "'");
}

// ###################### Start set_authentication_cookies #######################
@@ -157,7 +159,7 @@
global $vbulletin;

$username = strip_blank_ascii($username, ' ');
- if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
+ if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE loginname = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
{
if (
$vbulletin->userinfo['password'] != iif($password AND !$md5password, md5(md5($password) . $vbulletin->userinfo['salt']), '') AND



Step 5: Login with this test user to verify you can still log onto the vBulletin platform.

Step 6: Go to the Admin CP > Maintenance > Rebuild thread information and then run Rebuild forum information to update the user name in threads. This may take a while on bigger boards.

I have checked with a regular user and a moderator on the boards with this hack in place. It works for both (the user can post, and the moderator can moderate the threads).

Please note that I still have to more thoroughly check all vBulletin functionality with this hack in place. Review from more experienced vBulletin developers/coders is appreciated!

I hope it is OK to post this hack here. Who knows it might get into the vBulletin code base?

shutterfreak
09-06-2010, 08:58 PM
I managed to almost entirely implement the login name / display name dissociation on vBulletin. To get the user registration bit done, I had to edit the 'register' template, which now contains the following <div> section after the login name <div>:


<div class="blockrow">
<label for="regloginname">{vb:rawphrase loginname}:</label>
<div class="rightcol">
<input class="primary textbox" id="regloginname" type="text" name="loginname" maxlength="{vb:raw vboptions.maxuserlength}" value="{vb:raw loginname}" tabindex="1" />
<!--<img src="{vb:raw vboptions.cleargifurl}" id="reg_verif_login_image" alt="" />-->
<div id="reg_verif_login_div" class="primary" style="display:none;"></div>
<script type="text/javascript" src="clientscript/vbulletin_ajax_loginverif.js?v={vb:raw vboptions.simpleversion}"></script>
<script type="text/javascript">
<!--
reglogin_verif = new vB_AJAX_LoginVerify('reglogin_verif', 'regloginname');
//-->
</script>
<p class="description">{vb:rawphrase enter_your_loginname}</p>
</div>
</div>

This means I also had to create an AJAX script named "clientscript/vbulletin_ajax_loginverif.js" (basis is "clientscript/vbulletin_ajax_nameverif.js", edits reflect 'loginname' instead of 'username', new method name, reference to the "reg_verif_login_div" <div> element, replace the URL parts wih "do=verifyloginname", ...).

Then I had to edit ajax.php (mainly copying verifyusername() to verifyloginname() and edit accordingly), class_dm_user.php, user.php and adminfunctions_user.php in order to add the 'loginname' bits where needed.

Finally I also had to add a couple new phrases for the login text snippets:
Register Phrases Containing 'loginname'

enter_your_loginname

Notices Phrases Containing 'loginname'

loginname_is_valid

GLOBAL Phrases Containing 'loginname'

loginname

Error Messages Phrases Containing 'loginname'

fieldmissing_loginname
loginname_contains_semi_colons
loginnametaken
loginnametaken_edit_here
loginnametoolong
loginnametooshort
sameloginnamepass


I then edited the default text for the 'enter_your_username' phrase so it does not mention the login process anymore.

I still have to add a couple options as well, but right now I copied them from the username settings.

Eventually I should create a patch against a fresh 4.0.6 install.

Best regards,

Olivier

Videx
09-06-2010, 10:43 PM
I'm not sure why you're posting in this thread, as the virtual names hack you're working on doesn't bear any resemblance to what the OP was asking for. Maybe you should be posting over in the programming forum so people could assist with that aspect.

I'm sure if I think about it I can think of several administrative options with virtual names. Like - how many people could use the same name? I guess there's no technical reason everyone on the board couldn't just use the same virtual name.

Oh, and don't even think of releasing this as a mod until there are no template edits.

shutterfreak
09-07-2010, 04:22 AM
I'm not sure why you're posting in this thread, as the virtual names hack you're working on doesn't bear any resemblance to what the OP was asking for. Maybe you should be posting over in the programming forum so people could assist with that aspect.
The OP asked for a possibility to use 2 tokens for identifying a member: the "user name" and the "real name". From what I made from the OP's question, and given the fact that vBulletin does not make the distinction between a login name and a display name, I understand that the OP wants to separate the user authentication bit (with "user name" in his post) from the way a member is known on a vBulletin board (with "real name" in his post).

In my approach I'm basically doing precisely this. However I use "login name" instead of "user name", and I use "user name" instead of "real name".

Technically the same approach.

I'm sure if I think about it I can think of several administrative options with virtual names. Like - how many people could use the same name? I guess there's no technical reason everyone on the board couldn't just use the same virtual name.

My approach uses the same type of validation to check for existing user names (e.g., valid characters, cleanup etc as provided by vBulletin for the username field). In addition I check the login name for uniqueness.

In the case of the OP there still ought to be a unique identifier or vBulletin and the members of that board will be confused about which of the 5 "John Doe" members a certain participant is. For the OP this could e.g. be realized by:

enforcing unique login names
allowing non-unique display names (the names by which a member can be identified while participating on the boards)
making an avatar photo mandatory at registration


I do not claim to be a vBulletin expert. If you are willing to share your insights, please do so.

Oh, and don't even think of releasing this as a mod until there are no template edits.

There is no way to implement this without adding the 2nd user name field (login name in my case) to the 'register' template bit. Indeed, how can vBulletin know that this field needs to be rendered (and when)?

Unless you refer to user profile fields. And then the "hack" will be much more complicated to implement IMHO as you'll have to hunt for all places where a vBulletin user name is rendered and replace it with a new profile field. Plus, you won't have the possibility to do a lot of validation checks of that field.

So according to you, because of this simple template edit, this can't be posted as a mod?

Maybe we misunderstood each other here.

Videx
09-07-2010, 05:28 AM
Oh, you wouldn't be the first to release a mod which required so many template edits that I just wouldn't mess with them. Although that Template Modification System (https://vborg.vbsupport.ru/showthread.php?t=152931&highlight=template+modification+system) was real nice.

I think the OP was just asking how he could force users to use real names. He didn't ask about virtual names (or second user names) at all. VB has always used numbers to identify members. So in theory there's no reason you couldn't have say, 10 alternate aliases in your Settings and you could change them as the mood strikes you. Not for my forum, but I can picture lots of people installing a virtual name mod if it was easy enough.

shutterfreak
09-07-2010, 06:21 AM
Oh, you wouldn't be the first to release a mod which required so many template edits that I just wouldn't mess with them. Although that Template Modification System (https://vborg.vbsupport.ru/showthread.php?t=152931&highlight=template+modification+system) was real nice.

Fortunately I managed to limit the template edits to 1: a mere addition of some HTML & template preprocessor code, no replacements :)

I see no reason yet why this should change.

I think the OP was just asking how he could force users to use real names. He didn't ask about virtual names (or second user names) at all. VB has always used numbers to identify members. So in theory there's no reason you couldn't have say, 10 alternate aliases in your Settings and you could change them as the mood strikes you. Not for my forum, but I can picture lots of people installing a virtual name mod if it was easy enough.

You're right about the internal identifiers used in vBulletin: they're all numbers. This is 'never' exposed to the users. for this reason I infer that the OP thought about the 'username' field as the identifier he wanted to be the real name of a participant.

Mostjolly
03-22-2011, 06:37 PM
Facebook is king because they make it easy to find friends (and find friends is by their real name), if FB uses usernames... good luck searching your friends with that..

I could find any friends on facebook, not quite with mayspace cause majority of times people uses like babyboo, sweeteyes.. how the hell I know who they are? but if they put Mike Joes, Nancy Mitchell (one of my friend) then hell yeah I'll join a forum cause my friends is on there.. get the point?? Beside using real names creates a more personal identity for connection & interacting with friends..

Yelp and Facebook is ahead of their game just with the "Real Name" concepts..

F. Krueger
06-19-2013, 11:23 AM
May I ask why you want people to use their real Names ?

Our vBulletin is for an extended family connection.
We have over 1000 extended family members.

When you are dealing with family you dont need to be as worried when its verified users only.

Amaury
06-19-2013, 12:45 PM
Our vBulletin is for an extended family connection.
We have over 1000 extended family members.

When you are dealing with family you dont need to be as worried when its verified users only.

You do realize this thread's from 2010, right?