// Hack to fix state select box in 4.4.x
if($formName == 'CRM_Profile_Form_Edit') {
$contactId = CRM_Core_Session::singleton()->get('userID');
- $contact = civicrm_api3('contact', 'getsingle', array( 'id' => $contactId ));
- $defaults['state_province-Primary'] = $contact['state_province_id'];
- $form->setDefaults($defaults);
+ if($concactId) {
+ $contact = civicrm_api3('contact', 'getsingle', array( 'id' => $contactId ));
+ $defaults['state_province-Primary'] = $contact['state_province_id'];
+ $form->setDefaults($defaults);
+ }
}
}