Multi Prefix

Multi Prefix [Paid] 2.13.3

No permission to buy ($30.00)
Hello, I have an error:

XF\Db\Exception: MySQL query error [1265]: Data truncated for column 'prefix_id' at row 4 in src/XF/Db/AbstractStatement.php at line 212
  1. XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
  2. XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 78
  3. XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 79
  4. XF\Db\AbstractAdapter->query() in src/XF/Db/Schema/AbstractDdl.php at line 151
  5. XF\Db\Schema\AbstractDdl->apply() in src/XF/Db/SchemaManager.php at line 143
  6. XF\Db\SchemaManager->alterTable() in src/addons/SV/MultiPrefix/Setup.php at line 30
  7. SV\MultiPrefix\Setup->installStep1() in src/XF/AddOn/StepRunnerInstallTrait.php at line 60
  8. SV\MultiPrefix\Setup->installStepRunner() in src/XF/AddOn/StepRunnerInstallTrait.php at line 27
  9. SV\MultiPrefix\Setup->install() in src/XF/Admin/Controller/AddOn.php at line 390
  10. XF\Admin\Controller\AddOn->actionInstall() in src/XF/Mvc/Dispatcher.php at line 249
  11. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 89
  12. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
  13. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1931
  14. XF\App->run() in src/XF.php at line 328
  15. XF::runApp() in admin.php at line 13

I opened the ticket: Ticket ID: #140
 
@Xon

When a prefix is used on a thread, the used pre-fix appears on the browser tab. Is it possible to remove/disable this function somewhere?
 
would it be possible to include a permission that allows ignoring the min/max prefixes?
If you are willing to pay for the development time, sure. Otherwise it will go onto a very long list due to my existing XF1 => XF2 add-on conversion efforts.

@Xon

When a prefix is used on a thread, the used pre-fix appears on the browser tab. Is it possible to remove/disable this function somewhere?
You'll need to edit the thread_view template and adjust this line;
Code:
<xf:title page="{$page}">{{ prefix('thread', $thread, 'escaped') }}{$thread.title}</xf:title>
to
Code:
<xf:title page="{$page}">{$thread.title}</xf:title>
 
The following should remove all multiple prefixes picking the first to keep.


Run each statement one after the other.

Please ensure you have a database backup, or at least clone the xf_thread table somewhere as this is a destructive operation and this SQL is provided as-is and is a best effort.

SQL:
UPDATE xf_thread
SET prefix_id=IF(LEFT(prefix_id,LOCATE(',',prefix_id) - 1) != '', LEFT(prefix_id,LOCATE(',',prefix_id) - 1), prefix_id);
where prefix_id like '%,%';

UPDATE xf_thread
SET prefix_id = '0'
WHERE prefix_id = '';

alter table xf_thread prefix_id INT UNSIGNED NOT NULL DEFAULT 0;
@Xon Is there an updated query for that somewhere or is that the current state? Just making sure since the query is invalid because of the ; in the second line and nobody seemed to complain about it.
 
@Xon Is there an updated query for that somewhere or is that the current state? Just making sure since the query is invalid because of the ; in the second line and nobody seemed to complain about it.
It looks like that was fixed a while ago. Strictly speaking it isn't a problem due to the IF statement bit, but it would cause an error if you want it because the where clause is an invalid statement by itself. Having the where clause just avoids some database churn and ensures it is restartable if you need to run each statement in chunks.
 
Not sure if you mean fixed in your addon or where, but the client isn't running your addon any more, so I guess that's some legacy stuff. However, I just ran into that problem today (ES wasn't installed prior to that).
So basically just throw out the where clause, alright, thanks (y)

Meh, the CHANGE / MODIFY keyword is missing aswell:
SQL:
ALTER TABLE `xf_thread` CHANGE `prefix_id` `prefix_id` INT(10) UNSIGNED NOT NULL DEFAULT '0';
 
Last edited:
Top Bottom