cancel
Showing results for 
Search instead for 
Did you mean: 
Due to an issue with YouTube, inserting videos in your emails is showing an error. Until they are able to resolve this issue, we recommend using a different video hosting service. We will continue to monitor this outage and update you as we have more information.

php Wrapper and removed customers

Highlighted
Occasional Contributor

php Wrapper and removed customers

I am updating some contact info using phpWrapper, but I don't want to update the info for contacts that are "removed", yet I can't find a way to distinguish between active contacts and removed contacts in listContactDetails().

3 REPLIES 3
CTCT Employee

Re: php Wrapper and removed customers

Hey Erin,

 

I looked into your issue and actually revised the wrapper a little bit in order to get this to work the way I believe you need it to.

 

Please open the ctctWrapper.php file and goto line 1234 and modify it so it looks like this:

$utility = new Utility();
			if ($params['status'] == 'Do Not Mail')
			{
				$utility->setActionBy('ACTION_BY_CONTACT');
				$this->setStatus($params['status']);
			}
			else
			{
				$this->setStatus($params['status']);
			}

 This will allow you to now use the getStatus method located under the contact class.  Here is an example of how this would work

<?php
include_once('ctctwrapper.php');

// Istantiate Utility 
$ConstantContact = new Utility();

// Istantiate Contacts as part of the Contacts Collection
$Contacts = new ContactsCollection();

// Get all the contacts and put into the $Contact Variable
$Contact = $Contacts->listContacts();

// This will put the specific object data into the $OneContact Variable
$OneContact = $Contacts->listContactDetails($Contact[0][0]);

// myContact will now hold the status of the Object data of $OneContact
$myContact = $OneContact->getStatus();

// output data
print_r($myContact);

?>

 Please let me know if this helps,

Ryan Davis
Quality Engineer
Occasional Contributor

Re: php Wrapper and removed customers

thank you...can you explain why you put this in the if and the else statement?

 

I just did this:

 

$utility = new Utility();
			if ($params['status'] == 'Do Not Mail')
			{
				$utility->setActionBy('ACTION_BY_CONTACT');
			}
			$this->setStatus($params['status']);

 since I am doing the same thing no matter what, whay am I creating an else? It seems to work fine the way I did it, but I am happy to change it.

CTCT Employee

Re: php Wrapper and removed customers

Hey Erin,


That will work fine, I put it in the statement as I was testing something out with it and that appears to work with out creating any errors in the wrapper. 

 

Let me know if you need any more help.

Ryan Davis
Quality Engineer