Skip to content

Group Switches

William Jacoby edited this page Sep 28, 2026 · 1 revision

phpBB doesn't tell templates which groups the person viewing the page belongs to. The Group Switches extension (phpbbmodders/groupswitches) adds that: on every page it sets a switch named S_GROUP_<id> for each group the viewer is a member of, where <id> is the group's number.

The menu uses these switches to show some entries only to certain groups. Without Group Switches installed and enabled, every S_GROUP_… check is false, so those entries stay hidden from everyone. The rest of the menu works normally.

Set it up

  1. Install and enable Group Switches (installation steps are in its README).
  2. Find the group's number under ACP → Users and Groups → Group Switches, which lists every group with its ID.
  3. Use that number in the menu file (see Editing the menu) and purge the board cache.

On a default phpBB install the built-in groups are usually:

ID Group
1 Guests
2 Registered users
4 Global moderators
5 Administrators
7 Newly registered users

Groups you create yourself get higher numbers, which differ from board to board, so always check the ACP list. The menu's default file uses 528, the staff group on phpbbmodders.com; change it to your own group's ID.

Examples

Only administrators:

{% if S_GROUP_5 %}
	<li><a href="https://www.example.com/admin-notes/">Admin notes</a></li>
{% endif %}

Administrators or global moderators:

{% if S_GROUP_5 or S_GROUP_4 %}
	<li><a href="https://www.example.com/staff/">Staff area</a></li>
{% endif %}

Everyone except members of a group (here, a custom group 12):

{% if not S_GROUP_12 %}
	<li><a href="https://www.example.com/upgrade/">Become a supporter</a></li>
{% endif %}

A single entry inside a dropdown can be group-only too:

<li>
	<a role="button">Downloads</a>
	<ul>
		<li><a href="https://www.example.com/downloads/">Downloads</a></li>
		{% if S_GROUP_5 %}
			<li><a href="https://www.example.com/archive/">Archive (admins)</a></li>
		{% endif %}
	</ul>
</li>

Good to know

  • A switch is set for every group the viewer belongs to, not just their default group.
  • Guests are in group 1, so {% if S_GROUP_1 %} shows an entry to guests only. For "logged in or not", phpBB's own S_USER_LOGGED_IN works without Group Switches; see Editing the menu.
  • Hiding a menu entry doesn't protect the page it links to. Use phpBB permissions for anything that must stay private.

Clone this wiki locally