I have the following created in Rules. The objective is to limited user to flag up to 3 items only. But this didn't seem to work. When I tried it, I was able to add beyond 3 items. Before I lose all my hair, I hope I can get some help from the community here. Thanks in advance!

{ "rules_check_flag_limit" : {
    "LABEL" : "Check flag limit",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "compare" ],
    "REQUIRES" : [ "flag" ],
    "ON" : [ "flag_flagged_compare" ],
    "IF" : [
      { "flag_threshold_user" : {
          "flag" : [ "flag" ],
          "user" : [ "flagging-user" ],
          "number" : "3",
          "operator" : "\u003E"
        }
      }
    ],
    "DO" : [
      { "flag_trim" : {
          "flag" : "compare",
          "flagging_user" : [ "flagging_user" ],
          "cutoff_size" : "3"
        }
      }
    ]
  }
}

Comments

Scyther’s picture

Ok lets see here.

If I understand it right, you have used the Condition "User has flagging count" and that do not count how many flaggings a user has made with that type of flag. It checks how many flaggings a User, with the id (User) supplied under the condition, has.

I hope you get what that condition counts. It is a bit hard to explain.

There is not right know any Rules condition that counts how many flagging a user has made, but I think it could be done with Views and Rules Bonus pack, or maybe with VBO.