Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
0answers
13 views

Hook to change names of reccuring events

I am going to shut my other question and try and rewrite more clearly here. I have recurring events. I want to change the name of these recurring events to add the date to them, so each one is easily ...
0
votes
1answer
21 views

How to set a permission using drupal ACL?

I am developing an extension. I want to provide permissions using drupal. I am using following hook for creating a permission hook_civicrm_permission(&$permissions); But, how to do that (means ...
1
vote
1answer
33 views

Validation radio custom fields on civicrm_validateForm hook does not work

I have a custom field on contact in radio type format, not required field. I'd like to set up custom error on this field by using hook_civicrm_validateForm when the field is null. // hook in ...
0
votes
0answers
23 views

How to alter a query in hook_civicrm_pageRun based on a custom filter provided?

I want to alter the query run in the hook_pageRun(&$page) under Manage Events Page to alter the (event list) results shown here. I can alter the rows from hook_civicrm_pageRun , but I want to ...
3
votes
1answer
27 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
13 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
26 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
22 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
75 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
24 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
51 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
22 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
22 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
44 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 ...
4
votes
3answers
98 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
56 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
18 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
1answer
42 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
33 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
22 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
46 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
74 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
30 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
137 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
47 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.
2
votes
1answer
54 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
98 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
92 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
78 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
38 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
30 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
148 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
92 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
52 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
29 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
43 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) { ...
2
votes
1answer
80 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
29 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?
2
votes
3answers
321 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 ...
3
votes
1answer
36 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 ...
4
votes
2answers
49 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
111 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 ...
2
votes
3answers
278 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
28 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
58 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
77 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
70 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
127 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
26 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 ...