1

I want to create a non-global flag which each user can use to 'flag' one (and only one) instance of a specific content type.

I have a view which displays a list of content with fields, including a flag link. I would like to set up my flag (or a rule with a flag) so that if a user clicks on a flag link, all other flags that that user has set (for that specific flag type) are reset.

This will be used for a 'favorite' type of flag, which can only be set on one instance of a specific content type.

2
  • Do you mean user can flag only one node of a content type.. When he flags other node of same content type previous flag will be reset so that at any point of time user can mark only one node of particular content type ? Have you tried rules module ?
    – Anil Sagar
    May 10, 2014 at 5:42
  • Yes, that's exactly what I want to do. I am using rules, but I am not sure how to write a rule that does this.
    – Hoytman
    May 12, 2014 at 12:33

1 Answer 1

0

Here is how I eventually solved this

Create a rule that does the following actions.

  1. Loop through a list of all content that the flagging user has flagged (with the specified flag.)
  2. Unflag ALL of the nodes in this list
  3. Re-flag the node that triggered the event (F\flagged-node)

Your Answer

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

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