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

Condition for check moderators status

#1
Hello!
I need create condition ib template and show one block only if one of my moderators is online

<xen:if is="{ $visitor.user_group_id } == 1">
block code
</xen:if>

Something like this, but without checking status on current user.
Logical is a simple:
If anybody from group "Moderator" is online - all forum user with guests APPEAR custom block
Then all moderators is offline - custom block MUST BE NOT-APPEAR
 
#3
is_admin: true
is_moderator: true
is_member: false

That's me on my own sites.
Thanks for fast reply!
Am I right it's will be working together?

is_admin: true - this condition check forum users, admin or not admin?
I need make condition which will be work for all forum users or guests.
"If anybody from group "Moderator" is online - all forum user with guests APPEAR custom block
Then all moderators is offline - custom block MUST BE NOT-APPEAR"​
 
#5
I saw your link - thanks.
But I need diferent logic.
ALL forum users includes guests must be appear block ONLY when Moderators is online - for example in usual work day.
Then moderators goes to offline - this blocks must be hidden for ALL users, not only for moderators and administrators.
I hope now I explain my wishes better.
Inside this block will be standard block "staffOnline" which I want show only when moderators is alive.
 

xenfans

Well-known member
#6
Yes, but the $visitor is the person browsing the page, and that's just for the person browsing.

What you need requires a plugin that checks the online session data and compares against total count of is_staff to be exactly 0

That's not a styling, that's a development question.
 

Brogan

XenForo moderator
Staff member
#8
The original post asked about a conditional statement in a template, which is not a development question.

Do you have the requisite PHP and MySQL knowledge to create such an add-on?
If you do I can move the thread back.
 
#9
Finally I made it with jQuery:

jQuery(document).ready(function(){
if( jQuery('.staffOnline a.avatar').length == 0 )
{
jQuery('.staffOnline').hide();
}
});

For my tasks this is enough.

Thanks all for help!
 

Brogan

XenForo moderator
Staff member
#10
Is this a custom template/block?

The default staff online block in the sidebar is already hidden if there are no staff online (or they have their status set to hidden).