[SNIPPET] MCP link on ALL pages

Mixed forum with phpBB code snippets
Guides and styles

[SNIPPET] MCP link on ALL pages

Post by Stoker »

MCP link on ALL pages - Admin only

Lets make the MCP link visible on all pages.
The first part is for Admins only. Moderators will only see the MCP link the usual places.
Note that you can bypass this by giving Moderators a simple admin permission like Can view php settings.
Further more you can hide the ACP link by changing: <!-- IF U_ACP --> in the navbar_header.html and overall_footer.html to: {% if U_ACP and not (S_USERNAME in ['name1', 'name2']) %}
Change/add/remove name1 and name2 to the moderator names.
Also remember the change the <!-- ENDIF --> to {% endif %}

Open: styles/prosilver/template/navbar_header.html

Find:

Code: Select all

		<!-- 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 -->
Replace with:

Code: Select all

		{% if U_ACP %}
			<li data-last-responsive="true">
				<a href="{U_MODCP}" title="{L_MCP}" role="menuitem">
					<i class="icon fa-gavel fa-fw" aria-hidden="true"></i><span>{L_MCP_SHORT}</span>
				</a>
			</li>
		{% elseif 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 %}
Save file, upload and purge cache.



MCP link on ALL pages - Define the users

The second part does make it visible for the users you define in the code.

Open: styles/prosilver/template/navbar_header.html

Find:

Code: Select all

		<!-- 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 -->
Replace with:

Code: Select all

		{% if S_USERNAME in ['name1', 'name2', 'name3', 'name4', 'name5', 'name6'] %}
			<li data-last-responsive="true">
				<a href="{U_MODCP}" title="{L_MCP}" role="menuitem">
					<i class="icon fa-gavel fa-fw" aria-hidden="true"></i><span>{L_MCP_SHORT}</span>
				</a>
			</li>
		{% endif %}
Save file, upload and purge cache.

This part: {% if S_USERNAME in ['name1', 'name2', 'name3', 'name4', 'name5', 'name6'] %} is where you define who should see the MCP link.
The downside is you have to edit that line each time you add or remove users everytime somebody enter or leave the Moderator group.
Lets say you only have 3 moderators on your board. Lets call them Peter, Paul and Mary.
Then the line would look like this: {% if S_USERNAME in ['Peter', 'Paul', 'Mary'] %}
Last edited by Stoker on 18 May 2025, 08:56, edited 7 times in total.
Reason: - Code updated

[SNIPPET] MCP link on ALL pages

Post by Stoker »

Code updated a couple of times :D

[SNIPPET] MCP link on ALL pages

Post by Steve »

includes/functions
find:

Code: Select all

		'U_MODCP'				=> append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id),
replace with:

Code: Select all

		'U_MODCP'				=>  ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id) : false,

[SNIPPET] MCP link on ALL pages

Post by Stoker »

Steve wrote: 18 May 2025, 09:45 includes/functions
find:

Code: Select all

		'U_MODCP'				=> append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id),
replace with:

Code: Select all

		'U_MODCP'				=>  ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id) : false,
Great, with above edit this one works for Mods only, on all pages :thumb:

Code: Select all

{% if U_MODCP %}
			<li data-last-responsive="true">
				<a href="{U_MODCP}" title="{L_MCP}" role="menuitem">
					<i class="icon fa-gavel fa-fw" aria-hidden="true"></i><span>{L_MCP_SHORT}</span>
				</a>
			</li>
		{% endif %}