public static function purge_contact($contact_id) { $subscriber = EZP_CS_Subscriber_Entity::get_by_contact_id($contact_id); if ($subscriber != null) { $subscriber->delete(); } $emails = EZP_Email_Entity::get_by_contact_id($contact_id); foreach ($email as $email) { /* @var $email EZP_Email_Entity */ $email->delete(); } EZP_Contact_Entity::delete_by_id($contact_id); }
public static function activate() { EZP_CS_Utility::debug("activate"); $installed_ver = get_option(EZP_CS_Constants::PLUGIN_VERSION_OPTION_KEY); EZP_CS_JSON_Entity_Base::init_table(); EZP_Contact_Entity::init_table(); EZP_Email_Entity::init_table(); EZP_CS_Subscriber_Entity::init_table(); EZP_CS_Global_Entity::initialize_plugin_data(); update_option(EZP_CS_Constants::PLUGIN_VERSION_OPTION_KEY, EZP_CS_Constants::PLUGIN_VERSION); }