MyBB Community Forums

Full Version: Question about the profile data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
{$post['fid*']}

I'm aware that will retrieve info from the profile fields, however if a user does not enter anything in that profile field, this info still shows up in the postbit. How can I make it so that it doesn't display anything in the post bit if that field is empty.

I'll give this example to give you a better idea of what I'm trying to accomplish:

Real Name: {$post['fid3']}

So if this user put "John", it would show as Real Name: John in their post bit. However if they didn't put anything, it would show "Real Name: "

I don't want "Real Name:" to show up if the field is empty. So if the user did not put any real name in, it would should not display "Real Name:" at all. But if they do put something it, it should show it.
Is this for a plugin? Or for MyBB itself?
MyBB itself, like inside one of the template fields.
A simple thing you could try is this: http://community.mybboard.net/thread-31860.html

Use something like this in the templates:
<if $post['fid3'] then>
Real Name: {$post['fid3']}
</if>
Thanks that worked great. However it leaves a blank line if the field is empty, is there anyway to get rid of that?

Example:
Joined: 10/10/10
<name would go here but since they left it empty this space appears>
Posts: 1000

*EDIT* Found a solution.

Remove the <br /> in the item above the <if> statement and add the br tag within the if statement.

Here's an example:
	{$lang->postbit_joined} {$post['userregdate']}
       <if $post['fid12'] then>
<br />Real Name: {$post['fid11']}
</if>     

That should help clarify what I'm talking about in case anyone had the same problem.