The Zenbership environment is always available within a hook, so you have access to all Zenbership methods and classes. That allows you to easily load data from the Zenbership database as follows:

Accessing a Member Record

<?php

$member = new user();
$memberData = $member->get_user($member_id);

var_dump($memberData);

Accessing a Contact Record

<?php

$contact = new contact();
$contactData = $contact->get_contact($member_id);

var_dump($contactData);

Determining Whether a Member or Contact Triggered the Task

<?php

// A contact triggered the task.
if ($member_type == "contact") {
	$contact = new contact();
	// $userData = $contact->get_contact($member_id);
	// ...your code here.
}

// A member triggered the task.
else if ($member_type == "member") {
	$member = new user();
	// $userData = $member->get_user($member_id);
	// ...your code here.
}

// var_dump($userData);

Last modified 3 weeks ago.