Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a flag set to unpublish user comments so that they can get removed from display for spam. I originally had a single action for this but then sought out to have two actions. Once I added the second action only the one added later gets executed. Am I doing something wrong? Both actions have the same condition to trigger off of the same flag. Note: one sets the comment to unpublished and the other runs php code.
Comments
Comment #1
joachim CreditAttribution: joachim commentedI never use Actions myself, so I can't be of much help. Have you tried debugging in the code that calls them, to see what's going wrong?
Comment #2
joachim CreditAttribution: joachim commentedBTW, using Flag like this to trigger something, where (I presume) the actual storage of the flagging is totally superfluous to your needs, really isn't very efficient. You're storing extra tables and using a fairly complex module just to trigger something on a click.
Comment #3
coolestdude1 CreditAttribution: coolestdude1 commentedjoachim, I was trying to solve #2307845 using flag_actions with two actions per flag. I initially had just the comment unpublish/publish on the spam flag. But the comment count numbers were wrong as mentioned in the other ticket. I then added the php action after the unpublish action in order to make sure that comment count was correct but then I notice that the unpublish was not even happening even though all I was doing was calling the statistics update and not even modifying the context or entity when running that code. So my situation consisted of adding the initial action of the flag in flag_actions and then adding the php and having only one work. Aka I added a debug in the php section and that surely came through but the comment was not unpublished even though the comment was flagged.
Comment #4
coolestdude1 CreditAttribution: coolestdude1 as a volunteer commentedAlthough I ended up solving my problem with flag hooks this continues to be a problem. Only a single action from flag_action triggers even if there are more than one.