Skip to content

Instantly share code, notes, and snippets.

@jimmy-tdr
Created July 31, 2018 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmy-tdr/6818c315ce44f7dda79778751a4be1be to your computer and use it in GitHub Desktop.
Save jimmy-tdr/6818c315ce44f7dda79778751a4be1be to your computer and use it in GitHub Desktop.
add membership
<?php
class CRM_CivirulesActions_EA_Membership_Add extends CRM_Civirules_Action {
public function processAction(CRM_Civirules_TriggerData_TriggerData $triggerData) {
$contactId = $triggerData->getContactId();
$todaysDate = date('Y-m-d');
$params = array(
'debug' => 1,
'contact_id' => $contactId,
'membership_type_id' => 3,
'start_date' => $todaysDate,
'source' => 'Event Sign Up',
'status_id' => 1
);
/* Set membership */
$result = civicrm_api3('Membership', 'create', $params);
public function getExtraDataInputUrl($ruleActionId) {
return FALSE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment