PHP API version 1 - Delete User not working

Hi All,

I’ve had a lot of success with the v1 PHP SDK via Wordpress. However, delete_user doesn’t seem to be working as expected. Am I missing something?

function custom_remove_user( $user_id ) {

$current_user = get_userdata($user_id);
$uid = $current_user->ID;
$uid_acf = get_field('ac_id', 'user_'.$uid);
$subscribe = get_field('subscribe_to_email', 'user_'.$uid);

if(!$subscribe){
     return;
}

require_once(ABSPATH ."/activecampaign/includes/ActiveCampaign.class.php");

$ac = new ActiveCampaign("https://myaccount.api-us1.com", "xxx");

if (!(int)$ac->credentials_test()) {
    echo "<p>Accesses denied: Invalid credentials (URL and/or API key).</p>";
    exit();
}

$contact = array(
    "id"=> $uid_acf,
);

$contact_delete = $ac->api("contact/delete", $contact);

if (!(int)$contact_delete->success) {
    echo "<p>Deleting contact failed. Error returned: " . $contact_delete->error . "</p>";
    exit();
}

write_log('contact deleted: '.$uid_acf);

}