Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 unexpected filter behaviour?
Patrick_ Offline
Junior Member
**
Posts: 27
Joined: Oct 2011
Post: #1
unexpected filter behaviour?
Right now if you filter the threadlist using &filtertf_field= without a value, it hides all threads where filterf_field is unset. Not specifying a value should imply that the filter is disabled.
This may seem like a minor issue, but it complicated things a lot when using a form to allow users to set the filters of optional fields.
12-11-2011 03:49 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: unexpected filter behaviour?
I have some optional filter fields too.
What I do is (as an alternative), make it a required field, and put a "global" value at the first line of the Value Lists.

For example:

Code:
Other
Games
Movie


12-13-2011 01:26 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: unexpected filter behaviour?
(12-11-2011 03:49 AM)Patrick_ Wrote:  Right now if you filter the threadlist using &filtertf_field= without a value, it hides all threads where filterf_field is unset. Not specifying a value should imply that the filter is disabled.
Actually, if it's blank, it'll show all threads where no value has been set for the thread field.
If you wish to ignore blank values, you need to make the thread field a required field.

My Blog
12-13-2011 11:01 AM
Find all posts by this user Quote this message in a reply
Patrick_ Offline
Junior Member
**
Posts: 27
Joined: Oct 2011
Post: #4
RE: unexpected filter behaviour?
You're.

I've created a plugin to solve this issue:

PHP Code:
1
2
3
4
5
6
7
8
$plugins->add_hook('forumdisplay_start', 'plugin_forumdisplay_start', 1);

function plugin_forumdisplay_start()
{
	global $mybb;
	if ($mybb->input['filtertf_field'] == '')
		unset($mybb->input['filtertf_field']);
}

(This post was last modified: 12-13-2011 08:05 PM by Patrick_.)
12-13-2011 07:37 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: