I am trying to understand how the patch() function works in the new Fuel SDK. To update a subscriber's status:
require('ET_Client.php');
$myclient = new ET_Client();
$subscriber = new ET_Subscriber();
$subscriber->authStub = $myclient;
$subscriber->props = array("Status" => "Unsubscribed", "SubscriberKey" => "SDKSubscriber");
$results = $subscriber->patch();
print_r($results);
However, this method relies on identifying the subscriber by their subscriber key. The default setting for subscribers is to use their email address as their subscriber key. So how does one change the email address of a user?
Is there a best practice for this seemingly simple action? The Fuel SDK seems to be fairly opaque with simple stuff like this. The documentation is not all that enlightening.
Update:
The Email Address is the only thing that updates but the rest of the fields do not update. Here is my code:
function updateUser($idNum, $userEmail, $fullName, $firstName, $lastName){ //Update Method
$myclient = new ET_Client(); //required by the Fuel SDK
$subscriber = new ET_Subscriber(); //Creates new subscriber object
$subscriber->authStub = $myclient;
$subscriber->props = array("EmailAddress" => $userEmail, "ID" => $idNum, "FullName" => $fullName, "FirstName" => $firstName, "LastName" => $lastName);//$subscriber->props = array("Email Address" => $userEmail, "Full Name" => $fullName, "First Name" => $firstName, "Last Name" => $lastName, "ID" => $idNum); //Prepares the properties to be set for the ID. , "FullName" => $fullName, "FirstName" => $firstName, "LastName" => $lastName, , "FullName" => $fullName, "FirstName" => $firstName, "LastName" => $lastName
$results = $subscriber->patch();
}