View Full Version : how to display custom field in forum
changtraingheo
08-22-2012, 12:24 PM
When i register one account in forum, example: Test1
- I add custom field Display Name in profile, if Display Name is empty, all post by me will display account name (Test1) ... Now, when i change Display Name to another name, example: MrPhi, then all post by me will display MrPhi not is Test1 ... It comes down, all position display Test1 will be change MrPhi ... i try do it, by it is not easy i expected
Scanu
08-22-2012, 01:08 PM
Do you want to do this everywhere in the forum? If so I can't test it but i think you can do this by creating a field "Display name" then create a plugin with global_start hook with this content
if ($vbulletin->userinfo['fieldX']) //Check if you put the name to display
$vbulletin->userinfo['username'] = $vbulletin->userinfo['fieldX'];
Where fieldx is the id of the field you just made, but i don't think it will works everywhere, for get it working in all the pages i think you can figure it out by yourself
changtraingheo
08-22-2012, 01:25 PM
if ($vbulletin->userinfo['fieldX']) //Check if you put the name to display
$vbulletin->userinfo['username'] = $vbulletin->userinfo['fieldX'];
Thanks your help, but this code only work when i logined and i only can see Display Name of me .. What i mean is that apply for all account, example when i view profile of another user, if display name of that user not be empty then i see display name of that user not account name of that user ...
Example this forum, my account is changtraingheo, when i enter display name is Mr Phi, when u refresh page, u can not see changtraingheo, u only see Mr Phi.
Sr, my english is not good ^^
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.