Following the advice I received in Allow only existing CiviCRM contacts to create own Drupal account, I'm trying to implement Drupal Rules to create an associated Drupal user whenever a CiviCRM contact is added to the 'Web Site Users' group.

I'm running Drupal Core 7.66 and CiviCRM 5.12.3. Trying to get this working I've installed Entity API 1.9, Rules 2.12, and CiviCRM Entity 2.2.

This is the rule I'm using:

Screenshot of Drupal Rules showing Events: CiviCRM Contact has been updated, CiviCRM Contact has been created; Conditions: CiviCRM Contact is in Group Web Site Users, Not Drupal User Account exists for Contact; Actions: Create Linked Drupal Account

Creating a new contact in CiviCRM is correctly creating a new Drupal user, but I'm also getting this error, with no other visible consequences:

Notice: Undefined property: CRM_Contact_DAO_Contact::$contact_id in civicrm_entity_contact_user_get() (line 3671 of /var/sites/c/civicrm.jesusshapedpeople.net/public_html/sites/all/modules/civicrm_entity/civicrm_entity.module).

Should I be concerned? Am I doing something wrong? Is there a fix?

2 Answers 2


The message is a 'Notice' which can sometimes be ignored. However, looking at the code causing the message the purpose of the function is to load a user entity based on the contact id but the contact id is not set which is fundamental to the purpose of that function.

It would take a bit of debugging to track down where and why that is being called from your rule in a way that causes the contact_id not to be set - and ideally you would do that. Alternatively providing it is does what you need in creating the Drupal user correctly you could choose to ignore it.

  • I've removed the condition for no existing account, and the error has disappeared. I'm now concerned that the rule will attempt to create accounts when one already exists though. What's the correct way to safeguard against that? Or can I trust Rules/Drupal to do it automatically? Apr 26, 2019 at 13:49

With further testing I have established that was caused by a clash with another rule with the same event and weight. Changing the weight on the other rule has removed the error notice.

The other rule (checking for an existing account for the user, and unblocking that rather than creating a new one) still isn't working, but that's another question!

I'm not really clear why the order the rules run in should have made much difference or triggered this error, but happy to have it cleared up for now!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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