How to run the Flags module after the Rules module? As a sequence on this question, I'd like to deduct 2 User Points when a user's first reaction on an Article is deleted (I mentioned my flag 'First reaction' there). I created a Rule 'Reaction removed' with the following settings:

EVENTS: After deleting a comment

CONDITIONS:


Comment is flagged Parameter: Flag: First reaction, comment: [comment], User on whose behalf to check: [comment:author]


ACTIONS:


Grant points to a user Parameter: User: [comment:author], Points: -2, Points category: Reaction, Operation: Delete, Moderate: Automatically approved
Unflag a Node: Parameter: Flag: Commented on a node, Node: [comment:node], User on whose behalf to flag: [comment:author], Skip permission check: false


I thought it looked all right, but it doesn't work, because apparently the comment is always handled as if it's unflagged, even when it's stored in the database as flagged with 'First comment'!

This is the Rules evalution log:

0 ms Reacting on event After deleting a comment.
11.674 ms Evaluating conditions of rule Reaction removed. [edit]
15.543 ms The condition user_has_role evaluated to FALSE [edit]
28.531 ms The condition flag_flagged_comment evaluated to FALSE [edit]  &lt;--- going wrong here
28.547 ms AND evaluated to FALSE.
28.575 ms Finished reacting on event After deleting a comment


What went wrong and how can I solve it?
The problem arises because the Flag module runs before Rules, so it has already removed the flag before Rules performs its test. One way to deal with this is to install Modules Weight which will allow you to adjust the relative priorities of modules so Flag runs after Rules.