Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hooks]

Hooks are a powerful way to extend CiviCRM's functionality, incorporate additional business logic, and even integrate CiviCRM with external systems. The way they work is, that at key points in processing CiviCRM checks if custom code is "hooked in", and runs any valid code it finds.

1
vote
2answers
18 views

Is there any information that tells the last action of membership record (edit or renewal)?

I'm going to write a hook to distinguish a saved membership record, how do I know the last action of saved membership record is edit or renewal?
0
votes
1answer
32 views

Adding a column to search results

i try to add a custom column to the search results of "find contact". I use the hook "searchColumns", i can easily add a column with: $headers['summary'] = array('name' => 'Summary'); , but when ...
0
votes
1answer
20 views

How to fetch Profile gid from hook_civicrm_post included in a Contribution Page?

I am using profile object inside function hook_civicrm_post($op, $objectName, $objectId, &$objectRef){ } How can I fetch the Profile gid from the above variables? or is there any way to ...
1
vote
1answer
39 views

Add new smarty template to an existing page

I want to add a new template part to the activity edit & view page, I have been trying number of hooks to do it but could not figure out which one best to use. I am trying to do something similar ...
2
votes
1answer
20 views

Which table is used for hook_civicrm_triggerInfo?

I have a rebuild trigger action that is failing. It is trying to create a trigger on civicrm_contributiion_recur. Clearly it has 2 i's and shouldn't. There is or was a trigger on the table without ...
1
vote
2answers
17 views

How to automatically remove a contact from specific group, if end date is added to specific relationship

If end date is added to relationship,the contact should be automatically removed from the specific group. How this can be accomplished?Any suggestions?
1
vote
2answers
37 views

Contact Summary Hook Implementation

I am trying to add contact created date in contact summary. I am sure that https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_summary/ helps the requirement. But I'm not getting how to ...
0
votes
2answers
53 views

How to create a hook in an extension?

I want to give others the chance to do something when certain events happen in my extension. So to be clear: I'm not wanting to use existing hooks in my extension, I'm wanting to create a new hook ...
1
vote
2answers
41 views

How are CiviCRM form names defined (civicrm_validateForm)?

I am attempting to perform form validation on various CiviCRM forms (profile forms and forms within contribution pages) by hooking into hook_civicrm_validateForm. In my php code, I would like to ...
0
votes
1answer
15 views

Hook to stop a contact's email from being deleted

We have a new requirement to stop an admin from deleting a contact's email if that email is found in one of our other systems. I am trying to do this through a validateForm hook. I can figure out ...
0
votes
0answers
17 views

my module.file for hook_civicrm_post doesn't work

I'm new on Drupal.I use hook_civicrm_post to add in a table membership period terms each time a new membership is registered or renewed.But It doesn't copy to the table despite many tests, it takes a ...
0
votes
1answer
35 views

How do you set the displayed text of a custom field (“view-only”)?

I am using Drupal and I have an extensions that I am running this code on. I've seen several threads attempting to help with this. I haven't found any that really make it clear. From what I ...
0
votes
1answer
28 views

Wordpress hooks – some don't work

I noticed that some hooks are not firing… I have the following three hooks <?php add_filter('civicrm_permission', 'civicrm_permission', 10, 1); function civicrm_permission(&$permissions) { ...
0
votes
1answer
20 views

Customise Contacts Relationships Tab

I want to customise the contacts relationships tab screen to show if the listed contacts (Individuals) belong to a specific group or not. I'm not sure where to start and would appreciate any pointers. ...
0
votes
0answers
18 views

civicrm_tokenValues module_invoke

Can anyone point me in the right direction to debug this? Call to module_invoke('views', 'block_view', '[myblockname]') fails when called from hook_civicrm_tokenValues. When I preview in civimail ...
3
votes
1answer
42 views

Is there a hook for on user sign in?

Is there a good hook for on CiviCRM sign in? [This is to display a message upon login in a cms-independent extension.] Thanks,
1
vote
0answers
42 views

Which civicrm hook for Event Registration form field content change in Drupal module?

Preamble: Event Registration Settings form ( civicrm/event/manage/settings?reset=1&action=update&id=EVENT-ID ) has separated text areas for Event Summary/Description ( "Info and Settings" ...
2
votes
0answers
26 views

Change displayed value for customfield

I have a custom field of an individual that stores the ID of a group (as int). I would like to change the display of the field to show the actual name of the group instead of the ID (same as contact ...
1
vote
2answers
99 views

post hook edit entity

We have a post hook that sends some data to an external api when a participant is created or edited. function kavo_civicrm_post($op, $objectName, $objectId, &$objectRef) { if (($op == 'create' |...
0
votes
1answer
43 views

How to echo “Hello World” in civicrm?

I need to echo "hello world" in civicrm how to do this in any page in civicrm? i'm trying to do this using hooks_civicrm_post but there is no result.
1
vote
1answer
42 views

Extending CiviCRM Advanced search (queryObjects hook)

I am adding a Soundex featured to the advanced search. I am using the queryObjects hook to add this into the query. The documentation on this is spotty, only referencing CiviHR. I have downloaded that ...
1
vote
0answers
63 views

Setting Default Value BuildForm Hook does not work

I tried to implement the following hook (in my extension "cividoncamillo"), to set a default Contribution Type, but it does not work... Any Ideas why not? //does not work function ...
2
votes
2answers
68 views

How to customise the activities tab listing

I used to hack the Activities BAO to change the search results to make the subject line something more useful; i.e. extract other data from particular activity types and auto-create a summary in place ...
1
vote
2answers
59 views

How to clear hook cache

When I am changing a query or logic in my hook, I have to reinstall the entire module so then only the updated logic / code works in civicrm. Is there a settings to clear the cache or something I ...
0
votes
1answer
36 views

get source table values in civicrm_triggerInfo

I have created below hook for trigger some values in my table. Here how to get source table values that are being updated or inserted function history_civicrm_triggerInfo(&$info, $tableName) { ...
0
votes
1answer
26 views

Where I have to write my hook

I am new to civicrm. I have created a module; say com.ex.myextention. and created a page its working fine. But in my module where I have to write a hook and how to ensure the defined hook is ...
0
votes
1answer
82 views

Problem with setting the default for a custom value in the buildForm hook

What is the correct way to set a default value on rendering a form for custom values. The code below works for native fields, but not for custom fields (presumably because they are looked up through ...
0
votes
2answers
79 views

How to target a specific event registration form in an extension

I'm trying to use a custom extension rather than using a template override (template_name.extra.tpl) to implement some jQuery on an event registration form (essentially to hide some form fields unless ...
0
votes
1answer
46 views

hook civicrm_post not triggering as expected (Joomla)

I have set up a hook to assign a group to new contacts when they are created. I have set it up the old-fashioned way, ie with a function called joomla_civicrm_post in a file called civicrmHooks.php in ...
1
vote
1answer
27 views

hook_civicrm_postSave_table_name not called on table update

In Drupal, I'm using hook_civicrm_postSave_table_name to listen for CiviEvent registrations. I've implemented hook_civicrm_postSave_civicrm_participant($dao) where I test for certain status_id values ...
0
votes
1answer
41 views

civicrm_processProfile hook ignored

After submitting the profile with success from the front-end of the site, a civicrm contact is created but the following hook is not working.. function wordpress_civicrm_processProfile($name) { ...
1
vote
1answer
67 views

How do I write unit tests that verify a hook is being fired?

I found this example but it doesn't look like it would generalise to all hooks. The use case is for API4 - basically whenever any action is called I think we should be able to verify that particular ...
1
vote
0answers
26 views

How am I meant to use $mask in hook_civicrm_links?

I don't really understand what the point of the $mask variable that is passed to hook_civicrm_links is. Can anyone explain it to me? PS I understand how to use the other variables and I might not ...
1
vote
1answer
16 views

Hook permissions `type`

Looking at hook_civicrm_aclWhereClause I see there is a $type parameter but there is currently no documentation for this type. What are the allowed values?
1
vote
2answers
231 views

How to set a default value for a custom field

I have a custom fieldset on Contributions that uses an option list. The option list has a default value set, but when contributions are created by non-UI processes (e.g. API) they do not have this ...
4
votes
1answer
35 views

Documentation on the _civicrm_api3_* _spec functions

I have a working extension with a working API hook civicrm_api3_contact_getclif($params), but I can't find the documentation for the _spec function beyond the suggestion to have one I wrote this ...
5
votes
1answer
39 views

Can't change help_post text in Price Set using the civicrm_buildAmount hook

There are several fields I expect to be able to change in the buildAmount hook that just won't change for me. One example: function myext_civicrm_buildAmount($pageType, &$form, &$amount) { $...
3
votes
1answer
85 views

How to prepopulate custom fields

I would like to prepopulate a set of custom fields (on an activity) with data about the contact it pertains to. (The data I want to pull in is in a set of custom fields on the contact). My idea was ...
3
votes
3answers
217 views

Setting default date value via civicrm_buildForm hook no longer displays date

I have a custom module that invokes the civicrm_buildForm hook to set the default date for a given field to today's date. It is working - in part. When I examine the code I see that the default value ...
1
vote
2answers
24 views

Hacked getContactRelationshipSelector in core, how do I implement as an extension?

I'm looking to show additional fields in the relationship tab for contacts (e.g. Job Title) - the fields are part of the relationship object, but aren't defined in getContactRelationshipSelector (CRM\...
1
vote
3answers
45 views

How do I control the order in which hooks fire?

If I have two extensions that both use, say, hook_civicrm_post, how can I control the order in which the two extensions fire?
2
votes
4answers
70 views

Can I disable Notify Activity Assignees for some Activities and/or user levels and leave it on for other Activities/user levels?

We're on Civi 4.6.21 and Drupal 7. Under Administer -> Customize Data and Screens -> Display Settings there is a setting - "Notify Activity Assignees - When enabled, contacts who are assigned ...
2
votes
0answers
67 views

creating case types with different component than CiviCase for attached activity types

We created an extension for tasks management which define a new civicrm component called CiviTask .. I want to create 4 case types (with attached activity Types set and a standard timeline ) when ...
1
vote
0answers
112 views

How to connect with state and country table

We are using CiviCRM (4.7.9) with WordPress (4.5.3). We are pulling the data from the CiviCRM state and country tables into Gravity Forms using code in our function.php. But we are running into ...
2
votes
1answer
25 views

How to position a custom top level menu before/after some menu?

While this documentation tells how to add a custom top level menu, it adds to the last. Say, I want to add a new custom menu "My Menu" and position it right before "Administer" menu. How would I do ...
1
vote
2answers
51 views

Show validation errors on custom elements added using hooks

I added a text element to a New Event page using buildForm hook. function mymodule_civicrm_buildForm($formName, &$form) { if ('CRM_Event_Form_ManageEvent_EventInfo' == $formName) { $form->...
0
votes
1answer
48 views

Multiple Entry Custom Values : Find modified ID?

Whenever custom data is written to the database you can use the module_custom() hook to determine what most of the parameters written were. However, I've been unable to find the 'id' of the write. ...
2
votes
0answers
15 views

Trying to understand CiviAccounts workflow

I've read the CiviAccounts Data Flow document and I'm trying to figure out the order things get done. Here's my situation: My organization collects membership dues at a national level. But part of ...
5
votes
1answer
125 views

What is the mechanism for tailoring an Angular form?

I want to modify the behaviour of an Angular form. The answer to question 4700 tells me 'how' to do it (add some JavaScript), but I'm interested in 'where' to do it. If it was a PHP form I could use ...
1
vote
0answers
60 views

Overriding civicrm_webform's postprocessing of contributions

I'm using hook_form_alter() to perform calculations on various contributions on a civicrm_webform. I'd like to use the totals of these calculations to update the contribution amount and event amounts ...