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.

2
votes
0answers
9 views

Implementing tokens and tokenValues hooks for Event custom field

I'm trying to implement a hook for inserting Event custom fields into Scheduled reminders; however, I'm not a developer so I'm really not sure what the code needs to look like. The custom field is ...
1
vote
1answer
9 views

Hook pre/post in pledge changed status

On 5.6.0 After create a pledge. If is created a new contribution that change the status of the pledge from "Pending" to "Completed" is not incoming in any hook_civicrm_post or hook_civicrm_pre with ...
0
votes
1answer
19 views

I am trying to insert custom tab into Activity tab but it is not working

I am creating new extension. I am adding a new custom field into Activity tab but it's not working //Creating a custom group for survey function custom_group_create_survey(){ $survey_custom_group = ...
1
vote
2answers
19 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?
-1
votes
1answer
40 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
41 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
19 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
39 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 ...
1
vote
2answers
77 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
42 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
17 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
18 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
36 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
29 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. ...
3
votes
1answer
44 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
49 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
27 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
3answers
114 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
45 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
73 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
74 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
69 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
95 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
83 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
48 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
28 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
42 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
71 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
27 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
256 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
40 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
92 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
238 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
4answers
54 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
73 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
69 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
114 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
57 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
49 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 ...