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

removing members tab

Brogan

XenForo moderator
Staff member
#2
Edit the navigation template and remove the <!-- members --> section.

It won't stop anyone accessing the members page though if they know the URL.
 

Jake Bunce

XenForo moderator
Staff member
#3
You can remove the tab from the templates:

Admin CP -> Appearance -> Templates -> navigation

Remove this entire block of code:

Code:
		<!-- 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">
						<li><a href="{xen:link members}">{xen:phrase registered_members}</a></li>
						<li><a href="{xen:link online}">{xen:phrase current_visitors}</a></li>
						<li><a href="{xen:link recent-activity}">{xen:phrase recent_activity}</a></li>
					</ul>
				</div>
			</li>
		</xen:if>
Note that this will affect profile pages which are bound to the members tab.

edit - brogan! :p
 

Ryan Kent

Well-known member
#5
Note that this will affect profile pages which are bound to the members tab.

edit - brogan! :p
I am not clear on this last part. By removing the block of code mentioned above the link in the main navigation bar will be removed. If a member manually navigates to the page, or if they go to profile pages via their user card, how are they affected?
 

Jake Bunce

XenForo moderator
Staff member
#6
I am not clear on this last part. By removing the block of code mentioned above the link in the main navigation bar will be removed. If a member manually navigates to the page, or if they go to profile pages via their user card, how are they affected?
There will be no active tab on profile pages. All of the nav tabs will be inactive.
 

Joe Link

Well-known member
#7
How can I remove the tab, but preserve the "Notable Members" "Current Visitors" and "Recent Activity" links if the page is navigated to via a link or direct url?

Capture.JPG
 

Jake Bunce

XenForo moderator
Staff member
#8
How can I remove the tab, but preserve the "Notable Members" "Current Visitors" and "Recent Activity" links if the page is navigated to via a link or direct url?

View attachment 67929
It would be necessary to assign those pages to a different tab. There isn't a good way to do this. The easiest way is to edit this file:

library/XenForo/Route/Prefix/Members.php

Change the red piece to some other tabid:

Code:
<?php

class XenForo_Route_Prefix_Members implements XenForo_Route_Interface
{
	/**
	 * Match a specific route for an already matched prefix.
	 *
	 * @see XenForo_Route_Interface::match()
	 */
	public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
	{
		$action = $router->resolveActionWithIntegerParam($routePath, $request, 'user_id');
		return $router->getRouteMatch('XenForo_ControllerPublic_Member', $action, 'members');
	}

	/**
	 * Method to build a link to the specified page/action with the provided
	 * data and params.
	 *
	 * @see XenForo_Route_BuilderInterface
	 */
	public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
	{
		if (isset($extraParams['page']))
		{
			if (strval($extraParams['page']) !== XenForo_Application::$integerSentinel && $extraParams['page'] <= 1)
			{
				unset($extraParams['page']);
			}
		}

		return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'user_id', 'username');
	}
}
Tab IDs of navigation tabs can be seen in the HTML source:

Code:
<li class="navTab members Popup PopupControl PopupClosed">
Or if you specify a tabid that doesn't exist then it will have the effect of not selecting any tab which is also acceptable.
 

t0daY

Active member
#9
It would be necessary to assign those pages to a different tab. There isn't a good way to do this. The easiest way is to edit this file:

library/XenForo/Route/Prefix/Members.php

Change the red piece to some other tabid:

Code:
<?php

class XenForo_Route_Prefix_Members implements XenForo_Route_Interface
{
    /**
     * Match a specific route for an already matched prefix.
     *
     * @see XenForo_Route_Interface::match()
     */
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        $action = $router->resolveActionWithIntegerParam($routePath, $request, 'user_id');
        return $router->getRouteMatch('XenForo_ControllerPublic_Member', $action, 'members');
    }

    /**
     * Method to build a link to the specified page/action with the provided
     * data and params.
     *
     * @see XenForo_Route_BuilderInterface
     */
    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    {
        if (isset($extraParams['page']))
        {
            if (strval($extraParams['page']) !== XenForo_Application::$integerSentinel && $extraParams['page'] <= 1)
            {
                unset($extraParams['page']);
            }
        }

        return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'user_id', 'username');
    }
}
Tab IDs of navigation tabs can be seen in the HTML source:

Code:
<li class="navTab members Popup PopupControl PopupClosed">
Or if you specify a tabid that doesn't exist then it will have the effect of not selecting any tab which is also acceptable.
Sorry for jumping here in when this post is nearly 2 years old, but is it possible to assign a static page to the members tab? And displaying it as the first page when you are clicking on "Members"?
 

Jake Bunce

XenForo moderator
Staff member
#10
Sorry for jumping here in when this post is nearly 2 years old, but is it possible to assign a static page to the members tab? And displaying it as the first page when you are clicking on "Members"?
Consider using this addon to create an entirely new tab (with the same name if you want):

https://xenforo.com/community/resources/nodes-as-tabs.9/

A page node can be used as a "static page".