Skip to end of metadata
Go to start of metadata


Documentation Search


CiviCRM 4.1 Documentation

Developer Resources


CiviCRM books!

Make sure to check out our Online User/Administrator and Developer Guides! You can also support this project by ordering a hard copy.

Or support us by buying an eBook or hard copy of Using CiviCRM from Packt Publishing.

When Does CiviCRM Create a Contact Record for a User? When is a User Linked to an Existing Contact?

Drupal behavior: 

Whenever a new user registers, CiviCRM checks for an existing contact with the same email address.

  • If a match is found, the new user is linked to the existing CiviCRM contact.
  • If no match is found, a new CiviCRM contact is created with the new user's primary email address.

Whenever an existing user logs in, CiviCRM checks for a linked contact record. If none exists, the same logic applies - either link the user to an existing contact or create a new contact. This case applies when CiviCRM is installed or enabled for an existing Drupal site. However, we recommend that you run the batch synchronization utility (next section) in this situation.

 Joomla behavior:

CiviCRM does not natively use the hooks and APIs of Joomla to facilitate hooking into the user registration and login pages.  As a result, in com_user neither a new user registration  nor an existing user login alone will trigger the above check for a corresponding CiviCRM contact.  Instead, this check is made whenever a logged in Joomla user engages in a transaction with the CiviCRM system, such as editing a CiviCRM Profile form, making a Contribution or registering a Membership. You can, however, replace the Joomla registration form with a form that using a CiviCRM profile that has registration enabled.

 
Thus, for example, if a contact has been entered in the CiviCRM database manually by an administrator, or as a result of a transaction as the anonymous Joomla user (eg in  a contribution or membership transaction, or a "quick registration"), then the user needs to do more than merely create a Joomla account with matching criteria (eg email) to get linked to their CiviCRM record. They need also to engage in a CiviCRM transaction while they are logged in.  Thus a process might look like:

  1. User makes a Contribution as the anonymous Joomla user i.e. no login required.  Their email address and any custom Profile fields from the Contribution form is recorded in a CiviCRM record.
  2. User subsequently returns to site and registers as a Joomla user using the same email address as in step 1.
  3. User logs in as the above Joomla user and is now presented with a menu item (visible to registered users only) to eg "Edit my details" which links to a CiviCRM Profile.
  4. Clicking on this menu link performs the match between the Joomla user and CiviCRM contact record, and the user is taken to their Profile edit page.  The Joomla user account and CiviCRM record are now linked.

However, you can create a user plugin that responds to one or more of the user events. In Joomla 1.5 those are:

*onBeforeStoreUser
*onAfterStoreUser
*onBeforeDeleteUser
*onAfterDeleteUse
*onLoginUser
*onLogouUser

In 1.6 those are

*onUserAfterDelete
*onUserAfterSave
*onUserBeforeDelete
*onUserBeforeSave
*onUserLogin
*onUserLogout

Labels
  • None