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) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • modify user registration values on Drupal register form
Pages: [1]

Author Topic: modify user registration values on Drupal register form  (Read 812 times)

Barnacle

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
    • White Fuse Media
  • CiviCRM version: 4.4
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.3
modify user registration values on Drupal register form
July 23, 2012, 09:35:08 am
Hi,

I am trying to modify a field which appears on the Drupal user registration form. In Drupal you can do this with hook_form_validate and form_set_value, setting the variable in the $form array.

But the array doesn't have the CiviCRM profile values in it. Instead, it just has a big piece of markup which makes the form values appear on the registration page.

Is there any way to get at the CiviCRM profile values in the Drupal register form? This was an unexpected setback for me, as I thought these values would be treated like any other Drupal profile fields. How are they processed and stored, and is there a hook to interrupt that process?
--
http://whitefusemedia.com/

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: modify user registration values on Drupal register form
July 23, 2012, 09:50:40 am

Might want to check:

http://wiki.civicrm.org/confluence/display/CRMDOC41/CiviCRM+hook+specification

CiviCRM being cross-CMS does not use drupal hooks / api / framework to do things

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

Barnacle

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
    • White Fuse Media
  • CiviCRM version: 4.4
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.3
Re: modify user registration values on Drupal register form
July 23, 2012, 10:04:19 am
Thanks Lobo, but are you sure the Drupal registration form triggers a CiviCRM hook? If so, what's the name of the CiviCRM form to hook it by? It's on a Drupal page, not a CiviCRM page.
--
http://whitefusemedia.com/

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: modify user registration values on Drupal register form
July 23, 2012, 10:28:21 am

yes the civi hooks are also called. For rending a form, the buildForm and validate hooks should be called and when submitted the postProcess hook should be called

after the form is rendered, civi just returns a chunk of html to drupal, since that seemed to be the easiest interface to get civi form elements on the drupal page

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

Barnacle

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
    • White Fuse Media
  • CiviCRM version: 4.4
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.3
Re: modify user registration values on Drupal register form
July 24, 2012, 01:55:25 am
Yep - I've got this working now. I was a little puzzled because 'print' in the hook didn't output anything (some kind of page refresh), but now I can see it's being called.

Thanks!
--
http://whitefusemedia.com/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • modify user registration values on Drupal register form

This forum was archived on 2017-11-26.