I am not sure if this belongs here or in the Rules or Entityform queue. If it is better suited there, I can move it.

I built a block/unblock user flag and I am trying to use rules to stop entityform submissions from being created (and emailed via rules once created)

So if a user blocks a user, they can not submit an entityform submission, thus the referenced user on the entityform will not get an email.

My exported rule looks like:

{ "rules_block_user_from_sending_message_if_user_blocked_them" : {
    "LABEL" : "Block user from sending message if user blocked them",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "entityform", "flag" ],
    "REQUIRES" : [ "rules", "flag", "entityform" ],
    "ON" : { "entityform_presave" : [] },
    "IF" : [
      { "entity_is_of_bundle" : {
          "entity" : [ "entityform-unchanged" ],
          "type" : "entityform",
          "bundle" : { "value" : {
              "contact_seller" : "contact_seller",
            }
          }
        }
      },
      { "entity_has_field" : { "entity" : [ "entityform-unchanged" ], "field" : "field_listing" } },
      { "flag_flagged_user" : {
          "flag" : "block_unblock_user",
          "user" : [ "entityform-unchanged:user" ],
          "flagging_user" : [ "entityform-unchanged:field-listing:author" ]
        }
      }
    ],
    "DO" : [
      { "redirect" : { "url" : [ "site:url" ] } },
      { "drupal_message" : { "message" : "Was unable to send message. This user blocked you from contacting them ", "type" : "warning" } }
    ]
  }
}

Am I missing something? A condition? Am I using the correct event? Everything looks correct but the rule is ignored and I still get an entityform submission as well as the generated email that gets sent on my "after saving an entityfrom submission" event.

Any help on getting this working would be great. Thank you.

Comments

bsherwood created an issue.

joachim’s picture

This is one of the reasons I don't like using Rules. If I were you, I'd find a hook in entityform module that lets me accomplish the same thing in code.

Have you turned on Rules debugging?