MyBB Community Forums

Full Version: How to add profile field to username line?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm playing with the idea of using myBB for our amateur radio group.
So far I like myBB a lot.  
See the attached screenshot.

You can see my callsign and under it it says 'member' which is fine.
What I would like to do is add the profile field I added called 'Name' so that it shows to the right of the green dot next to my name.


Can someone point me to where I can do this? 

Thanks!
Place {$post['fidX']} in Templates > Your theme > Postbit Templates > Postbit +_ Postbit_Classic

Replace X with your custom profile field.
https://community.mybb.com/post-310401.html
Still searching for that... found Themes, but not Postbit Templates....
Found templates... but not the postbit ...
Ok, found 'post bit' two words... then...
postbit_classic

{$ignore_bit}{$deleted_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<div class="post classic {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
<div class="post_author scaleimages">
{$post['useravatar']}
<div class="author_information">
<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']} {$post['fid4']}<br />
<span class="smalltext">
{$post['usertitle']}<br />
{$post['userstars']}
{$post['groupimage']}
</span>
</div>

Still haven't got it right...  Trying to get my field to show up just to the right of the 'online/offline' dot....
Replace "Name" with the id number of the profile field. It should be like {$post['13']}
Hover over the link of your profile field and the link should have a number at the end.
https://i.postimg.cc/MG062FXg/profielfield.jpg
Ok, got field number 4.
{$post['4']}
placed that several places in postbit_classic template, but can't see it anywhere...
I did turn on "display on postbit" in the custom profile settings, and then it shows on the right side of the screen.

Tried saving the template as the default, and NewDefault.

Ok, GOT IT!  See the screenshot that is attached.

It's the postbit template.


Templates & Styles / Templates / NewDefault Templates / Post Bit Templates / postbit

Line 7

Changed to:

            <strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}{$post['fid4']}<br />

Where fid4 is my Name field I added in the profile.
Just be aware that no validation is performed when directly accessing profile fields like this. If anyone enters HTML (such as script tags) into these fields it will be executed for anyone viewing the thread.

You can specify a regular expression to only allow specific types of input for your custom field. For example, this will only allow users to input letters, numbers, spaces, commas, and periods (including question/exclamation marks):

^[a-zA-Z0-9,.!? ]*$