Programmatically Add User in Arigato PRO & Arigato Lite

If you have custom function that wants to subscribe user in Arigato PRO or Arigato Lite mailing list, here is the code that you need to use.

For Arigato PRO:

if(!class_exists('BFTProUser')) return false; // avoid fatal errors in case Arigato PRO is not activated

$_user = new BFTProUser();
$_user->ignore_redirect = true;

// array with user data:
$vars = array(
"name" => "John Smith", // required
"email" => "john@my-domain.com", // required
"list_id" => 5, // the ID of the mailing list, required
"source" => "my custom function", // optional
);

try {
   // the function returns the newly inserted subscriber ID
   $message = '';
   $subscriber_id = $_user -> subscribe($vars, $message, true);
}
catch(Exception $e) {
   echo $e->getMessage();
}

 

Essentially this is all you need. The function will ignore list redirect and captcha requirements.

For Arigato Lite:

This is even simpler:

if(!function_exists('bft_subscribe')) return false;
bft_subscribe("john@my-domain.com", "John Smith", true, true);