CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Event Registration with Email Change and hook_civicrm_postProcess
Pages: [1]

Author Topic: Event Registration with Email Change and hook_civicrm_postProcess  (Read 1399 times)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Event Registration with Email Change and hook_civicrm_postProcess
October 22, 2009, 07:38:12 am
I am using hook_civicrm_postProcess to execute code when a user registers for an event (Drupal 6 / CiviCRM 2.2.9)

To determine the contact id of the user I use the API to search on $form->_defaultValues['email-5'] which works well if the user is anonymous (seems that his contact record is made before the hook is executed) or if the user exists with that email. The problem seems to be if an existing contact changes his email on the registration page--then no results are found for his new email.

This is anyhow thus far my empirical observation. Creates a small problem because in such a case, I don't know who the contact is. Perhaps I could just presume that if the user is logged in then his contact is that which is linked to his Drupal record, but anyhow this seems to be a bit of a glitch.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Event Registration with Email Change and hook_civicrm_postProcess
October 22, 2009, 08:45:12 am

can u check if this works:

Code: [Select]
$contactId = $form->get( 'primaryContactId' );

that should give you the primary contact id involved with the registration and avoid doign a search

lobo
 
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Event Registration with Email Change and hook_civicrm_postProcess
October 25, 2009, 05:21:29 am
Perfect. Works great. Thank you!
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Event Registration with Email Change and hook_civicrm_postProcess

This forum was archived on 2017-11-26.