ok so i think i found a way to make the addon work firstly ensure that you have installed the addon and the standard library by Xon then go to any /post-thread, if you are having the problem i had where you couldn't see anything the prefix tab will look like this
View attachment 14824
this is becuase some script or css file was hard coded to hide the prefix menu (haven't figured out what it is yet)
this is the code below, on your site inspect the website (f12 on windows) and hover on the prefix tab and look at the style section.
.has-js .u-noJsOnly {
display: none !important;
}
for the fix this i used extra.less to overwrite the css with
.has-js .u-noJsOnly {
display: list-item !important;
}
now you will see the prefixes listed below and can even select them but the problem is this change will affect the edit mechanism of xenforo in some way, if you try to edit a thread or try to edit the first post it will fail, to get a but technical it will show you this error
Uncaught TypeError: this.$target is undefined
the script that manages multi prefixes is not being initialized well so at some point its failing and this results in the $target not being found
to fix this we need to edit the prefix_menu.min.js located in this patch <your_download_directory_of_the_addon>\XnForo.ir - Multi Prefix 2.11.1\XnForo.ir - Multi Prefix 2.11.1\upload\js\sv\multiprefix
open the file using notepad or vs code whichever you prefer, locate
init: function () {
var a = this.$target;
this.template = this.$target
.parent()
.find('script[type="text/template"]')
.html();
this.template ||
(console.error("No prefix template could be found"),
(this.template = ""));
a.on("config-update", c.proxy(this, "setupSelect2"));
a.trigger("config-update");
}
REPLACE THIS CODE WITH:
init: function () {
this.$target = this.$target || $('select[data-xf-init="sv-multi-prefix-menu"]'); // Fallback to finding the dropdown
if (!this.$target || !this.$target.is("select")) {
console.error("MultiPrefix: $target is undefined or not a <select> element.");
console.trace(); // Trace where this issue originates
return; // Exit gracefully
}
console.log("Manually initializing MultiPrefix for:", this.$target);
// Proceed with initialization
this.template = this.$target.parent().find('script[type="text/template"]').html();
if (!this.template) {
console.warn("No prefix template could be found. Using default template.");
this.template = '{{#rich_prefix}}<span class="{{css_class}}" data-prefix-id="{{prefix_id}}">{{title}}</span>{{/rich_prefix}}';
}
this.$target.on('config-update', $.proxy(this, 'setupSelect2'));
this.$target.trigger('config-update');
}
THEN ON THE BOTTON OF THE FILE ADD THIS CODE:
$(document).ready(function () {
// Locate dropdowns with or without the space in data-xf-init
var $select = $('select[data-xf-init="sv-multi-prefix-menu"], select[data-xf-init=" sv-multi-prefix-menu"]');
if ($select.length) {
console.log("Dropdown found:", $select);
// Initialize the handler manually
XF.Element.register('sv-multi-prefix-menu', SV.MultiPrefix.PrefixMenu);
$select.each(function () {
var $el = $(this);
$el.data('element-handler', new SV.MultiPrefix.PrefixMenu($el));
});
console.log("Manual initialization complete.");
} else {
console.error("Dropdown with data-xf-init='sv-multi-prefix-menu' not found.");
}
);
AFTER THAT SAVE THE FILE AND REUPLOAD THE ADDON AND MAKE A CLEAN INSTALLTION OF THE MULTI-PREFIX ADDON, YOU SHOULD NOW BE ABLE TO ADD PREFIXES AND WHEN YOU WANT TO EDIT A THREAD NO ERRORS WILL SHOW UP.
CLEAR CACHE, REBIULD TEMPLATES
if it doesn't work for you let me know!