Skip to main content

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.

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
2 answers

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) { $...
jboeke's user avatar
  • 191
3 votes
0 answers

Building the equivalent of a webhook for certain CiviCRM events

I posted this in the Mattermost Town Square, but was encouraged to post the question here also: Good afternoon. I'm wondering if CiviCRM can produce a "changes stream" or fire off a webhook ...
phillipadsmith's user avatar
3 votes
1 answer

What is deleting my Tag?

I've run into this twice this month and scratching my head. Read this image upside down: We hit post create Address hook -> my regex extension creates a Tag - all good; happy dance; then something in ...
KarinG - Semper IT's user avatar
3 votes
1 answer

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 ...
FCRCadmin's user avatar
2 votes
0 answers

How to use a GROUP_BY / HAVING in extended Advanced Contact Search query?

Based on this solution, I'm trying to add a custom pan in advanced search in order to filter by Line Item Total Sum. The context I successfully manage to filter by Line Item Total with these fields: ...
Bastien Ho's user avatar
2 votes
0 answers

Errors not showing against custom fields using hook validateForm()

Using this code if ($fields["custom_111_79"] == 0) $errors["custom_111_79"] = "Please enter number of physio sessions"; The evaluation is done correctly, but the error message does not appear ...
Simon Walden's user avatar
2 votes
0 answers

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 ...
Sleewok's user avatar
  • 1,146
2 votes
0 answers

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 ...
Matt's user avatar
  • 121
2 votes
0 answers

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 ...
Logan Bear's user avatar
2 votes
0 answers

Adding a credit card surcharge to event registrations

I'm using a number of hooks to set a credit card surcharge to an event registration. I have it mostly working, however there are some cosmetic issues remaining. Using hook_civicrm_preProcess, I have ...
user avatar
1 vote
1 answer

How to get $activity_id or $case_id variables in HOOKs when cron job execute in Joomla?

How to get $activity_id or $case_id variables in HOOKs when cron job execute in Joomla? I have 2 functions in HOOK for CiviCase function joomla_civicrm_tokens(&$tokens) function ...
Vadim Kozhevnikov's user avatar
1 vote
0 answers

'view' op in pre and post hooks: actually used anywhere?

Working on a PR to add pre and post hooks for the UFGroup entity, I looked for existing examples of entities that invoke these hooks with the 'view' $op (documented in the 'parameters' section for ...
TwoMice's user avatar
  • 1,824
1 vote
0 answers

Stripe Webhooks on a multisite?

I've just updated a multi-site with the latest Stripe extension and I get the message to update the webhooks. Did this on another site earlier I was able to just follow the links and it updated as it ...
Rose Lanigan's user avatar
  • 1,050
1 vote
0 answers

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" ...
yurg's user avatar
  • 2,053
1 vote
0 answers

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 ...
Pascal Wiesmann's user avatar
1 vote
1 answer

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 need ...
michaelmcandrew's user avatar
1 vote
0 answers

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 ...
Nina Gonzalez's user avatar
1 vote
0 answers

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 ...
Tenz's user avatar
  • 127
1 vote
0 answers

Event Listing - Number of Participants

Is there a way to add a column to the front end Event Listing that shows the total number of participants registered for that row's event? This is the com_civcrm >> Event Listing menu item. The ...
S Christopher's user avatar
0 votes
1 answer

Change the contribution value programatically

I'm trying to use the hook civicrm_buildForm to modify the contribution value based on specific logic. I know I can use setDefaults() but I don't know how to get the field ID. For this contribution ...
marcelo2605's user avatar
0 votes
1 answer

How can I utilize Drupal hooks for altering and validating forms in place of CiviCRM hooks?

My website is built on Drupal, and I prefer using Drupal hooks over CiviCRM hooks for modifying and validating forms, as I find Drupal modules easier to create and their hooks more user-friendly. ...
nonono1234's user avatar
0 votes
0 answers

unable to get hook_civicrm_post and _custom to work

I'm using CiviCRM 5.57.3 to implement some voucher management functionality See this question. I'm now trying to get a hook working, to set my voucher ID in the custom field. I've create a file ...
Flavio C's user avatar
0 votes
0 answers

Creating membership with civicrm_api3, inherited membership

I'm trying to create inherited memberships in the civicrm_post hook. I feel like there is something wrong with the api itself. The API doesn't even recognize my only membership id in the database. ...
Kurt Leadley's user avatar
0 votes
0 answers

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 ...
harshal's user avatar
  • 841