Conditional Statements

Conditional Statements

Need some assistance. I'm an admin over at a vB3 forum. We're likely to convert to Xenforo in the near future. I've tested Xenforo a bit and am really liking it. Unfortunately, there are some issues that I was hoping could be answered.

My forum has several contests where members can pick the prize of being able to temporarily wear larger than normal avatars. Xenforo restricts avatar dimensions to predetermined ones. I did manage to find workarounds that allows non-standard avatar sizes to be shown. Sadly, everyone is able to wear the maximum avatar dimension I've set. I do have a possible fix for my issue but I'm not familiar enough with Xenforo's conditionals to do it at the moment. Essentially, I want to show content in a post if the poster belongs to a specific usergroup or if he/she doesn't.

In vBulletin I can do something like this:

Code:
<if condition="$post['usergroupid']==312">stuff</if>

That allows me to display content in the postbit if the poster belongs to usergroup 312. If he doesn't then it doesn't appear. How would I go about doing this in Xenforo?
 
That's a standard user group conditional statement - number 4 in the guide:
Code:
<xen:if is="{xen:helper ismemberof, $user, x}">
 
That's a standard user group conditional statement - number 4 in the guide:
Code:
<xen:if is="{xen:helper ismemberof, $user, x}">

I thought that number 4 shows information to a user who is in a specific usergroup? Say that this conditional was used in the template section for post messages:

Code:
<xen:if is="{xen:helper ismemberof, $user, 12}">
This content will show to members of user group 12
</xen:if>

Only those that belong to the user group 12 will be able to see that message. I want it so that conditional displays something to everyone if the one who made the post belongs to a certain usergroup. I.e. if a user made a post and belongs to usergroup 32 then a content x is shown to everyone who views that post. If a user doesn't belong to usergroup 32 then content x will not be shown, in his/her posts, to everyone else.
 
I thought that number 4 shows information to a user who is in a specific usergroup? Say that this conditional was used in the template section for post messages:

Code:
<xen:if is="{xen:helper ismemberof, $user, 12}">
This content will show to members of user group 12
</xen:if>

Only those that belong to the user group 12 will be able to see that message. I want it so that conditional displays something to everyone if the one who made the post belongs to a certain usergroup. I.e. if a user made a post and belongs to usergroup 32 then a content x is shown to everyone who views that post. If a user doesn't belong to usergroup 32 then content x will not be shown, in his/her posts, to everyone else.
From the guide:

Depending on the template being worked with, you may need to use $user instead of $visitor; $visitor is always the record for the current logged in user, $user is the record being processed (e.g. message author, member list, list of online users, etc.).
 
Hello. Are there any code that restricts content to "not" be shown in specific pages? For example; not found, reply to thread, create thread, login & register page etc... @Brogan
 
Your question isn't clear but if it is related to this post, XF 1.5 - How to replace images for visitors?, no it's not possible.
No it's not related to that post.

I mean, lets think I created an ad in ad_above_top_breadcrumb template. We know this ad will be shown "every" page in XenForo forum because of that template shown in every page. But I want to hide that ad in some pages (login, register, reply to thread page etc.)

I hope this time I explained. :)
 
You can use $thread.reply_count.

Interesting. However, i believe that will take the over all thread count not the thread page count. I am looking for something that looks at the thread pages and posts on that page and display a text if there are more than 1 or 2 posts, otherwise it doesn't.
 
Something like this should work:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 1 AND {$thread.reply_count} > 0">
 
It may be possible by editing the appropriate node_* template and utilising the node ID to insert content after a particular node.
 
Back
Top Bottom