[SNIPPET] Topic Prefix - Mandatory

Mixed forum with phpBB code snippets
Guides and styles

[SNIPPET] Topic Prefix - Mandatory

Post by Stoker »

Topic Prefix - Mandatory

If you are using the Topic Prefix Extension and want the topic prefix to be mandatory, here is an easy solution supported by most browsers.

Open: /ext/phpbb/topicprefixes/styles/all/template/event/ext/phpbb/topicprefixes/styles/all/template/event
Find: <select name="topic_prefix" id="topic_prefix">
Replace with: <select name="topic_prefix" id="topic_prefix" required>

Okay, so you only want it to be mandatory in specific forum(s)?
You need to know the forum ID - you can see it in the link when visiting the specific forum.

In this example we want to exclude forum ID 6 from requering the topic prefix.
Then the replace would be: <select name="topic_prefix" id="topic_prefix"{% if FORUM_ID eq 6 %} required{% endif %}>

If more forums should be excluded the replace could be: <select name="topic_prefix" id="topic_prefix"{% if FORUM_ID in [2,4,11,25] %} required{% endif %}>

Save, upload and purge cache.
Last edited by Stoker on 23 Apr 2025, 07:09, edited 2 times in total.