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

Try to select Guests from the online list

#1
Hello,
first of all my englisch is really bad, but i will try to explain my point.
The online list shows me a lot of Guests, Search Engine Botsd and so. I dont need the Information, so i think i mark up this with a extra css class and display none this. In the template "member_list_item" i added "<xen:if is="!{$user.user_id}">memberListItemGuest</xen:if>" in the li-tag. this works fine for me, but the pagina doesnt works fine. first page three member, second page five member and so on :)
is there a smart method to solve this small problem?

Code:
<li class="primaryContent [B]<xen:if is="!{$user.user_id}">memberListItemGuest</xen:if>[/B] memberListItem{xen:if $extended, ' extended'}"{xen:if $id, ' id="{$id}"'}>
thank you
 

Jeremy

Well-known member
#2
Most up to date of this will be located at this resource:
http://xenforo.com/community/resources/limit-whos-online-to-display-only-registered-users.1820/

If you want to change the online members list to exclude guests, you'll need to edit files. In:
/library/XenForo/ControllerPublic/Online.php

Find:
PHP:
$conditions = array(
'cutOff' => array('>', $sessionModel->getOnlineStatusTimeout()),
'getInvisible' => $bypassUserPrivacy,
'getUnconfirmed' => $bypassUserPrivacy,
 
// allow force including of self, even if invisible
'forceInclude' => ($bypassUserPrivacy ? false : XenForo_Visitor::getUserId())
);
Add into that array a 'userLimit' => 'registered' setting, so it looks like:
PHP:
$conditions = array(
'cutOff' => array('>', $sessionModel->getOnlineStatusTimeout()),
'getInvisible' => $bypassUserPrivacy,
'getUnconfirmed' => $bypassUserPrivacy,
'userLimit' => 'registered',
// allow force including of self, even if invisible
'forceInclude' => ($bypassUserPrivacy ? false : XenForo_Visitor::getUserId())
);
Should work to cut out the unregistered users.
 
#3
hi king kovifor,

what happens with this modifications after an update von xenforo? do again?

thank you for your reply and btw it works fine :)
 

Jeremy

Well-known member
#4
You'll have to reapply the modification each time you upgrade XenForo. It could be abstracted out into an add-on, but it'd duplicate work and cause an extra query per-page load. If you're OK with that, I may see about doing that for you later tonight.
 

Jeremy

Well-known member
#6
i don't understand everything but it seems ok ;)
Since this is a code modification, it needs reapplied every time you upgrade XenForo. If I were to abstract it into a simple modification, you would be fetching the online users twice, once with guests, once without.

There may be ways for an add-on to avoid this, but I won't guarantee it.