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

XF 1.1 Hide members list from everyone

Discussion in 'XenForo Questions and Support' started by Adam Howard, Feb 7, 2012.

  1. Adam Howard

    Adam Howard Well-Known Member

    So I did search and I know you can hide the members list from guest, but I want to hide it or turn it off for everyone.

    From a spam point of view, I've had members join just so they could try to locate contact info through this list (and basically contact people off site to join another site). And from a resource point of view, it's just a waste.

    So I'd like to be able to either turn it off or completely hide it.
     
    erich37 and Digital Doctor like this.
  2. Digital Doctor

    Digital Doctor Well-Known Member

  3. Adam Howard

    Adam Howard Well-Known Member


    Yes, I saw those. But I'd like to hide it from everyone.... ie... Guest, members, staff, ect.... I can easily look up someone's profile in a hurry or review their account in the AdminCP.

    I'd much prefer the option to turn it off. Or at the very least hide it from everyone.
     
  4. Digital Doctor

    Digital Doctor Well-Known Member

  5. Adam Howard

    Adam Howard Well-Known Member

    It's an interesting feature. It would be nice to relocate that on another tab, but if that's not possible; I can leave without it. Removing the members list is top priority for me.
     
  6. Digital Doctor

    Digital Doctor Well-Known Member

    Make sure you vote here to have the Member's Tab improved.
    http://xenforo.com/community/threads/suggestion-replace-members-page-with.2773/

    When information flowed more openly ....

     
  7. Brogan

    Brogan XenForo Moderator Staff Member

  8. Floris

    Floris Guest

    You can try something like this, catches the members/ action and redirects everybody to index.


    File: NoMembers/Extend.php
    Content:
    class NoMembers_Extend
    {
    public static function listener($class, &$extend)
    {
    if ($class == 'XenForo_ControllerPublic_Member')
    {
    $extend[] = 'NoMembers_Block';
    }
    }
    }

    File: NoMembers/Block.php
    Content:
    class NoMembers_Block extends XFCP_NoMembers_Block
    {
    protected function _preDispatch($action)
    {
    throw $this->responseException($this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, XenForo_Link::buildPublicLink('index')));
    }
    }

    Create a new add-on, then:
    In the Code Event Listener Editor, add an Event Listener for load_class_controller
    Set the Execute Callback to the class NoMembers_Extend, for listener, with execution order of 1.

     
  9. Brett Peters

    Brett Peters Well-Known Member

    Off topic I know but it is good to see Floris helping out again :D
     
    TheVisitors and Digital Doctor like this.
  10. erich37

    erich37 Well-Known Member

  11. erich37

    erich37 Well-Known Member

    Hi Brogan,

    in order to also hide the "Member Page" from search-engines, would it be required to edit any files as well ?
    Like as was required for hiding other pages as mentioned here:
    http://xenforo.com/community/threads/how-to-hide-the-whats-new-tab-from-visitors.26434/#post-318434

    Thanks for advice!
     
  12. Adam Howard

    Adam Howard Well-Known Member

    Not 100% sure how to do that for all user ID's

    PHP:
    <xen:h1>{xen:phrase registered_members}</xen:h1>
    <
    xen:if is="!{xen:helper ismemberof, $visitor, x, y}">
    So this would be correct? Just replace X, Y, Z with user group number.
     
  13. Brogan

    Brogan XenForo Moderator Staff Member

    Just use if is="{$visitor.user_id}" which is for logged in members.
     
  14. Adam Howard

    Adam Howard Well-Known Member

    OK, but I also want to hide this from guest too. So will that work?
     
  15. Adam Howard

    Adam Howard Well-Known Member

    Hhhmmm....

    Seems not to be working. Everyone can still see the members list :(
     
  16. Brogan

    Brogan XenForo Moderator Staff Member

    As I posted above originally, you need to use both conditions to cater for logged in members and guests: {$visitor.user_id} OR !{$visitor.user_id}
     
  17. Adam Howard

    Adam Howard Well-Known Member

    Maybe I'm doing it wrong or maybe I don't understand, but that didn't work.

    But this one did work for me. :)

    PHP:
     <xen:h1>{xen:phrase registered_members}</xen:h1>
    <
    xen:if is="!{xen:helper ismemberof, $visitor, 1, 2, 3, 4, 5, 16}">
    Now if I can just figure out how to hide the tab as well :D
     
  18. Brogan

    Brogan XenForo Moderator Staff Member

    Just edit the navigation template to remove the tab.

    BTW, I tested the code I suggested above and this works fine:
    <xen:if is="{$visitor.user_id} OR !{$visitor.user_id}">
    Content to display to all visitors
    <xen:else />
    Content to hide
    </xen:if>
     
  19. Adam Howard

    Adam Howard Well-Known Member

    I'm very pleased to see that this works

    PHP:
    <xen:comment>  </xen:comment>
    Will be most useful for future usage :D

    Thank you very much for your help Brogan :cool:
     
  20. Adam Howard

    Adam Howard Well-Known Member

    Could be why it didn't work for me. I kept mine very simple.

    PHP:
    <xen:h1>{xen:phrase registered_members}</xen:h1>
    <
    xen:if is="!{xen:helper ismemberof, $visitor, x, y}">
    PHP:
    <xen:else />
    The Administrator has turned off this feature.
    [</
    xen:if>
    And within the navigation I was pleased to find that my wrap around code from vBulletin worked for XenForo, just replace vb with xen.

    PHP:
    <xen:comment> <!-- members -->
            <
    xen:if is="{$tabs.members}">
                <
    li class="navTab members {xen:if $tabs.members.selected, 'selected', 'Popup PopupControl PopupClosed'}">
                
                    <
    a href="{$tabs.members.href}class="navLink">{$tabs.members.title}</a>
                    <
    a href="{$tabs.members.href}class="SplitCtrl" rel="Menu"></a>
                    
                    <
    div class="{xen:if {$tabs.members.selected}, 'tabLinks', 'Menu JsOnly tabMenu'}">
                        <
    div class="primaryContent menuHeader">
                            <
    h3>{$tabs.members.title}</h3>
                            <
    div class="muted">{xen:phrase quick_links}</div>
                        </
    div>
                        <
    ul class="secondaryContent blockLinksList">
                        <
    xen:hook name="navigation_tabs_members">
                            <
    li><a href="{xen:link members}">{xen:phrase registered_members}</a></li>
                            <
    li><a href="{xen:link online}">{xen:phrase current_visitors}</a></li>
                            <
    xen:if is="{$xenOptions.enableNewsFeed}"><li><a href="{xen:link recent-activity}">{xen:phrase recent_activity}</a></li></xen:if>
                        </
    xen:hook>
                        </
    ul>
                    </
    div>
                </
    li>
            </
    xen:if>        </xen:comment>
    I like to try to do it with the least amount of code added or removed. This works for me. :)
     

Share This Page