Add buildForm hook to fix state select box when editing info profile.
authorDavid Thompson <davet@gnu.org>
Wed, 3 Dec 2014 17:17:49 +0000 (12:17 -0500)
committerDavid Thompson <davet@gnu.org>
Wed, 3 Dec 2014 17:17:49 +0000 (12:17 -0500)
* memberdashboard.php (memberdashboard_civicrm_buildFrom): New function.

memberdashboard.php

index bb7e8238dec7b8970266f64773b7cd87c663f33b..8ceed2d4ebdf78c81decfdaf1064f1daadd1530b 100644 (file)
@@ -164,3 +164,13 @@ function memberdashboard_civicrm_post($op, $objectName, $objectId, &$objectRef)
     }
   }
 }
+
+function memberdashboard_civicrm_buildForm($formName, &$form) {
+  // 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-1'] = $contact['state_province_id'];
+    $form->setDefaults($defaults);
+  }
+}