Hide QuickLink for guests

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
User avatar
SAGOnly
Registered User
Posts: 7
Joined: Tue Dec 03, 2024 4:08 pm

Hide QuickLink for guests

Post by SAGOnly »

Hello, can you please advise me what should be the entry write in the file "navbar_header.html", which would show the quick links only to logged in users, but not to visitors ? Thank you for your help, sincerely Scott
quicklinks.png
You do not have the required permissions to view the files attached to this post.
User avatar
warmweer
Jr. Extension Validator
Posts: 12022
Joined: Fri Jul 04, 2003 6:34 am
Location: somewhere in the space-time continuum

Re: Hide QuickLink for guests

Post by warmweer »

SAGOnly wrote: Tue Dec 03, 2024 4:13 pm Hello, can you please advise me what should be the entry write in the file "navbar_header.html", which would show the quick links only to logged in users, but not to visitors ? Thank you for your help, sincerely Scott
quicklinks.png
Quite easy using the Group Template Variables extension (Guest are not logged in).
However if one knows the sublinks it can easily be bypassed.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
ssl
Registered User
Posts: 2065
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Hide QuickLink for guests

Post by ssl »

I have already explained to you how to do it on another board.

In the template find (line 15)

Code: Select all

<!-- IF S_DISPLAY_SEARCH -->


Replace by

Code: Select all

<!-- IF not S_IS_BOT and (S_DISPLAY_MEMBERLIST or U_TEAM) -->
Clear cache after
Sorry for my English ... I do my best! :anger_right:

:point_right_tone3: phpBB: 3.3.14 | PHP: 8.3.15
:point_right_tone4: [Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
User avatar
SAGOnly
Registered User
Posts: 7
Joined: Tue Dec 03, 2024 4:08 pm

Re: Hide QuickLink for guests

Post by SAGOnly »

ssl wrote: Tue Dec 03, 2024 5:06 pm
Hi, thank you for help. I've tried this in both the theme prosilver and the theme I use (HexagonRebornLight). I deleted all cookies, cleared the temporary cache, but it doesn't work.
User avatar
warmweer
Jr. Extension Validator
Posts: 12022
Joined: Fri Jul 04, 2003 6:34 am
Location: somewhere in the space-time continuum

Re: Hide QuickLink for guests

Post by warmweer »

SAGOnly wrote: Tue Dec 03, 2024 8:12 pm ...
I've tried this in both the theme prosilver and the theme I use (HexagonRebornLight). I deleted all cookies, cleared the temporary cache, but it doesn't work.
temporary cache? Do you mean board cache, browser cache or both (the latter being the the most complete.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
SAGOnly
Registered User
Posts: 7
Joined: Tue Dec 03, 2024 4:08 pm

Re: Hide QuickLink for guests

Post by SAGOnly »

warmweer wrote: Tue Dec 03, 2024 9:37 pm
Hi, both caches. I cleared the browser cache and the board cache directly. I also had the navbar_header.html file in the theme prosilver and copied it directly into the theme I'm using. I also downloaded the 0.3.0 development version of the "Group Template Variables extension" from github, which should also work on phpbb 3.3.x, but even these writes to a file where I specify only selected groups do not work. It's also possible that I'm just doing something wrong.
rxu
Extensions Development Team
Posts: 3991
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation

Re: Hide QuickLink for guests

Post by rxu »

You might need to wrap the whole <li id="quick-links" ... > ... </li> element into {% if S_REGISTERED_USER %} ... {% endif %} condition.
User avatar
ssl
Registered User
Posts: 2065
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Hide QuickLink for guests

Post by ssl »

SAGOnly wrote: Wed Dec 04, 2024 3:18 am It's also possible that I'm just doing something wrong
Certainly
The file modification is to be done in the style used for the board, we leave the prosilver style in its original state.
Can you provide us your modified file to see where the problem is coming from?
Sorry for my English ... I do my best! :anger_right:

:point_right_tone3: phpBB: 3.3.14 | PHP: 8.3.15
:point_right_tone4: [Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6541
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Hide QuickLink for guests

Post by thecoalman »

To elaborate on what rxu posted, open /styles/prosilver/template/navbar_header.html and at line 6 find:

Code: Select all

	<ul id="nav-main" class="nav-main linklist" role="menubar">
After add:

Code: Select all

	{% if S_REGISTERED_USER %}
At line 78 find:

Code: Select all

		</li>
After add:

Code: Select all

	{% endif %}
Save and uplaod, purge phpBB's cache after uploading.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
SAGOnly
Registered User
Posts: 7
Joined: Tue Dec 03, 2024 4:08 pm

Re: Hide QuickLink for guests

Post by SAGOnly »

ssl wrote: Wed Dec 04, 2024 6:56 am
SAGOnly wrote: Wed Dec 04, 2024 3:18 am It's also possible that I'm just doing something wrong
Certainly
The file modification is to be done in the style used for the board, we leave the prosilver style in its original state.
Can you provide us your modified file to see where the problem is coming from?
This is the navbar_header.html that I have in the theme I use

Code: Select all

<div class="navbar" role="navigation">
	<div class="inner">

	<ul id="nav-main" class="nav-main linklist" role="menubar">

		<li id="quick-links" class="quick-links dropdown-container responsive-menu<!-- IF not S_DISPLAY_QUICK_LINKS and not S_DISPLAY_SEARCH --> hidden<!-- ENDIF -->" data-skip-responsive="true">
			<a href="#" class="dropdown-trigger">
				<i class="icon fa-bars fa-fw" aria-hidden="true"></i><span>{L_QUICK_LINKS}</span>
			</a>
			<div class="dropdown">
				<div class="pointer"><div class="pointer-inner"></div></div>
				<ul class="dropdown-contents" role="menu">
					<!-- EVENT navbar_header_quick_links_before -->

					<!-- IF S_DISPLAY_SEARCH -->
						<li class="separator"></li>
						<!-- IF S_REGISTERED_USER -->
							<li>
								<a href="{U_SEARCH_SELF}" role="menuitem">
									<i class="icon fa-file-o fa-fw icon-gray" aria-hidden="true"></i><span>{L_SEARCH_SELF}</span>
								</a>
							</li>
						<!-- ENDIF -->
						<!-- IF S_USER_LOGGED_IN -->
							<li>
								<a href="{U_SEARCH_NEW}" role="menuitem">
									<i class="icon fa-file-o fa-fw icon-red" aria-hidden="true"></i><span>{L_SEARCH_NEW}</span>
								</a>
							</li>
						<!-- ENDIF -->
						<!-- IF S_LOAD_UNREADS -->
							<li>
								<a href="{U_SEARCH_UNREAD}" role="menuitem">
									<i class="icon fa-file-o fa-fw icon-red" aria-hidden="true"></i><span>{L_SEARCH_UNREAD}</span>
								</a>
							</li>
						<!-- ENDIF -->
							<li>
								<a href="{U_SEARCH_UNANSWERED}" role="menuitem">
									<i class="icon fa-file-o fa-fw icon-gray" aria-hidden="true"></i><span>{L_SEARCH_UNANSWERED}</span>
								</a>
							</li>
							<li>
								<a href="{U_SEARCH_ACTIVE_TOPICS}" role="menuitem">
									<i class="icon fa-file-o fa-fw icon-blue" aria-hidden="true"></i><span>{L_SEARCH_ACTIVE_TOPICS}</span>
								</a>
							</li>
							<li class="separator"></li>
							<li>
								<a href="{U_SEARCH}" role="menuitem">
									<i class="icon fa-search fa-fw" aria-hidden="true"></i><span>{L_SEARCH}</span>
								</a>
							</li>
					<!-- ENDIF -->

					<!-- IF not S_IS_BOT and (S_DISPLAY_MEMBERLIST or U_TEAM) -->
						<li class="separator"></li>
						<!-- IF S_DISPLAY_MEMBERLIST -->
							<li>
								<a href="{U_MEMBERLIST}" role="menuitem">
									<i class="icon fa-group fa-fw" aria-hidden="true"></i><span>{L_MEMBERLIST}</span>
								</a>
							</li>
						<!-- ENDIF -->
						<!-- IF U_TEAM -->
							<li>
								<a href="{U_TEAM}" role="menuitem">
									<i class="icon fa-shield fa-fw" aria-hidden="true"></i><span>{L_THE_TEAM}</span>
								</a>
							</li>
						<!-- ENDIF -->
					<!-- ENDIF -->
					<li class="separator"></li>

					<!-- EVENT navbar_header_quick_links_after -->
				</ul>
			</div>
		</li>

		<!-- EVENT overall_header_navigation_prepend -->
		<li <!-- IF not S_USER_LOGGED_IN -->data-skip-responsive="true"<!-- ELSE -->data-last-responsive="true"<!-- ENDIF -->>
			<a href="{U_FAQ}" rel="help" title="{L_FAQ_EXPLAIN}" role="menuitem">
				<i class="icon fa-question-circle fa-fw" aria-hidden="true"></i><span>{L_FAQ}</span>
			</a>
		</li>
		<!-- EVENT overall_header_navigation_append -->
		<!-- IF U_ACP -->
			<li data-last-responsive="true">
				<a href="{U_ACP}" title="{L_ACP}" role="menuitem">
					<i class="icon fa-cogs fa-fw" aria-hidden="true"></i><span>{L_ACP_SHORT}</span>
				</a>
			</li>
		<!-- ENDIF -->
		<!-- IF U_MCP -->
			<li data-last-responsive="true">
				<a href="{U_MCP}" title="{L_MCP}" role="menuitem">
					<i class="icon fa-gavel fa-fw" aria-hidden="true"></i><span>{L_MCP_SHORT}</span>
				</a>
			</li>
		<!-- ENDIF -->

	<!-- IF S_REGISTERED_USER -->
		<!-- EVENT navbar_header_user_profile_prepend -->
		<li id="username_logged_in" class="rightside <!-- IF CURRENT_USER_AVATAR --> no-bulletin<!-- ENDIF -->" data-skip-responsive="true">
			<!-- EVENT navbar_header_username_prepend -->
			<div class="header-profile dropdown-container">
				<a href="{U_PROFILE}" class="header-avatar dropdown-trigger"><!-- IF CURRENT_USER_AVATAR -->{CURRENT_USER_AVATAR} <!-- ENDIF --> {CURRENT_USERNAME_SIMPLE}</a>
				<div class="dropdown">
					<div class="pointer"><div class="pointer-inner"></div></div>
					<ul class="dropdown-contents" role="menu">
						<!-- IF U_RESTORE_PERMISSIONS -->
							<li>
								<a href="{U_RESTORE_PERMISSIONS}">
									<i class="icon fa-refresh fa-fw" aria-hidden="true"></i><span>{L_RESTORE_PERMISSIONS}</span>
								</a>
							</li>
						<!-- ENDIF -->

					<!-- EVENT navbar_header_profile_list_before -->

						<li>
							<a href="{U_PROFILE}" title="{L_PROFILE}" role="menuitem">
								<i class="icon fa-sliders fa-fw" aria-hidden="true"></i><span>{L_PROFILE}</span>
							</a>
						</li>
						<!-- IF U_USER_PROFILE -->
							<li>
								<a href="{U_USER_PROFILE}" title="{L_READ_PROFILE}" role="menuitem">
									<i class="icon fa-user fa-fw" aria-hidden="true"></i><span>{L_READ_PROFILE}</span>
								</a>
							</li>
						<!-- ENDIF -->

						<!-- EVENT navbar_header_profile_list_after -->

						<li class="separator"></li>
						<li>
							<a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x" role="menuitem">
								<i class="icon fa-power-off fa-fw" aria-hidden="true"></i><span>{L_LOGIN_LOGOUT}</span>
							</a>
						</li>
					</ul>
				</div>
			</div>
			<!-- EVENT navbar_header_username_append -->
		</li>
		<!-- IF S_DISPLAY_PM -->
			<li class="rightside" data-skip-responsive="true">
				<a href="{U_PRIVATEMSGS}" role="menuitem">
					<i class="icon fa-inbox fa-fw" aria-hidden="true"></i><span>{L_PRIVATE_MESSAGES} </span><strong class="badge<!-- IF not PRIVATE_MESSAGE_COUNT --> hidden<!-- ENDIF -->">{PRIVATE_MESSAGE_COUNT}</strong>
				</a>
			</li>
		<!-- ENDIF -->
		<!-- IF S_NOTIFICATIONS_DISPLAY -->
			<li class="dropdown-container dropdown-{S_CONTENT_FLOW_END} rightside" data-skip-responsive="true">
				<a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger">
					<i class="icon fa-bell fa-fw" aria-hidden="true"></i><span>{L_NOTIFICATIONS} </span><strong class="badge<!-- IF not NOTIFICATIONS_COUNT --> hidden<!-- ENDIF -->">{NOTIFICATIONS_COUNT}</strong>
				</a>
				<!-- INCLUDE notification_dropdown.html -->
			</li>
		<!-- ENDIF -->
		<!-- EVENT navbar_header_user_profile_append -->
	<!-- ELSE IF not S_IS_BOT -->
		<li class="rightside"  data-skip-responsive="true">
			<a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x" role="menuitem">
				<i class="icon fa-power-off fa-fw" aria-hidden="true"></i><span>{L_LOGIN_LOGOUT}</span>
			</a>
		</li>
		<!-- IF S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) -->
			<li class="rightside" data-skip-responsive="true">
				<a href="{U_REGISTER}" role="menuitem">
					<i class="icon fa-pencil-square-o  fa-fw" aria-hidden="true"></i><span>{L_REGISTER}</span>
				</a>
			</li>
		<!-- ENDIF -->
		<!-- EVENT navbar_header_logged_out_content -->
	<!-- ENDIF -->
	</ul>

	<ul id="nav-breadcrumbs" class="nav-breadcrumbs linklist navlinks" role="menubar">
		{% set MICRODATA = 'itemtype="https://schema.org/ListItem" itemprop="itemListElement" itemscope' %}
		{% set navlink_position = 1 %}

		{% EVENT overall_header_breadcrumbs_before %}

		<li class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">

			{% if U_SITE_HOME %}
				<span class="crumb" {{ MICRODATA }}><a itemprop="item" href="{{ U_SITE_HOME }}" data-navbar-reference="home"><i class="icon fa-home fa-fw" aria-hidden="true"></i><span itemprop="name">{{ L_SITE_HOME }}</span></a><meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}" /></span>
			{% endif %}

			{% EVENT overall_header_breadcrumb_prepend %}
				<span class="crumb" {{ MICRODATA }}><a itemprop="item" href="{{ U_INDEX }}" accesskey="h" data-navbar-reference="index">{% if not U_SITE_HOME %}<i class="icon fa-home fa-fw"></i>{% endif %}<span itemprop="name">{{ L_INDEX }}</span></a><meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}" /></span>

			{% for navlink in navlinks %}
				{% set NAVLINK_NAME = navlink.BREADCRUMB_NAME | default(navlink.FORUM_NAME) %}
				{% set NAVLINK_LINK = navlink.U_BREADCRUMB | default(navlink.U_VIEW_FORUM) %}

				{% EVENT overall_header_navlink_prepend %}
				<span class="crumb" {{ MICRODATA }}{% if navlink.MICRODATA %} {{ navlink.MICRODATA }}{% endif %}><a itemprop="item" href="{{ NAVLINK_LINK }}"><span itemprop="name">{{ NAVLINK_NAME }}</span></a><meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}" /></span>
				{% EVENT overall_header_navlink_append %}
			{% endfor %}

			{% EVENT overall_header_breadcrumb_append %}
		</li>

		{% EVENT overall_header_breadcrumbs_after %}

		{% if S_DISPLAY_SEARCH and not S_IN_SEARCH %}
			<li class="rightside responsive-search">
				<a href="{{ U_SEARCH }}" title="{{ lang('SEARCH_ADV_EXPLAIN') }}" role="menuitem">
					<i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">{{ lang('SEARCH') }}</span>
				</a>
			</li>
		{% endif %}
	</ul>

	</div>
</div>
User avatar
SAGOnly
Registered User
Posts: 7
Joined: Tue Dec 03, 2024 4:08 pm

Re: Hide QuickLink for guests

Post by SAGOnly »

thecoalman wrote: Wed Dec 04, 2024 11:12 am To elaborate on what rxu posted, open /styles/prosilver/template/navbar_header.html and at line 6 find:

Code: Select all

	<ul id="nav-main" class="nav-main linklist" role="menubar">
After add:

Code: Select all

	{% if S_REGISTERED_USER %}
At line 78 find:

Code: Select all

		</li>
After add:

Code: Select all

	{% endif %}
Save and uplaod, purge phpBB's cache after uploading.
I've tried it in both the theme prosilver and the theme I use, following your instructions exactly, it still doesn't work.
User avatar
warmweer
Jr. Extension Validator
Posts: 12022
Joined: Fri Jul 04, 2003 6:34 am
Location: somewhere in the space-time continuum

Re: Hide QuickLink for guests

Post by warmweer »

SAGOnly wrote: Wed Dec 04, 2024 3:36 pm
thecoalman wrote: Wed Dec 04, 2024 11:12 am To elaborate on what rxu posted, open /styles/prosilver/template/navbar_header.html and at line 6 find:

Code: Select all

	<ul id="nav-main" class="nav-main linklist" role="menubar">
Probably a typo by thecoalman : it's on line 4

Looking at prosilver's code (3314) : it should work (not worth testing).

As to the other style you're using it should be quite similar but line nrs may be different.
As to the editing: do not use Windows notepad but rather a pure text processor, Editplus/Notepad++ or similar
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
ssl
Registered User
Posts: 2065
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Hide QuickLink for guests

Post by ssl »

The style used is a child style of HexagonReborn, so it is in this style that the modification must be made

Open ./styles/HexagonReborn/template/navbar_main.html, find (line 145)

Code: Select all

{% if S_DISPLAY_SEARCH %}
Replace with

Code: Select all

{% if S_REGISTERED_USER %}
Save and clear cache

Capture d’écran 2024-12-04 à 18.59.14.png

You can see the change here by selecting the style: https://phpbb-forum.ovh/ssl/


Support for this style should be here: https://www.phpbb.com/customise/db/styl ... rn/support
You do not have the required permissions to view the files attached to this post.
Sorry for my English ... I do my best! :anger_right:

:point_right_tone3: phpBB: 3.3.14 | PHP: 8.3.15
:point_right_tone4: [Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
User avatar
SAGOnly
Registered User
Posts: 7
Joined: Tue Dec 03, 2024 4:08 pm

Re: Hide QuickLink for guests

Post by SAGOnly »

ssl wrote: Wed Dec 04, 2024 6:04 pm
Hi, thanks a lot for the help, this procedure is already working properly, at the same time I managed to hide the FAQ section with this entry, and that's also great. Guests now see the top navbar only as follows...
head.png
Thank you very much for your willingness. Best Regards, Scott
You do not have the required permissions to view the files attached to this post.
User avatar
P_I
Community Team Member
Community Team Member
Posts: 2544
Joined: Tue Mar 01, 2011 8:35 pm
Location: Western Canada 🇨🇦

Re: Hide QuickLink for guests

Post by P_I »

Glad to see you got this resolved to your satisfaction.

I have to wonder out loud why you made this change. From my perspective Guests are potential new members and as such should be introduced to your board in the best possible way. You never get a second change to make a first impression comes to mind.

The Quick links and FAQ link on the navigation bar are common to phpBB boards and can provide helpful starting points if someone is unfamiliar with phpBB-based boards. When I visit a phpBB based board as a guest I commonly use the Quick links Active topics link to understand what is "currently happening" on the board that might interest me.
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams

Return to “phpBB Custom Coding”