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.

Filter by
Sorted by
Tagged with
8
votes
5answers
381 views

How to change mailing form and set the default value for url_tracking to false?

Is it possible to alter the mailing form? I want to set the default value for url_tracking to false. Usually I would write a hook_civicrm_buildForm and set a custom default value but this hook is not ...
3
votes
2answers
818 views

Refresh page after closing modal opened by .crm-popup outside of CiviCRM

We've a page (in Drupal) outside of CiviCRM for "editors" (mean, users with restricted permissions) to perform some civicrm tasks. From this page civicrm forms is being opened in modal frame via ....
3
votes
1answer
240 views

Can tokenValue hooks be used in scheduled reminder emails?

I have the same problem as at http://forum.civicrm.org/index.php/topic,32608 I have created a tokenValues hook to fetch the value of a field from a multi-record custom field set. I have the token ...
3
votes
1answer
112 views

How do I modify a core CiviCRM file (to change a search order)?

Looks like one of core CiviCRM files (namely part of mySQL query at CRM/Contact/BAO/Query.php) has to be changed in order to achieve "Search results sort by Last Name". What would be the best (I mean, ...
3
votes
1answer
168 views

Can I update/requery a custom field that got changed via another field on the same page?

I created some database triggers that update a read only custom field that is displayed on the main contacts page. You change the value in another field and the db triggers update the custom field. ...
8
votes
5answers
352 views

How to display a Drupal view in a CiviCRM tab

I'm trying to display a drupal view in a CiviCRM contact tab. I've tested out my tab function with the code snippet on hook_civicrm_tabs and it will show the contribution tab correctly, and I've ...
5
votes
1answer
142 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 ...
3
votes
1answer
104 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 ...
9
votes
1answer
84 views

How do I modify the new 4.6 CiviMail form?

I am the author of a CiviCRM extension that needs to disable, depending on configuration, the URL tracking and open tracking checkboxes of the mailing form. In version 4.4 this was accomplished using ...
0
votes
0answers
35 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 ...
5
votes
2answers
201 views

How can I assign tag when certain profiles are submitted

Anyone who signs up online for a membership on our site must create a Drupal user account at the same time (advanced setting on profile used for membership sign up). This gives them access to member-...
4
votes
3answers
543 views

How to set a default value for a custom field

EDIT: this is NOT working, at least in CiviCRM 5.24.2 EDIT: this is done automatically by CiviCRM from 5.18+ I have a custom fieldset on Contributions that uses an option list. The option list has a ...
3
votes
1answer
135 views

Where to put api wrapper class in an extension

I just wrote an extension with short-name "genderselfidentify" (it's cool, you should check it out), which implements hook_civicrm_apiWrappers. This hook requires you to declare a class for your api ...
3
votes
2answers
72 views

Trying to write a hook to add contribution page name to Main.tpl I'm super close

So I've almost got a hook working to add the name of the contribution page to the main.tpl part of a PCP. This is what I have so far: function wordpress_civicrm_buildForm($formName, &$form) { ...
2
votes
1answer
50 views

Should civicrm_post hook receive populated Relationship object following relationship enable/disable in UI?

I'm porting some code using Civi hooks from Civi 4.4 to 4.6 . The code needs to know when a relationship becomes active or inactive, regardless of how that happens, including via the enable/disable ...
1
vote
1answer
71 views

Invoking hook_custom_tokens and hook_custom_tokenValues in Joomla

I have tried, in vain, to invoke hook_civicrm_tokens and hook_civicrm_tokenValues in a Joomla instance in order to add custom tokens (to be specific: relationship information). I created a Joomla ...
1
vote
1answer
175 views

Update custom field from other custom data

I'm trying to use a php hook to automatically create a relationship between two contacts. Let me set the stage for you. Meeting Extender: a custom data set that extends the meeting activity(activity ...
1
vote
1answer
52 views

Can hook_civicrm_links create links beside rows of a contact's Events tab?

I've looked at CRM/Event/Selector/Search.php to see it creating the View/Edit/Delete links, but am just unsure how to make this work. Can someone advise what the appropriate $objectName and $op should ...
0
votes
1answer
41 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) { ...