Download & Extend

allow an empty default setting in Flag Filter

Project:Flag
Version:6.x-1.1
Component:Views integration
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

the flags filter allows "Optional," which is great, but doesn't allow an empty default setting.... requires either True or False. Wd be nice to allow empty there.

Comments

#1

I don't understand the request here. In flag's database tables something "not flagged" (False) is the same as being empty.

#2

Also, see the handbook page on Listing content that is not flagged, if that's what you're looking for.

#3

I'm talking about the default setting for the filter. It's easy enough to find unflagged and flagged, but the flag filter does not currently allow the <any> setting as a default, as alot of other filters do. In our situation, a default that finds all flagged and unflagged makes more sense.

#4

I think the difference is caused by Flag's data storage. Flag does not store "1" and "0" for the status of a flag. Instead it just stores a row if the item has been flagged by a user and deletes a row if the user unflags an item. So having "True", "False", and "Any" doesn't make sense because "Any" is the same as True (the row exists in the database table).

#5

I'm using this workaround:

change $operator = $this->value ? 'IS NOT' : 'IS' ;
to $operator = $this->value ? 'IS NOT' : 'IS NOT NULL OR flag_content_node.uid IS' ;

Note that all this does is makes the False option an Any option, so you can default to False and ge everything in the view.
I figure if it's a binary option, then this is the lesser of two evils - in my case I don't need the 'not flagged' view, just 'flagged' or 'all'.

However a permanent solution would be nice - it would be good to be able to default to 'Any' as with most other filters.

#6

I need to do the same. Where do you put this code?

#7

Status:active» fixed

This was fixed in #403602: Views Flagged Filter Option for Any.

#8

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here