[OzzModz] Forum Prefix Filter Block

[OzzModz] Forum Prefix Filter Block 2.0.1

No permission to download
I'd like to suggest the option to display this as only one row instead of two to be cleaner...

I'd also like the ability to change the default color of the "All threads" button.

Thanks a lot!
 
Thank you for that free addon.
I have also tested two more, one free, one paid.

[SC] Prefix Filter 2.0.0 Fix 1 adds now 17 more queries to my forum_list with only 5 threads and some prefixes.
Your addon is also not perfect for mke, because it shows all prefixes.

It would make sense, if i reduce the prefixes to the ones we often use.
But then new threads with not used prefixes will never come up.

A (not perfect solution, but useful for me) would be to have around 30 prefixes, but show only the ones i want to show.
For this i would need a list of used or not used ones. I will watch now the code and add something like:

if isset(tester_array[prefix]), then dont show this prefix. So i will be happy.
Maybe for other it could be nice to have a comma-list with prefix_ids in use (or not in use)

I hope i could explain my idea.




Example:

prefixes: red, green, blue, yellow
threads in the forum with prefixes red, green only
list for not to show prefix in this addon: ids of blue and yellow.

Result:

Nobody will click on an prefix without threads
People can add threads with all four colors.
After some time i will decide if i want to have more prefixes to sort by.
 
One more thing. If there is a filter used for example, the filter is not used again after clicking a prefix.
I guess it would be easy to remember the filter part from the url to have it again.
 
Currently it seems to show by prefix id. Would it be possible to reverse the order?

The reason: we have prefixes that categorise software versions. When the new version comes out a prefix is added for that ner version. But as the prefix obviously has the highest ID number it shows at the end of the block It makes sense for the newwest version to show at the beginning of the block.

Or else show in the display order or manually define the order. I tried changing the prefix ID in the database, but then the prefix just disappeared :(
 
Last edited:
Yes, I would second the suggestion to add more padding to the second line and remove the title row (Forum Prefix Filter) to make it cleaner.
 
Enabling on a per-forum basis would be another for the wish list. We have some forums where prefixes can be used, but the block isn't needed. Also, it appears above the subforum list. Having it right at the top of the thread list would be good.
 
This one can do it @penturners
 
1671705274796.webp

  • Error: Call to undefined method XF\Mvc\Reply\Reroute::setParams()
  • src/addons/OzzModz/ForumPrefix/XF/Pub/Controller/Forum.php:31
  • Generated by: Unknown account
  • 22.12.2022 at 11:47

Stack trace​

#0 src/addons/SV/StandardLib/XF/Pub/Controller/Forum.php(21): OzzModz\ForumPrefix\XF\Pub\Controller\Forum->actionForum(Object(XF\Mvc\ParameterBag))
#1 src/XF/Mvc/Dispatcher.php(352): SV\StandardLib\XF\Pub\Controller\Forum->actionForum(Object(XF\Mvc\ParameterBag))
#2 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Forum', 'Forum', Object(XF\Mvc\RouteMatch), Object(SV\StandardLib\XF\Pub\Controller\Forum), Object(XF\Mvc\Reply\Reroute))
#3 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\StandardLib\XF\Pub\Controller\Forum), Object(XF\Mvc\Reply\Reroute))
#4 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#6 src/XF.php(524): XF\App->run()
#7 index.php(20): XF::runApp('XF\\Pub\\App')
#8 {main}
 
Hey @Ozzy47, not sure what is causing the issue, when I try and make a new prefix I get this error.

Code:
Server error log
XF\Db\Exception: MySQL query error [1364]: Field 'ozzmodz_tpftt_discussion_type' doesn't have a default value src/XF/Db/AbstractStatement.php:230
Generated by: Jay Feb 8, 2023 at 9:16 PM
Stack trace
INSERT  INTO `xf_thread_prefix` (`css_class`, `prefix_group_id`, `display_order`, `allowed_user_group_ids`, `prefix_id`, `materialized_order`) VALUES (?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1364, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(79): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1364, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(220): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1521): XF\Db\AbstractAdapter->insert('xf_thread_prefi...', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1253): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Mvc/FormAction.php(71): XF\Mvc\Entity\Entity->save(true, false)
#7 src/XF/Mvc/FormAction.php(189): XF\Mvc\FormAction->XF\Mvc\{closure}(Object(XF\Mvc\FormAction))
#8 src/XF/Admin/Controller/AbstractPrefix.php(148): XF\Mvc\FormAction->run()
#9 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\AbstractPrefix->actionSave(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:ThreadPrefix', 'Save', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\ThreadPrefix), NULL)
#11 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\ThreadPrefix), NULL)
#12 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#14 src/XF.php(524): XF\App->run()
#15 admin.php(13): XF::runApp('XF\\Admin\\App')
#16 {main}
Request state
array(4) {
  ["url"] => string(33) "/admin.php?thread-prefixes/0/save"
  ["referrer"] => string(52) "https://*********/admin.php?thread-prefixes/add"
  ["_GET"] => array(1) {
    ["thread-prefixes/0/save"] => string(0) ""
  }
  ["_POST"] => array(12) {
    ["_xfToken"] => string(8) "********"
    ["title"] => string(8) "Feedback"
    ["description"] => string(0) ""
    ["usage_help"] => string(0) ""
    ["css_class"] => string(17) "label label--blue"
    ["prefix_group_id"] => string(2) "10"
    ["display_order"] => string(1) "1"
    ["usable_user_group"] => string(3) "all"
    ["node_ids"] => array(1) {
      [0] => string(2) "42"
    }
    ["_xfRequestUri"] => string(30) "/admin.php?thread-prefixes/add"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Please, add more padding to second line of prefixes!

View attachment 254878
Hi @Ozzy47
Thank you for this addon. I have used and appreciated this filter a lot.
I notice that you mentioned back 2 years ago you will fix the padding issue in the next release. I guess you didn't get to it yet.
If you point to the right direction, I think we can go and modify template ourselves.
Or you can release a quick fix, whatever best for you.
 
This is the code for the template where all the padding is decided.
Code:
<xf:if is="$hasPrefixes">
    <div class="block">
        <div class="block-container">
            <h2 class="block-header">{{ phrase('ozzmodzForumPrefix_title') }}</h2>
                <ul class="block-body" style="padding: 10px;">
                    <a href="{{ link('forums', $forum) }}"><span class="label label--blue" style="line-height: 1.8;">{{ phrase('ozzmodzForumPrefix_all_threads') }}</span></a>
                        <xf:foreach loop="array_keys($prefixes)" value="$groupId">
                            <xf:foreach loop="{$prefixes.{$groupId}}" key="$prefixId" value="$prefix">
                                <a href="{{ link('forums', $forum, {'prefix_id': $prefix.prefix_id}) }}" class="labelLink"><span class="{$prefix.css_class}" dir="auto" style="line-height: 1.8;">{{ prefix_title('thread', $prefixId) }}</span></a>
                            </xf:foreach>
                        </xf:foreach>
                </ul>
        </div>
    </div>
</xf:if>
 
The fix is to add a margin-bottom: 5px to the code
<a href="{{ link('forums', $forum, {'prefix_id': $prefix.prefix_id}) }}" class="labelLink"><span class="{$prefix.css_class}" dir="auto" style="line-height: 1.8; margin-bottom: 5px;"">{{ prefix_title('thread', $prefixId) }}</span></a>
 
If the prefixes are newlines, they are attached.
Could you add a little space?
Thanks

View attachment 289581
Until he does... think post #35 tells you how to resolve the issue by editing ozzmodzForumPrefix_block template, or do a TMS entry to do it so it keeps the edit upon upgrades.
Before modification:

Screen Shot 2023-08-08 at 3.02.12 AM.webp
After modification:

Screen Shot 2023-08-08 at 2.57.19 AM.png

I used the TMS process as I also have to add a gap:3px; into a segment of the template due to the style I use and the way I have it set to display the main site block container forum list.
 
Last edited:
We would like to have certain node on the forum to by default filter out topics with a certain prefix, but remain the possibility to show that one afterwards.
Would this addon allow for such usecase, so to select multiple default prefixes (of ignore specific ones) on a node-level base?
 
Top Bottom