return $session->get('userID');
}
+ /**
+ * Get the active UFGroups (profiles) on this form
+ * Many forms load one or more UFGroups (profiles).
+ * This provides a standard function to retrieve the IDs of those profiles from the form
+ * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
+ *
+ * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
+ *
+ * @return array
+ */
+ public function getUFGroupIDs() {
+ $ufGroupIDs = [];
+ if (!empty($this->_contactProfileId)) {
+ $ufGroupIDs[] = $this->_contactProfileId;
+ }
+ if (!empty($this->_activityProfileId)) {
+ $ufGroupIDs[] = $this->_activityProfileId;
+ }
+ return $ufGroupIDs;
+ }
+
public function preProcess() {
$this->bao = new CRM_Campaign_BAO_Petition();
$this->_mode = self::MODE_CREATE;
protected $_paymentProcessorID;
protected $_snippet;
+ /**
+ * Get the active UFGroups (profiles) on this form
+ * Many forms load one or more UFGroups (profiles).
+ * This provides a standard function to retrieve the IDs of those profiles from the form
+ * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
+ *
+ * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
+ *
+ * @return array
+ */
+ public function getUFGroupIDs() {
+ $ufGroupIDs = [];
+ if (!empty($this->_values['custom_pre_id'])) {
+ $ufGroupIDs[] = $this->_values['custom_pre_id'];
+ }
+ if (!empty($this->_values['custom_post_id'])) {
+ // custom_post_id can be an array (because we can have multiple for events).
+ // It is handled as array for contribution page as well though they don't support multiple profiles.
+ if (!is_array($this->_values['custom_post_id'])) {
+ $ufGroupIDs[] = $this->_values['custom_post_id'];
+ }
+ else {
+ $ufGroupIDs = array_merge($ufGroupIDs, $this->_values['custom_post_id']);
+ }
+ }
+
+ return $ufGroupIDs;
+ }
+
/**
* Set variables up before form is built.
*/
}
}
- /**
- * Check if ReCAPTCHA has to be added on Contribution form forcefully.
- */
- protected function hasToAddForcefully() {
- return CRM_Utils_ReCAPTCHA::hasToAddForcefully();
- }
-
/**
* Add onbehalf/honoree profile fields and native module fields.
*
return $this->exportedValues[$fieldName] ?? NULL;
}
+ /**
+ * Get the active UFGroups (profiles) on this form
+ * Many forms load one or more UFGroups (profiles).
+ * This provides a standard function to retrieve the IDs of those profiles from the form
+ * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
+ *
+ * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
+ *
+ * @return array
+ */
+ public function getUFGroupIDs() {
+ return [];
+ }
+
}
*/
public $additionalParticipantId = NULL;
+ /**
+ * Get the active UFGroups (profiles) on this form
+ * Many forms load one or more UFGroups (profiles).
+ * This provides a standard function to retrieve the IDs of those profiles from the form
+ * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
+ *
+ * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
+ *
+ * @return array
+ */
+ public function getUFGroupIDs() {
+ $ufGroupIDs = [];
+ foreach (['pre', 'post'] as $keys) {
+ if (isset($this->_values['additional_custom_' . $keys . '_id'])) {
+ $ufGroupIDs[] = $this->_values['additional_custom_' . $keys . '_id'];
+ }
+ }
+ return $ufGroupIDs;
+ }
+
/**
* Set variables up before form is built.
*
return $contactID;
}
+ /**
+ * Get the active UFGroups (profiles) on this form
+ * Many forms load one or more UFGroups (profiles).
+ * This provides a standard function to retrieve the IDs of those profiles from the form
+ * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
+ *
+ * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
+ *
+ * @return array
+ */
+ public function getUFGroupIDs() {
+ $ufGroupIDs = [];
+ if (!empty($this->_values['custom_pre_id'])) {
+ $ufGroupIDs[] = $this->_values['custom_pre_id'];
+ }
+ if (!empty($this->_values['custom_post_id'])) {
+ // custom_post_id can be an array (because we can have multiple for events).
+ // It is handled as array for contribution page as well though they don't support multiple profiles.
+ if (!is_array($this->_values['custom_post_id'])) {
+ $ufGroupIDs[] = $this->_values['custom_post_id'];
+ }
+ else {
+ $ufGroupIDs = array_merge($ufGroupIDs, $this->_values['custom_post_id']);
+ }
+ }
+ return $ufGroupIDs;
+ }
+
/**
* Set variables up before form is built.
*
*/
public $_single;
+ /**
+ * Get the active UFGroups (profiles) on this form
+ * Many forms load one or more UFGroups (profiles).
+ * This provides a standard function to retrieve the IDs of those profiles from the form
+ * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
+ *
+ * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
+ *
+ * @return array
+ */
+ public function getUFGroupIDs() {
+ $ufGroupIDs = [];
+ if (!empty($this->_pageId)) {
+ $ufGroupIDs[] = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
+ }
+ return $ufGroupIDs;
+ }
+
public function preProcess() {
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
* @return void
*/
public function buildQuickForm() {
- $id = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
- if (CRM_PCP_BAO_PCP::checkEmailProfile($id)) {
+ $ufGroupID = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
+ if (CRM_PCP_BAO_PCP::checkEmailProfile($ufGroupID)) {
$this->assign('profileDisplay', TRUE);
}
$fields = NULL;
if ($this->_contactID) {
- if (CRM_Core_BAO_UFGroup::filterUFGroups($id, $this->_contactID)) {
- $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
+ if (CRM_Core_BAO_UFGroup::filterUFGroups($ufGroupID, $this->_contactID)) {
+ $fields = CRM_Core_BAO_UFGroup::getFields($ufGroupID, FALSE, CRM_Core_Action::ADD);
}
$this->addFormRule(['CRM_PCP_Form_PCPAccount', 'formRule'], $this);
}
else {
- CRM_Core_BAO_CMSUser::buildForm($this, $id, TRUE);
+ CRM_Core_BAO_CMSUser::buildForm($this, $ufGroupID, TRUE);
- $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
+ $fields = CRM_Core_BAO_UFGroup::getFields($ufGroupID, FALSE, CRM_Core_Action::ADD);
}
if ($fields) {
return 'Profile';
}
+ /**
+ * Get the active UFGroups (profiles) on this form
+ * Many forms load one or more UFGroups (profiles).
+ * This provides a standard function to retrieve the IDs of those profiles from the form
+ * so that you can implement things such as "is is_captcha field set on any of the active profiles on this form?"
+ *
+ * NOT SUPPORTED FOR USE OUTSIDE CORE EXTENSIONS - Added for reCAPTCHA core extension.
+ *
+ * @return array
+ */
+ public function getUFGroupIDs() {
+ if (empty($this->_profileIds)) {
+ $dao = new CRM_Core_DAO_UFGroup();
+ $dao->id = $this->_gid;
+ $this->_profileIds = (array) $dao;
+ }
+ return $this->_profileIds;
+ }
+
+ /**
+ * Are we using the profile in create mode?
+ *
+ * @return bool
+ */
+ public function getIsCreateMode() {
+ return ($this->_mode == self::MODE_CREATE);
+ }
+
/**
* Pre processing work done here.
*