• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 If statment - show somthing when post count equals X

#1
Is it possible to use an {if} statement to show a certain profile field on the edit profile page, like the homepage field, only when the registered user has reached a certain amount of posts.
 

Jake Bunce

XenForo moderator
Staff member
#4
Thanks but when i try to add this code, it just shows the else part:

Code:
<xen:if is="{$user.message_count} > 3">
<dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>
<xen:else />
<dd>You must have at least 3 forum posts to add your website.</dd>
</xen:if>
Are you working in the message_user_info template?

You may want to use $visitor instead of $user , depending on exactly where you are working.
 
#5
Thank you for your help buddy, you are correct it worked fine when i changed $user to $visitor. :D

I was editing account_personal_details template.

Code:
<xen:if is="{$visitor.message_count} > 3">
<dd><input type="url" name="homepage" value="{$visitor.homepage}" id="ctrl_homepage" class="textCtrl" /></dd>
<xen:else />
<dd>You must have at least 3 forum posts to add your website.</dd>
</xen:if>