Say I have two Flags attached to content; for example a "mark public" flag & "mark private" flag or a "like" flag & "dislike" flag, basically opposites. Is it possible to have the first flag automatically unflag itself conditionally whenever the second flag is flagged? This is basically like using Flags as radio buttons; only one can be selected at once and the other is automatically turned off. Otherwise when using Rules to determine if particular content was flagged "Public" or Private", is difficult since users can flag the same content both "Public" and Private" at the same time.

This could be easily achieved with only one Flag. But this doesn't translate well to a "like", "dislike" flag scenario, since users can only choose to like something but not specifically to dislike. A voting module would be a good alternative for this case however the only one currently available for D7 is the Rate Module which provides ratings for only nodes and comments, not as flexible as Flag module. I have tried implementing Rules to check for if one flag is flagged make the other unflagged, but it does not work.

Any suggestions as to how to tackle this?

1 Answer 1


to do this you could use the Rules module. I tried to do a similar thing before, it works but is a little awkward. You only need an event and action, a condition isn't really needed here:

Event: "Name of flag" has been flagged, Action: Unflag "Name of second flag"

For the second flag you would obviously do the opposite:

Event: "Name of second flag" has been flagged, Action: Unflag "Name of flag"

Now if someone flags a node with "Like" the "Dislike" flag is almost automatically unflagged, and vice versa (I think you get the concept here). "Almost" is because while flagging works dynamically the unflagging via rules only works after page reload, in my experience at least. So to a user it will look like you can both "Like" and "Dislike" things, but after reload only the last flag will stay.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.