1. 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

Discussion in 'XenForo Questions and Support' started by efendi, May 13, 2013.

  1. efendi

    efendi Member

    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
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    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.
     
    efendi and Chris D like this.
  3. efendi

    efendi Member

    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 :)
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    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.
     
  5. efendi

    efendi Member

    i don't understand everything but it seems ok ;)
     
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    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.
     
    efendi likes this.
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    Liam W likes this.

Share This Page