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) »
  • Using a Drupal API in the civicrm_searchTasks hook
Pages: [1]

Author Topic: Using a Drupal API in the civicrm_searchTasks hook  (Read 590 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Using a Drupal API in the civicrm_searchTasks hook
August 09, 2014, 03:26:35 am
I am experimenting with a custom hook that implements the hook "civicrm_searchTasks".  Inside my hook implementation, I am calling the Drupal API for creating/updating a Drupal user

Code: [Select]
user_save( )
when the end-user executes my search action, they first see my page telling them how many contacts will be impacted (along with some explanation of what the consequences are.) After they click the "submit" button which calls my "postProcess" function, they end up on the Drupal home page.  If they click the link for "CiviCRM", then they are shown the status message from postProcess.   If I remove the Drupal API call, then the user stays on the appropriate CiviCRM screen as expected. ( ie they see the search results that they started on, along with the status message from postProcess. )

Any ideas on why the user ends up on the website homepage?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Using a Drupal API in the civicrm_searchTasks hook
August 11, 2014, 11:38:05 am
Are you testing a clean/simple configuration or a customer's configuration? Perhaps there's another module or trigger that hooks into the user-signup or user-admin process?

(Aside: Reading https://api.drupal.org/api/drupal/modules!user!user.module/function/user_save/7 , there seem to be some situations where it destroys the session. That could definitely interfere with Civi's pageflow, but you'd expect to lose all the status messages -- and in this the status messages are retained for later.)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using a Drupal API in the civicrm_searchTasks hook
August 13, 2014, 06:02:52 pm
I am testing my code in my personal development environment. There are some extra Drupal modules ( like Views, CCK, etc) but its pretty vanilla.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Using a Drupal API in the civicrm_searchTasks hook

This forum was archived on 2017-11-26.