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

XF 1.4 IF condition to shows x banner to usergroups?

Okenyon

Active member
#1
Hey all, I don't code so kindly write the code for me if you'd be so kind,

Is there a way to serve banner X to normal users, but banner Y if you're in a certain user group?

By banner I mean an adbanner just using templates and HTML.
 

Okenyon

Active member
#3
Thank you, i've just had a read through but my head goes missing on stuff like this, if anyone would be so kind to show me the exact code to show a banner to different usergroups, thank you.
 

James

Well-known member
#4
Thank you, i've just had a read through but my head goes missing on stuff like this, if anyone would be so kind to show me the exact code to show a banner to different usergroups, thank you.
4. How can I show content to a specific user group?
<xen:if is="{xen:helper ismemberof, $visitor, x}">
This content will show to members of user group x
</xen:if>
Code:
<xen:if is="{xen:helper ismemberof, $visitor, x, y, z}">
insert the code for your banner here
</xen:if>
x, y, z = replace with a comma-separated list of the usergroups you want to show the banner to (e.g. 5, 12, 19).
 

Okenyon

Active member
#5
Code:
<xen:if is="{xen:helper ismemberof, $visitor, x, y, z}">
insert the code for your banner here
</xen:if>
x, y, z = replace with a comma-separated list of the usergroups you want to show the banner to (e.g. 5, 12, 19).
Thank you @James however what if I wish to show one banner to all uaergroups and another to one specific user group?
 

Jeremy

Well-known member
#6
Invert the condition and only use the group you wish to not see it: !{xen:helper ...}

And then use another one that targets that group.
 

James

Well-known member
#7
Thank you @James however what if I wish to show one banner to all uaergroups and another to one specific user group?
Combine an if-else:
Code:
<xen:if is="{xen:helper ismemberof, $visitor, x, y, z}">
insert the code for the specific usergroup(s) here
<xen:else />
insert the code for everyone else here
</xen:if>