Blog Archives

How to make a field required in CiviCRM

$form->addRule(); Here’s an example from the hook_civicrm_buildForm() function in a custom module we’ve been working on. if ($formName == ‘CRM_Contribute_Form_Contribution’) { $form->addRule(‘receive_date’, ts(‘This field is required.’), ‘required’, NULL, NULL, NULL, TRUE); $form->addRule(‘contribution_page_id’,  ts(‘This field is required.’), ‘required’, NULL, NULL, NULL,

Posted in CiviCRM

CiviCRM: retrieve CiviCRM Contact from Drupal uid

A first attempt at some code code using the wonderful CiviCRM API version 3. I’m using Drupal 6, and want to retrieve details from CiviCRM relating to the logged in Drupal user. <?php /**  * Implements hook_user().  */ function civicrm_login_message_user($op,

Posted in CiviCRM

mysql query logging

Locate my.cnf on your machine sudo find / -name my.cnf -print For me (on Ubuntu) my.cnf is located here: /etc/mysql/my.cnf … and also here, for local settings: ~/.my.cnf Uncomment the general log file lines: # * Logging and Replication #

Posted in CiviCRM, drupal