View Full Version : Miscellaneous Hacks - Preferred Name (Display Name)
Hex_legend
12-14-2007, 10:00 PM
This minor template edit will enable your users to have a "Preferred Name" instead of their username showing on their posts and navbar. Users would still log in using their username and password just that their preferred name would show up instead of their username.
This will not change the displayed name in the "Who's online" box.
This would be a good protection against cases where an admin from another site steals passwords. Meaning they try to log in with the password of a username they recognise. But in the end, it isn't really the right username. Regardless .. this is a feature that would be useful to some members.
Step 1.
Go into your Admin CP
User Profile Fields
Add New Profile Field
Single Line Text Box
Name: Preferred Name
Description: What would you like to be known as on the site? you will still use your username to log in.
Required: Yes, Always
Private Field: No
Field Searchable: No
Show On Member List: No
Leave everything else the same.
Make a note of the user field number that is assigned to this field (for this example, we will use Field5)
Step 2.
In Styles & Templates
Open Navbar (Under Navigation Templates)
Search For:
$bbuserinfo[username]
Replace With:
$bbuserinfo[fieldX]
Where X is the field number from step 1.
Save.
Open up Postbit / Postbit Legacy (Depending on which one you use.
Search For:
$post[musername]
Replace With:
$post[fieldX]
Where X is the field number from step 1.
Save.
Step 3.
Click Language & Phrases.
Search For Phrase.
"Thank you for logging "
Click Edit.
Replace with:
Thank you for logging in, $bbuserinfo[fieldX] .
Where X is the field number from step 1.
Done. No more template edits.
THANKS TO
Kirk Y
DJ RREBEL
REMEMBER TO CLICK INSTALL (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=165253)
Hex_legend
12-15-2007, 07:33 PM
*reserved*
valdet
12-15-2007, 07:56 PM
as explained here (http://www.vbulletin.com/forum/showthread.php?t=252373)
Good job Hex.
Thanks for bringing it here.
Hex_legend
12-15-2007, 08:07 PM
Well seeing as I created the thread on vbulletin.com, I thought I'd bring it here too lol, Credit to all those who helped me.
iogames
12-15-2007, 08:31 PM
I will wait for version 2.0 :p
DJ RRebel
12-15-2007, 08:37 PM
I didn't help much at all .. just brainstormed a bit out loud to hopefully point you in the right direction.
Unfortunately .. as mentioned by Boothby in the other thread at vB.com .. you still have the issue of things like search not working.
You wouldn't have to worry about people clicking on a PM button to sent members a private message ... but users would get errors if they fill in the field manually. Even worse .. Case where User1 has display name Frank, while another user has Frank as his real username. The wrong member would get the PM. Same thing with manual searching unless they used the searchlink directly from the person's post or profile.
For the who's online page .. I'm only guessing here and haven't tried it myself .. but in the "whosonlinebit" template, change this:
<a href="member.php?$session[sessionurl]u=$userinfo[userid]">
$userinfo[musername]</a>$userinfo[hidden]
<if condition="$show['buddy']">+</if>
into this:
<a href="member.php?$session[sessionurl]u=$userinfo[userid]">
$userinfo[fieldX]</a>$userinfo[hidden]
<if condition="$show['buddy']">+</if>
iogames
12-15-2007, 08:41 PM
Thanks!
I was thinking of that!
it's a Coin with just one side :(
Hex_legend
12-15-2007, 08:56 PM
Well. This is where the cleverness comes in :p
I have edited it just enough so it will only change on navbar and in posts, so if you click on the drop down on a post (for their profile) it will show their username and the same for the who's online part.
Besides the point I know, but can't think how to change it lol.
DJ RRebel, can you PM me please?
DJ RRebel
12-15-2007, 10:15 PM
Note .. I think this template might be the one for the stuff like birthdays and who's online at the bottom of your homepage:
memberlist_resultsbit
You'll definitely have to track down stuff on your calander, memberlists and profile pages.
Plus probably a few more I haven't thought of.
DJ RRebel
12-15-2007, 10:21 PM
Hex .. I'm working on a few things right now and am about to eat and possibly go out .. if you have any questions feel more than free to post them here or at vB.com and I'll do my best. It's always better to post questions out in the open, that way the information can help the entire community and anyone having problems in the future! :)
However .. if there's anything personal in nature, feel free to PM anytime! :)
I'm not a programmer .. I guess I'm more of a vB tinkerer and philosopher! lol .. So while I'll often be able to tell you what you should do .. I often will not be able to give you the exact technical details you need to know.
shadowevil
12-16-2007, 04:21 AM
Nice mod .. But i want "display name" showing all is: register, login, who's online, profile ..v..v.. so, i want this mod show replace all username .... i waiting version 2.0 :)
shadowevil install
Kirk Y
12-16-2007, 05:50 AM
You might want to consider changing the replacements to:
<if condition="$bbuserinfo['fieldX']">$bbuserinfo[fieldX]<else />$bbuserinfo[username]</if>
Otherwise people who haven't set a "Preferred Name" won't have a Username. :p
Hornstar
12-18-2007, 11:16 AM
I wish vbulletin had the one implemented like on IPB boards default
MiahBeSmokin420
12-18-2007, 03:08 PM
You might want to consider changing the replacements to:
<if condition="$bbuserinfo['fieldX']">$bbuserinfo[fieldX]<else />$bbuserinfo[username]</if>
Otherwise people who haven't set a "Preferred Name" won't have a Username. :p
LMAO Good thinking
PinkDaisy
12-20-2007, 12:50 PM
Okay.. I did this and then decided agaisnt it. Took all my templates back and now everyones posts is showing up in their username, even if its posted by someone else, it shows their username in the threads. Any help?
PinkDaisy
12-20-2007, 02:14 PM
Okay.. now all my posts aren't showing up and it's just all messed up. Gosh.. what did I do? :(
DJ RRebel
12-23-2007, 05:06 AM
Sorry Pink .. Can't really understand what your problem is ... everything should be fine if you reverted your templates back to their defaults.
RDx321
01-15-2008, 11:49 PM
How can I add this to the main page for the Last Post By .
Illustrious
02-12-2008, 04:21 AM
Yeah, I was just going to post that you may want to make it conditional:
<if condition="$post[field7]">$post[fieldX]<else />$post[musername]</if>
Also, by doing this, you're stripping the name of all of its markup. It may not be the best idea.
Edit: You can retain the usergroup's html markup if you edit it the functions.php file, but is there any other way to do it without file edits?
landspeed
02-24-2008, 02:05 AM
Yeah, I was just going to post that you may want to make it conditional:
<if condition="$post[field7]">$post[fieldX]<else />$post[musername]</if>
Also, by doing this, you're stripping the name of all of its markup. It may not be the best idea.
Edit: You can retain the usergroup's html markup if you edit it the functions.php file, but is there any other way to do it without file edits?
I don't see any way to do it without code modification. The board isn't developed to handle the thought of a user having a different editable bit that is displayed aside from login. It would be nice.
I'll look at hacking the function code.
Faltzer
03-03-2008, 06:00 PM
Personally, this needs to be a hack, not a template edit.
auteejay
02-22-2009, 07:24 PM
Where would this condition need to be inserted, before or after $bbuserinfo[field5]? I tried to modify my code but no luck.
You might want to consider changing the replacements to:
<if condition="$bbuserinfo['fieldX']">$bbuserinfo[fieldX]<else />$bbuserinfo[username]</if>
Otherwise people who haven't set a "Preferred Name" won't have a Username. :p
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.