HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

FilterForumSearch plugin

2

Comments

  • KasparKaspar ✭✭✭

    Superb :-)


    The acting a little weird is after I added my attempt to make a search button.

    Before I change anything it worked as intended and expected(as you described it).

  • pioc34pioc34 ✭✭

    Hi @TwistedTwigleg

    just one thing:

    you have forgotten to Gdn::translate'Search in discussion contents and title'and 'All Discussions' in /view/index.php

  • Version 2.3.0:

    • Added more Gdn::translate function calls. Now it should, hopefully, be applied to every text element!
      • Thanks @pioc34 for letting me know about the missed Gdn::translate function call!
    • Removed footnote and replaced it with a button, eliminating the need to scroll up and press enter to apply filters.
      • Thanks @Kasper for the feedback and suggestion!
    • Changed the name of the CSS file so it would not be overwritten by the Bootstrap theme. Edited CSS to properly position the button.
    • Results returned by the search now will ONLY contain discussions the user has permission to view

    If you are using this plugin, please update to version 2.3.0!

    Prior to version 2.3.0, the search would return results from every discussion, regardless of whether the user was supposed to have permission or not!

    Selecting the results wouldn't bring them to the topic, thankfully, however they could still see the preview text. Still, this means they got results they were not supposed to see (like topics in the Moderation board). I didn't catch this because I was always logged in as my admin profile when testing, so seeing all the results was what I expected.

    Version 2.3.0 fixes the issue by only returning results that the user (or guest) has permission to see. I did some testing and it seems to be fixed now. Hopefully the issue is fully fixed for all categories and usecases, though I haven't had the time to do extensive testing just yet. If anyone has any strange/unexpected search results, please let me know so I can fix it!

    Thanks! 🙂

  • KasparKaspar ✭✭✭
    • Results returned by the search now will ONLY contain discussions the user has permission to view

    ohh my. Did not test for that either.

    Seems ok now.


    Removed footnote and replaced it with a button, eliminating the need to scroll up and press enter to apply filters.

    Foodnote is gone but I see no button

  • KasparKaspar ✭✭✭

    Figured it out

    in /design/search-style.css you got capital B both places

    .SearchForm .Button, .search-form .Button
    


    search-style.css should be

    .SearchForm .Button, .search-form .button
    


    May I suggest adding

    .Button:hover, .button:hover{
      filter:brightness(0.7); 
    }
    


  • KasparKaspar ✭✭✭

    Correction

    .sidebar-toggle:hover, .Button:hover, .button:hover{
      filter:brightness(0.7); 
    }
    
  • @Kaspar said

    ohh my. Did not test for that either.

    Seems ok now.

    Yeah, I only happened across it by accident when I was testing to make sure it worked with users not logged in, when I found results from the moderation board showing up. Once I realized what was happening, I tried to quickly fix it, hopefully before anyone else noticed.

    It was a bit of a mad dash, especially since I couldn't find much reference for filtering discussions by their category, but in the end I think I figured it out.

    I'm glad it seems to be working on your end as well! It also seems to be working on the forums I'm hosting.

    Figured it out

    in /design/search-style.css you got capital B both places

    Awesome! I'm glad you were able to figure it out. I will upload a new version with the fixed CSS.

    May I suggest adding

    ...

    I don't think I will be adding this to the CSS, because it doesn't go with the theme of the forums I'm hosting. Maybe I can find a way to give it a class so it can be overwritten in the theme CSS, but I would need to investigate first. I'll try to find a middle ground if possible, it just might take a bit.

    Thanks!

  • Version 2.3.1:

    • Fixed style.css not including .button, which was causing the button to not be styled correctly for some themes. (Thanks @Kaspar )

    Sorry about the long delay, things got a lot more busy than I expected!

  • So from 2.3.0 -> 2.3.1 some major changes have broken the plugin altogether making unusable :(

    And I am unable to pinpoint (yet) was is doing it.

    It no longer searches discussions without comments, or returns comments instead of discussion.

    It no longer works if user has this custom function: function discussionUrl(){...} ; it blows up with this error:  Column 'CategoryID' in where clause is ambiguous

    I will keep digging!

  • despecialdespecial New
    edited December 2019

    Trying to install 2.3.1 and get this error code:

    "Filtered Forum Search requires: qna." (as I understand this is the Question&Answer plugin)

    We don't need to use the Q&A Plugin, so will it be possible to remove the support/requirement if QNA is not installed?

  • edited December 2019

    @donshakespeare sorry about the delay in replying! I somehow missed the notification. As for the issue, I’m not sure what would be causing it. From what I remember, I had to make some changes behind the scenes to fix the search results returning posts the user was not allowed to see, but that was in 2.3.0. I think all that changed in 2.3.1 was the CSS addition. I’m not sure why those changes would introduce an error.

    @despecial the plug-in requires the QnA plugin for filtering search results by QnA status. This makes it where you can search for all answered questions, for example. The QnA plugin required is the official Vanilla QnA plugin.

  • Thanks @TwistedTwigleg .

    I had two issues, I fixed the first, but the second is still at large.

    1. It no longer works if user has this custom function: function discussionUrl(){...} ; it blows up with this error: Column 'CategoryID' in where clause is ambiguous
    2. It no longer searches discussions without comments, or returns comments instead of discussion.

    Can you inspect your returned results? All I get are links with comment urls.

    If only the main discussion has the text being searched, all 100 links to its 100 comments are returned, except of course the link to the discussion.

    Thanks

  • @TwistedTwigleg thanks for the reply. I don't really understand why I would install a plugin that is required but not used.

    See, we do not use QnA on our forum, so the search options wouldn't be necessary at all.

    Why hasn't the plugin a build in logic to check if the QNA plugin is active and show the additional search options, otherwise just function as a normal, extended search?

  • @donshakespeare said:

    1| It no longer works if user has this custom function: function discussionUrl(){...} ; it blows up with this error: Column 'CategoryID' in where clause is ambiguous

    Interesting, I'm not totally sure why that is happen to be honest. I'm glad you were able to work around it though!

    2| It no longer searches discussions without comments, or returns comments instead of discussion.

    Can you inspect your returned results? All I get are links with comment urls.

    Yeah, I just checked and I'm getting the same results. I'm guessing something with searching by discussion title is messed up. Right now my schedule is really busy, but I'll make a GitHub issue so I hopefully remember to take a look at the issue once I have a chance.

    Without looking carefully at the code, my guess is that the code for searching in the discussion title is messed up and/or not being parsed correctly to the SQL query. Thanks for reporting the issue, once I have the chance I'll try to take a look at it.


    @despecial said:

    @TwistedTwigleg thanks for the reply. I don't really understand why I would install a plugin that is required but not used.

    See, we do not use QnA on our forum, so the search options wouldn't be necessary at all.

    Why hasn't the plugin a build in logic to check if the QNA plugin is active and show the additional search options, otherwise just function as a normal, extended search?

    It is required for the plugin, as the code for the plugin expects (and requires) it to be there so it does not crash. I tailored the plugin for the forums I run, where we use the QnA plugin, as I wanted to be able to search by QnA results.

    The plugin does not have logic to check for the QnA plugin and change based on the availability for two reasons. The first reason is that I do know know how to do that in PHP with Vanilla, and when I wrote the plugin I needed it sooner rather than later. The second reason is that it works fine for the forums I run, which is why I developed the plugin. Because I am maintaining the plugin, the added time and complexity required to have the search change based on available plugins is not worth it for me personally.

    That said, if you want to make the plugin work without the QnA plugin, it should be just a matter of removing the QnA specific code, which shouldn't be too difficult if you know what you are looking for.

  • @TwistedTwigleg and@despecial the check for the QNA plugin is inessential and unnecessary since this wonderful and awesome search plugin works without QNA. The QNA bits are triggered only on demand.

    Go to plugins/FilteredForumSearch/class.filteredforumsearch.plugin.php

    and remove ...

      'RequiredPlugins' => array ('QnA' => '1.4'),


    And everything below is for cosmetics ...



    And/or go to plugins/FilteredForumSearch/views/index.php

    before the first echo

    add:

    $QNA_Menu = '';
    if (class_exists('QnAPlugin')) {
    	$QNA_Menu = 
    	'<div class="SearchAnswerDropdown">'.
    	$Form->Label(Gdn::translate('Filter by Q&A'), 'ADV_Filter_QNA'). ' ' .
    	$Form->DropDown('ADV_Filter_QNA', $AnswerDropdownOptions, $AnswerDropdownFields).
    	'</div>';
    }
    


    Then find this bit

    // Q&A dropdown
    '<div class="SearchAnswerDropdown">',
    $Form->Label(Gdn::translate('Filter by Q&A'), 'ADV_Filter_QNA'), ' ',
    $Form->DropDown('ADV_Filter_QNA', $AnswerDropdownOptions, $AnswerDropdownFields).
    '</div>',
    

    And replace with

    // Q&A dropdown
    $QNA_Menu,
    
  • awesome. thanks a lot!

  • Worked like a charm.

    If you need support in translations (e.g. german), let me know.

  • The translation (german) works and I added some space between the filters via CSS.

    Not sure if its theme related but the toggle button to collapse the filters is not working:

    <button type="button" class="sidebar-toggle" data-toggle="collapse" data-target=".advance-search-collapse">Zusätzliche Suchfilter</button>

    It has no event. Any idea what's missing or broken? @donshakespeare

  • I presume the author forgot to tie in the bits that probably works on his side. Or maybe it is intentional! Designed for us to tie in the bits ourselves with some custom CSS and JS.

    I did the latter!

    Hide the all the fields with CSS, and then reveal with JS upon click of the button

  • Awesome! I’ll have to implement this once my schedule slows down a bit and I have a chance. Thanks for sharing this! I would not have though about handling it this way. 🙂


    On the forums I developed the plugin for we are using a Bootstap theme, which is why the syntax is that way. If you are not using a Bootstap theme, then you’ll probably need to use something like @donshakespeare suggests. Sorry about that. I will add a note about it on the plugin description.

Sign In or Register to comment.