$email, 'name' => $name]], // From your company, not the key's agent - "You are invited to the client portal" ['billing' => intval($_POST['billing'] ?? 0) === 1, 'technical' => intval($_POST['technical'] ?? 0) === 1], ['user_id' => 0]); if (isset($done['skipped'][$email])) { $return_arr['success'] = "True"; $return_arr['count'] = '0'; $return_arr['invite'] = 'skipped'; $return_arr['message'] = "Not invited - " . $done['skipped'][$email]; echo json_encode($return_arr); exit(); } $state = in_array($email, $done['resent'], true) ? 'resent' : 'invited'; $insert_id = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT invite_id FROM portal_invites WHERE invite_client_id = " . intval($client_id) . " AND invite_kind = 'invite' AND invite_email = '" . escapeSql($email) . "' ORDER BY invite_id DESC LIMIT 1"))[0] ?? 0); $return_arr['invite'] = $state; logAudit("Contact", "Invite", escapeSql(($state === 'resent' ? 'Sent the client portal invite again to ' : 'Invited ') . "$email" . ($state === 'resent' ? '' : ' to the client portal') . " for {$client['client_name']} via API ($api_key_name)"), intval($client_id)); logAudit("API", "Success", escapeSql("Client portal invite for $email via API ($api_key_name)"), intval($client_id)); // Output require_once '../create_output.php';