XF 2.0 Show only to usergroup syntax?

[xFv]

Well-known member
I am looking for the xf2 equivalnt to this.
<xen:if is="{xen:helper ismemberof, $visitor, x}">This content will show to members of user group x</xen:if>
this is whatI have tried:
<xf:if is="{xf:helper ismemberof, $visitor, x}">This content will show to members of user group x</xf:if>
But keeps throwing an error!
Any Help is much Appreciated!
 
Ok this does not work like it should, maybe its me...

I am trying to make it only admin sees the online marker.
This is what I have in a html template:

Code:
<xf:css src="xfv_marker_test.less" />

<xf:if is="{{ $xf.visitor.isMemberOf(3) }}">
<span class="message-avatar-online" data-xf-init="tooltip" title="{{ phrase('online_now') }}"></span>
</xf:if>
I even changed the user group number and tried all 4.
But still all user groups sees the online marker.
Any help is much appreciated!
 
Last edited:
Im editing the master style on a fresh install.
I just dont understand what i am missing.
I even tried the code inside of the message macros template but with no luck.
 
Im editing the master style on a fresh install.
I just dont understand what i am missing.
I even tried the code inside of the message macros template but with no luck.
Maybe a template modification is interfering, try a new default style and disable add-ons template modifications
 
I am trying to make it only admin sees the online marker.

This is just a wild guess but I have done this before when setting a staff usergroup number. Be sure that your administrator usergroup is not secondary to registered. In other words registered would be the main usergroup and administrator would be the secondary usergroup. Not sure since your using Xenforo 2 but this could be it. I had to change my main usergroup to administrator and had this same issue before because the primary usergroup was "registered" instead of "administrator" while administrator was only the secondary usergroup.

I just wanted to make sure you double checked that just in case that was the reason.
 
This is just a wild guess but I have done this before when setting a staff usergroup number. Be sure that your administrator usergroup is not secondary to registered. In other words registered would be the main usergroup and administrator would be the secondary usergroup. Not sure since your using Xenforo 2 but this could be it. I had to change my main usergroup to administrator and had this same issue before because the primary usergroup was "registered" instead of "administrator" while administrator was only the secondary usergroup.

I just wanted to make sure you double checked that just in case that was the reason.
So this was designed for evreyone including staff, mods, admins are registered by default?
Well I got it to work with what you said, however I am creating an addon and dont want everybody have to change this.
Is there a way I could double up on the conditional statements to bypass the registered and hit the admin?
 
So this was designed for evreyone including staff, mods, admins are registered by default?
Well I got it to work with what you said, however I am creating an addon and dont want everybody have to change this.
Is there a way I could double up on the conditional statements to bypass the registered and hit the admin?


If it's for just your staff even if it's all your staff, the equivalent to this world work. You would just need to find out what the equivalent was.

Code:
<xen:if is="{$visitor.is_staff}">
This content will show to staff members

</xen:if>

I suppose it wasn't working before because that code checks the primary usergroup and not the secondary. There may be a way to pin point secondary usergroups too. You just need to do a little more digging to find out. I couldn't find a way in the conditional statement tutorial by Brogan but did find the code above which will work if you have the equivalent.

EDIT: I also wanted to add this in just in case you only wanted admins. Of course I don't know the Xenforo 2 syntax. This is for admins:

Code:
<xen:if is="{$visitor.is_admin}">
This content will show to Administrators

</xen:if>

- Brad
 
If it's for just your staff even if it's all your staff, the equivalent to this world work. You would just need to find out what the equivalent was.

Code:
<xen:if is="{$visitor.is_staff}">
This content will show to staff members

</xen:if>

I suppose it wasn't working before because that code checks the primary usergroup and not the secondary. There may be a way to pin point secondary usergroups too. You just need to do a little more digging to find out. I couldn't find a way in the conditional statement tutorial by Brogan but did find the code above which will work if you have the equivalent.

EDIT: I also wanted to add this in just in case you only wanted admins. Of course I don't know the Xenforo 2 syntax. This is for admins:

Code:
<xen:if is="{$visitor.is_admin}">
This content will show to Administrators

</xen:if>

- Brad
How to do this for mod and admin?
 
Back
Top Bottom