1

The desired outcome was to create a drupal user record if and only if an email exists on the contact - when a membership was created/updated.

To do this I wanted to add the condition "CiviCRM Contact has Email".

Testing this on multiple sites I've come to the conclusion that it doesn't appear to be working as advertised - it's not returning true when the associated contact has an email.

I've tested using these two stripped down rules - (It's not working on civicrm contact is updated either) - pasted below.

The only think I can think off that could be causing this is that the data selector is not correct? I tested this by outputting this using the debug action but perhaps it needs an ID not a "contact" or vice versa? I can't see any errors in the drupal log that would indicate this though. The rule is returning successfully - it's not generating any warnings.

Membership update

{ "rules_test_2" : {
    "LABEL" : "Test 2",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "civicrm", "rules", "devel" ],
    "ON" : { "civicrm_membership_edit" : [] },
    "IF" : [
      { "civicrm_entity_contact_hasemail" : {
          "contact" : [ "civicrm-membership:contact-id-contact" ],
          "location" : "0"
        }
      }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "Has email" } },
      { "devel_debug" : { "value" : [ "civicrm-membership:contact-id-contact" ] } }
    ]
  }
}

Contact update

{ "rules_test" : {
    "LABEL" : "Test",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "civicrm", "rules" ],
    "ON" : { "civicrm_contact_edit" : [] },
    "IF" : [
      { "civicrm_entity_contact_hasemail" : { "contact" : [ "civicrm-contact" ], "location" : "0" } }
    ],
    "DO" : [ { "drupal_message" : { "message" : "Has emali" } } ]
  }
}
2

https://github.com/eileenmcnaughton/civicrm_entity/blob/7.x-2.x/civicrm_entity.module#L3237

remove the ampersand from the $contact parameter

function civicrm_entity_contact_has_location_element_email($contact, $location_type_id) {

This is a bug, can you make an issue in the CiviCRM Entity project issue queue? I need to trace back how this code got that way, and see if there's any other reasons why it is as it is now before I put it into the release

But I can't think of any reason why it should

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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