Xenforo Conditional Statements - Help is desperately needed

Status
Not open for further replies.

LordRahl

Member
I'm using an add-on for currency, but the way the code is structure, it is nearly impossible for me to insert conditional statements to restrict which groups can see which currencies.

Here is the code below. I could really use someone's help rewriting this code so that I can easily add conditional statements. Right now it loops through the currency Ids. Right now I have 5 currencies created so the currency ID are 1,4,5,6.

What I'm trying to achieve. I would like user group ID 5 to only see currency ID 1. If the user also belongs to user group 9, then they can see currency ID 1 and 5. If the user is a member of user group 10, then they can see currency ID 1,5, and 6.

I love Xenforo, but I am new to the scripting part. I would be more then happy to return the favor for the help.

The code:

<xen:require css="BRC_message_user_info_extra.css" />
<xen:if is="{$currencies}">
<xen:foreach loop="$currencies" key="$_currency" value="$currency">
<xen:if is="{$currency.active} && (!{$currencyDisplay} || in_array({$currency.currency_id},{$currencyDisplay}))">
<dl class="pairsJustified">
<dt><span class="BRC_currency_code">{xen:raw $currency.code}</span></dt>
<dd>
<xen:if is="{$user.user_id} != {$visitor.user_id}">
<a href="{xen:link 'credits/transfer', '', 'receiver={$user.username}','currency_id={$currency.currency_id}'}" title="{xen:phrase BRC_transfer}" class="BRC_message_user_info concealed Tooltip OverlayTrigger concealed" data-cacheOverlay="no" data-userid="{$user.user_id}">{xen:helper brc_currencyformat, {$user.{$currency.column}},true,{$currency.currency_id}}</a>
<xen:else />
<a href="{xen:link 'credits'}" class="BRC_message_user_info concealed">{xen:helper brc_currencyformat, {$user.{$currency.column}},true,{$currency.currency_id}}</a>
</xen:if>
</dd>
</dl>
</xen:if>
</xen:foreach>
</xen:if>
 
Status
Not open for further replies.
Top Bottom