Multi Prefix

Multi Prefix [Paid] 2.18.3

No permission to buy ($30.00)
I migrated from one server to another using the XenForo importer tool (not sure if relevant) but after re-activation the extension on my new 2.3 extension I get the following error:

ErrorException: Template error: [E_USER_WARNING] Function prefix_filters is unknown src/XF/Template/Templater.php:1215

#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/home/secusys/u...', 1215)
#1 src/XF/Template/Templater.php(1215): trigger_error('Function prefix...', 512)
#2 internal_data/code_cache/templates/l1/s6/public/thread_list_macros.php(496): XF\Template\Templater->func('prefix_filters', Array, true)
#3 src/XF/Template/Templater.php(1106): XF\Template\Templater->{closure:internal_data/code_cache/templates/l1/s6/public/thread_list_macros.php:255}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#4 src/XF/Template/Templater.php(1041): XF\Template\Templater->renderExtensionInternal('main_cell', Array, Array, Object(XF\Template\ExtensionSet))
#5 internal_data/code_cache/templates/l1/s6/public/thread_list_macros.php(624): XF\Template\Templater->renderExtension('main_cell', Array, Object(XF\Template\ExtensionSet))
#6 src/XF/Template/Templater.php(933): XF\Template\Templater->{closure:internal_data/code_cache/templates/l1/s6/public/thread_list_macros.php:607}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#7 internal_data/code_cache/templates/l1/s6/public/forum_view.php(118): XF\Template\Templater->callMacro('thread_list_mac...', 'item', Array, Array)
#8 src/XF/Template/Templater.php(1106): XF\Template\Templater->{closure:internal_data/code_cache/templates/l1/s6/public/forum_view.php:69}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#9 src/XF/Template/Templater.php(1041): XF\Template\Templater->renderExtensionInternal('thread_list', Array, Array, Object(XF\Template\ExtensionSet))
#10 internal_data/code_cache/templates/l1/s6/public/forum_view.php(571): XF\Template\Templater->renderExtension('thread_list', Array, Object(XF\Template\ExtensionSet))
#11 src/XF/Template/Templater.php(1818): XF\Template\Templater->{closure:internal_data/code_cache/templates/l1/s6/public/forum_view.php:380}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#12 src/addons/CleanTalk/XF/Template/Templater.php(105): XF\Template\Templater->renderTemplate('forum_view', Array, true, NULL)
#13 src/XF/Template/Template.php(24): CleanTalk\XF\Template\Templater->renderTemplate('public:forum_vi...', Array)
#14 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#15 src/XF/Mvc/Dispatcher.php(473): XF\Mvc\Renderer\Html->renderView('XF:Forum\\View', 'public:forum_vi...', Array)
#16 src/XF/Mvc/Dispatcher.php(455): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#17 src/XF/Mvc/Dispatcher.php(414): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#18 src/XF/Mvc/Dispatcher.php(66): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#19 src/XF/App.php(2830): XF\Mvc\Dispatcher->run()
#20 src/XF.php(850): XF\App->run()
#21 index.php(23): XF::runApp('XF\\Pub\\App')
#22 {main}
 
Rebuild the add-on, and if development was turned on ensure the _output folder doesn't exist.

Also make sure SV/StandardLib add-on is installed & enabled
 
Last edited:
I wanted to find out for sure that this add-on won't work if I want to allow just one specific thread prefix be added to any of the others. For example, if I have a NSFW thread prefix and I want to be able to add that one to any of the others like Gaming, Sports, Movies, etc. So a NSFW + Gaming or NSFW + Movies would be possible but not a Gaming + Movies or a Sports + Movies.

Was ChatGPT correct when it told me that isn't possible out of the box?
 
This add-on does does not a minimum prefix count per prefix group in a given forum, that would require some custom development.
 
I kept accidentally typing the thread title into the Prefixes... field because it was listed first and it kind of felt to me like I should be typing next to the No Prefix button if I didn't want a prefix. Anyways, I changed it from the standard:

multi-prefix-standard-post.webp

To this:

multi-prefix-custom-post.webp


I don't know css very well and used chatgpt and claude to help me. ChatGPT warned me my changes could affect and possibly break some of the following but I manually checked the ones I could and they seemed to work okay. I don't plan on using of the add-ons mentioned so I think I'm good.

- Post thread - full-page form
- Edit thread
- Edit first post
- Move thread
- Moderation actions that create a new thread from copied/moved posts
- RSS/feed configuration using thread title/prefix inputs
- Quick Thread should also be sanity-checked, although Multi Prefix handles
it through separate/specialized template logic
- XenForo Resource Manager
- DragonByte eCommerce
- DragonByte Shop
- XenConcept Project Manager
- XenConcept Project Manager task forms




Here's how it was done if anyone else is interested. Like I said, I'm not really a coder though so take that for what it is.

Code:
================================================================================
 1. TEMPLATE: sv_multiprefix_prefix_input
================================================================================

Admin CP:
  Appearance -> Styles -> [your style] -> Templates

Search for:
  sv_multiprefix_prefix_input


[A] PUT THREAD TITLE BEFORE PREFIXES
------------------------------------

FIND:

    <xf:if is="{$excludeRow} !== 'prefix'">
        <div class="prefixContainer">
            {$selectbox|raw}
        </div>
    </xf:if>

    <xf:if is="{$excludeRow} !== 'title'">
        <div class="inputGroup">
            {$textbox|raw}
        </div>
    </xf:if>

REPLACE WITH:

    <xf:if is="{$excludeRow} !== 'title'">
        <div class="inputGroup">
            {$textbox|raw}
        </div>
    </xf:if>

    <xf:if is="{$excludeRow} !== 'prefix'">
        <div class="prefixContainer">
            {$selectbox|raw}
        </div>
    </xf:if>

Purpose:
  Makes the full Post Thread form show the title input before the searchable
  prefix selector.


[B] REMOVE THE PRE-SELECTED "(No prefix)" TOKEN
-----------------------------------------------

FIND:

    arg-includeNone="{$includeNone}"

REPLACE WITH:

    arg-includeNone="{{ false }}"

Purpose:
  Leaves the prefix selector empty when no prefix is selected instead of
  displaying a selected-looking "(No prefix)" token.

Note:
  Verified that forums allowing zero prefixes can still create/edit threads with
  all prefixes removed.


[C] PREVENT DUPLICATED PREFIX-HELP TEXT
---------------------------------------

FIND:

    <xf:if is="$helpHref">

REPLACE WITH:

    <xf:if is="$helpHref && {$excludeRow} !== 'prefix'">

Purpose:
  Prevents prefix-help text from being rendered again on the title-only half
  of Multi Prefix "full-row" forms such as Edit Thread.


[D] LET HELP TEXT DISAPPEAR WHEN A PREFIX IS REMOVED
----------------------------------------------------

FIND:

    <div class="formRow-explain formRow-prefixHelp">

REPLACE WITH:

    <div class="formRow-explain formRow-prefixHelp prefix-id--{$selectedPrefixId}">

Purpose:
  Gives initially rendered help text the same prefix-specific class expected
  by Xon's JavaScript, allowing the correct description to disappear when a
  selected prefix is removed.

================================================================================
 2. TEMPLATE: sv_multiprefix_prefix_macros
================================================================================

Admin CP:
  Appearance -> Styles -> [your style] -> Templates

Search for:
  sv_multiprefix_prefix_macros


PLACEHOLDER CHANGE
------------------

FIND THIS EXACT LINE:

    placeholder="{{ ($max_tokens <= 0 || $max_tokens > 1) ? phrase('prefixes...')|for_attr : phrase('prefix...')|for_attr }}"

REPLACE IT WITH:

    placeholder="{{ ($min_tokens > 0 ? phrase('prefixes...') : phrase('xq_optional_prefixes'))|for_attr }}"

Result:
  - Minimum prefixes = 0  ->  Optional prefixes...
  - Minimum prefixes = 1+ ->  Prefixes...

Purpose:
  Makes it clear that selecting a prefix is optional when the forum allows
  zero prefixes.

================================================================================
 3. ADD THE CUSTOM PHRASE
================================================================================

Admin CP:
  Appearance -> Phrases -> Add phrase

Phrase title:

    xq_optional_prefixes

Phrase text:

    Optional prefixes...

Save the phrase.

Purpose:
  Keeps the visible wording in XenForo's phrase system instead of hard-coding
  it directly into the template.





Edit: On another note, I also made this add-on so that if a guest tries to load a thread with an NSFW prefix, they are shown a warning message first --> https://xenforo.com/community/resources/prefix-gate-thread-prefix-interstitial.10785/ (it works with or without the Multi Prefix add-on).
 
Last edited:
Thanks for the feedback some of those are legitimate bugs which I'll work on fixing that.

For the rest I'll implement some style properties for them. There is also some css cleanup which needs doing.
 
Xon updated Multi Prefix with a new update entry:

2.18.2 - Feature & Bugfix update

  • Compatibility fix for DBTech/eCommerce v5.0.0
  • Fix Single prefix filtering (all) option would disable users adding multiple prefixes for forums which required multiple prefixes
  • Harden max prefix count being greater than min prefix count was not handled the same on all 3 levels it is checked at (front-end enforcement, backend enforcement, edit forum node behavior)
  • Fix prefix help blob could be rendered twice on the edit thread form and also fail to be removed...

Read the rest of this update entry...
 
Thanks! I reverted all the custom changes I had made to the previous version and upgraded to 2.18.2. I then just had to uncheck "Render Prefixes selector before title" and "Show (no prefix) on edit form when prefixes are optional" in the style properties for Multi Prefix and it worked like I prefer. Plus the doubling up of the prefix descriptions when editing threads and adding/removing prefixes was fixed.

I did change it a little though. It was showing "Prefix..." in the selection field and since I allow no prefixes to be selected, I preferred that to say "Optional prefixes..." so in sv_multiprefix_prefix_macros I replaced all of this:

Code:
placeholder="{{ 
                    ($max_tokens > 1
                    ? ($min_tokens > 0 ? phrase('prefixes...') : phrase('prefix...'))
                    : ($min_tokens > 0 ? phrase('svMultiPrefix_optional_prefixes...') : phrase('svMultiPrefix_optional_prefix...'))
                    )|for_attr         
                }}"

with just this:

Code:
placeholder="{{ ($min_tokens > 0 ? phrase('prefixes...') : phrase('svMultiPrefix_optional_prefixes'))|for_attr }}"

And then to get the ellipses back I changed this phrase to:

Code:
svMultiPrefix_optional_prefixes = Optional prefixes...
 
I think it is just the logic over which phrase is picked is wrong, this should fix it;

Code:
placeholder="{{
                    ($max_tokens > 1
                    ? ($min_tokens > 0 ? phrase('prefixes...') : phrase('svMultiPrefix_optional_prefixes...'))
                    : ($min_tokens > 0 ? phrase('prefix...') : phrase('svMultiPrefix_optional_prefix...'))
                    )|for_attr        
                }}"
 
Back
Top Bottom