Check Event Registration, via ctct_php_library


Check Event Registration, via ctct_php_library

I want to programmatically check whether someone is registered for an event. Preferably by e-mail address.


I was happily using $ConstantContact->searchContactsByEmail($email); until I realized that people who have signed up for an event DON'T show up as a contact.


Thank you,




Hi Cindy,


The reasoning for this is because people who register are not always a contact.  I thought about what you are trying to do and you can most certainly do it but its not as easy as that search feature. 


What you have to do is create a while statement that searches through your events.  For ex:


// get all the events
$myEvents = $ConstantContact->getEvents();
// while events is less than or equal to the ammount of events while($myEvents[events][$x] <= count($myEvents[events])) {
// if this event is the one im looking for than process
 if($myEvents[events][$x]->name == $myEventName) { // get all the registrants from your specific event
$myReg = $ConstantContact->getRegistrants($myEvents[events][$x]); break; } $x++; }

 Now you have a list of all the registrants from a specific event.  Now you need to do another loop to find the correct person. For ex:


// while there are still registrants than keep searching
while($myReg[registrants][$y] <= count($myReg[registrants]))
        // if this is the email address of the person your looking for
	if($myReg[registrants][$y]->email == $myRegistrant)
                // output the registrant
		print "$myRegistrant is registered";

 Now this code will get you started for what you want to do but you will need to do more work if the amount of registrants is going to exceed 50 as you will need to program to accommodate it to search for it per page as you only get 50 results per request. 


Also this code does not catch any errors such as if the event or registrant does not exist so you would want to account for those events to happen.


Please let me know if you need anymore help.



Ryan Davis
Quality Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page