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) »
  • Hooks not being called
Pages: [1]

Author Topic: Hooks not being called  (Read 1516 times)

David L

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 2
Hooks not being called
April 26, 2010, 02:37:37 pm
I've tried to set up some simple hooks as written out in the documentation, but no matter what I do there is no difference registered in CiviCRM. I have even tried copying some the sample hooks verbatim like -

Quote
<?php
function hook_civicrm_tabs( &$tabs, $contactID ) {
// unset the contribution tab, i.e. remove it from the page
unset( $tabs[1] );
// let's add a new "contribution" tab with a different name and put it last etc...
$url = CRM_Utils_System::url( 'civicrm/contact/view/contribution',
"reset=1&snippet=1&force=1&cid=$contactID" );
$tabs[] = array( 'id' => 'mySupercoolTab',
'url' => $url,
'title' => 'Contribution Tab Renamed',
'weight' => 300 );

but I get no response at all. The .module and .info files are both recognized by Drupal and enabled (in sites/all/modules/mycustomcivi). Any clues?




Also, in a separate issue, I need to make an exact copy of the Notes tab - our multiple notes on all contacts are split into two separate departments and we don't want all the notes jumbled on the same page. What files do I look for to copy/tweak?

Thanks!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Hooks not being called
April 26, 2010, 03:06:43 pm
is hook the name of your module -

ie function [modulename]_civicrm_tabs( &$tabs, $contactID ) {
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

David L

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 2
Re: Hooks not being called
April 26, 2010, 03:54:32 pm
Thanks Eileen, that was it - I should have noticed.

Anyone have any pointers for me on the notes thing?

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Hooks not being called
April 26, 2010, 05:49:15 pm
You could use a multiple field for the lot of notes ?

Could you update the documentation you used for the hook so that the next person won't make the same mistake?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Hooks not being called
April 27, 2010, 05:29:11 am
What Eileen means is that you can use Custom Data and create a new Tab by creating a new Group of custom fields. Then use a "multiple" text field in that group to allow multiple notes.
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.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Hooks not being called
April 27, 2010, 04:12:33 pm
 ;D
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

David L

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 2
Re: Hooks not being called
April 27, 2010, 05:21:05 pm
Eileen: I have updated the documentation as requested.

I know about the Custom Data Multiple Fields option, but the no-import is a deal breaker.


In a little more detail, this is our situation: I am setting up CiviCRM for the events division of a charity. They do nothing but make events all year round for the charity. The idea was to make a separate tab which would only list the events that each contact attended, with the date the event was and other event-specific info. This would give the team really strong search options for identifying attendees of specific events. However, because they do not use CiviEvent due to a still-binding contract they have with a ticketing company, they get all the event-attendee data in a csv file which is then imported to CiviCRM. If I cannot import data to the custom multiple fields tab when I import each event's csv file, then the custom multiple fields tab is of no use: The idea is that the only time data would ever be added to the multiple fields would only be during import!

Of course, I could use tags instead, making a new tag for each event, but in a few years they will have a couple hundreds tags, and it will be too messy. Anyone know if import to multiple fields is being worked on for the next release or if it is on the backburner for the foreseeable future?

-Dave

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: Hooks not being called
April 27, 2010, 05:59:57 pm
Quote from: ylesches on April 27, 2010, 05:21:05 pm
Of course, I could use tags instead, making a new tag for each event, but in a few years they will have a couple hundreds tags, and it will be too messy. Anyone know if import to multiple fields is being worked on for the next release or if it is on the backburner for the foreseeable future?

since multiple imports is important to you (since it is a deal breaker), please do consider contributing code to allow import of custom groups with multiple records

considering that we dont have an event import, contributing that with support for multiple record custom groups would be awesome and highly appreciated

lobo
« Last Edit: April 27, 2010, 06:05:47 pm by Donald 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

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Hooks not being called
April 27, 2010, 06:25:55 pm
Hi - try searching the forums for event import - I'm sure someone did some work on it & may have been able to share some beta code. I would go down the track of trying to get event imports working & tracking it using civiEvent in CiviCRM even though online registrations can't be done that way at this stage
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Hooks not being called

This forum was archived on 2017-11-26.