Skip to content

Instantly share code, notes, and snippets.

@techjewel
Last active June 14, 2021 12:58
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 techjewel/9acdaf1f95fa088de688e2e97811b0a8 to your computer and use it in GitHub Desktop.
Save techjewel/9acdaf1f95fa088de688e2e97811b0a8 to your computer and use it in GitHub Desktop.
FluentCRM update contact status programatically
<?php
function fcrmUpdateContactStatus($contactEmail, $newStatus) {
$contact = FluentCrmApi('contacts')->getContact($contactEmail);
if($contact) {
$oldStatus = $contact->status;
if($newStatus != $oldStatus) {
$contact->status = $newStatus;
$contact->save();
do_action('fluentcrm_subscriber_status_to_' . $newStatus, $contact, $oldStatus);
}
}
return $contact;
}
// example usage: fcrmUpdateContactStatus('contact@email.com', 'unsubscribed');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment