Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search drop down unexpected behaviour

  • One the search page:

    The dropdownlist of forums does not remember the last ‘selected’ forum_id

    In the code ln943 of class.bb_query.php

    Code:
    $r .= “tt<div>” . bb_get_forum_dropdown(array(‘selected’ => $q_forum_id, ‘none’ => __(‘Any’), ‘id’ => ‘forum-id’)) . “</div>n”;

    the forum_dropdown function is called with (‘selected’ => $q_forum_id) as one of the args however $q_forum_id never seems to have a value at this point.

    Perhaps this is true for the first call to the search page (ie. when using the search box) but not on subsequent calls using the search form when the forum_id may have been selected.

    Is this a bug or is it deliberate?

    NB: by hard coding the (‘selected’ => 2) the page performs as expected – but obviously that is no better than the present state.

    So I deduce that $q_forum_id is not being set !

    NB: I have tried $q but that too has no value!

    Any help appreciated

Viewing 5 replies - 1 through 5 (of 5 total)
  • ! BUG ALERT !

    It was an error in the core code.

    The solution, found after experimenting is as follows:

    In line 943 of class.bb_query.php

    Replace the occurence of ‘forum-id’

    with ‘forum_id’

    It is also recommended that the missing line prior to this should read

    $q_forum_id = esc_attr($q_forum_id);

    in order to prevent attacks using the input value for ‘forum_id’

    The form now will function correctly along with any other call to this input field in any plugin.

    As always just a simple typo in coding rather than a serious error in code design.


    mr_pelle
    Participant

    @mr_pelle

    It’s a known bug, fixed in [2400] if I remember correctly.

    Quote:
    It’s a known bug, fixed in [2400] if I remember correctly.

    Not in the version I downloaded and installed only a couple of months ago.

    Anyway that fix is no good as it will still not work correctly. The id ‘forum_id’ needs to be passed for the dropdownlist to be correctly ‘selected’ and sent :(

    Is it not also wise to prevent nasty code being sent through the id or is this somehow cleaned elsewhere … in which case why the esc_attr() use on the other inputs above/below?


    mr_pelle
    Participant

    @mr_pelle

    Sorry, I did not specify I was referring to the trunk version of bbPress, which is not the one you find on the Download section.

    ‘trunk’ ?

    I’m still a newbie – I though the download was the latest release “approved”

    I didn’t even know of that bug list

    … so good is the documentation … and I’ll bet that most users don’t or can be bothered to dig around in the maze of code to figure out why it doesn’t perform how expected.

    This sort of bug fix is easy to apply – affecting only a couple of lines of code there ought to be a forum/list somewhere to enable these sort of changes to be publicised – perhaps there is but I just haven’t connected with it yet.

    Still at least I managed to fix this problem one on my own … I get the feeling watching others struggle that this is what comes with bbPress … being on your own

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar