MyBB Community Forums

Full Version: {$userfields['fid4']}
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

In profiles this code works, to output the users userfield selection: {$userfields['fid4']}

However, how can this work in templates like header?

Let's say i'd want to echo the text user selected in hes profile field, in the header. How would I do this?
You can use {$mybb->user['fid4']} in the header and in other templates to display custom profile field information.
(2015-05-22, 11:51 PM)jshort Wrote: [ -> ]You can use {$mybb->user['fid4']} in the header and in other templates to display custom profile field information.

Thank you very much, i understand it now. 

(2015-05-22, 11:51 PM)jshort Wrote: [ -> ]You can use {$mybb->user['fid4']} in the header and in other templates to display custom profile field information.

Curious if you know, how i can do a if rule? I have that php plugin installed

<?php if($mybb->user['fid4'] = 'test' {
echo 'true';
}
?> 

would something like this work lol?
With Template Conditionals or PHP in Templates:
<if $mybb->user['fid4'] == 'test' then>
true
</if>

With PHP in Templates only:
<?php
if($mybb->user['fid4'] == 'test')
{
echo 'true';
}
?> 
(2015-05-23, 06:39 PM)Destroy666 Wrote: [ -> ]With Template Conditionals or PHP in Templates:

<if $mybb->user['fid4'] == 'test' then>
true
</if>

With PHP in Templates only:

<?php
if($mybb->user['fid4'] == 'test')
{
echo 'true';
}
?> 

Cheers, would there be any resource usage difference? 
I don't think there's any significiant difference, but Template Conditionals are much more secure if you're not the only admin that can edit templates.