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 (Moderator: Donald Lobo) »
  • CiviCRM Profile hooks
Pages: [1]

Author Topic: CiviCRM Profile hooks  (Read 1421 times)

lchanggt

  • Guest
CiviCRM Profile hooks
June 25, 2008, 08:13:51 am
Hi,

I've looked at the hook documentation but to understand it better and what hooks are available require more experimentation with the code on my part and hopefully someone has already done this and can provide some guidance as I'm just starting to learn Drupal/CiviCRM. 

I'm trying to change the Profile such that instead of having just Save and Cancel functionality, I need a Finish and Save functionality.  Our profile is being used as an application and takes some time to fill out so I want to provide the users an ability to come back to the Profile.  The Finish button would check that certain fields are required and if everything is filled out properly, send an email to us to go on and review the application. 

My basic questions are:
1. What file do I need to edit/create to put in the hook_civicrm_post() function to have it process the form from the profile?
2. I've setup the Profile to not have any required fields and will instead be checking required fields manually in the post hook.  If I return a false to hook_civicrm_post can I alert the user with the proper error messages on the Profile form?

Any help is greatly appreciated.

Thanks,
--Leo

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: CiviCRM Profile hooks
June 25, 2008, 02:43:57 pm

1. you should check the drupal documentation to get a better idea and understanding of how to use hooks. CiviCRM hooks are modelled on Drupal hooks

2. for form validation in CiviCRM, u should use the validate hook. The form will redisplay with the error messages returned (if any)

3. Adding a new button is beyond the scope of hooks in 2.0. However we have added a few new hooks in 2.1 to allow this to happen. For 2.0 and prior, you will need to hack the code CRM/Profile/Form*

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviCRM Profile hooks

This forum was archived on 2017-11-26.