本文整理汇总了PHP中CRM_Mailing_Event_BAO_Subscribe::getDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_Event_BAO_Subscribe::getDomain方法的具体用法?PHP CRM_Mailing_Event_BAO_Subscribe::getDomain怎么用?PHP CRM_Mailing_Event_BAO_Subscribe::getDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_Event_BAO_Subscribe
的用法示例。
在下文中一共展示了CRM_Mailing_Event_BAO_Subscribe::getDomain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirm
/**
* Confirm a pending subscription
*
* @param int $contact_id The id of the contact
* @param int $subscribe_id The id of the subscription event
* @param string $hash The hash
* @return boolean True on success
* @access public
* @static
*/
function confirm($contact_id, $subscribe_id, $hash)
{
$se =& CRM_Mailing_Event_BAO_Subscribe::verify($contact_id, $subscribe_id, $hash);
if (!$se) {
return false;
}
CRM_Core_DAO::transaction('BEGIN');
$ce =& new CRM_Mailing_Event_BAO_Confirm();
$ce->event_subscribe_id = $se->id;
$ce->time_stamp = date('YmdHis');
$ce->save();
CRM_Contact_BAO_GroupContact::updateGroupMembershipStatus($contact_id, $se->group_id, 'Email', $ce->id);
CRM_Core_DAO::transaction('COMMIT');
$config =& CRM_Core_Config::singleton();
$domain =& CRM_Mailing_Event_BAO_Subscribe::getDomain($subscribe_id);
list($display_name, $email) = CRM_Contact_BAO_Contact::getEmailDetails($se->contact_id);
$group =& new CRM_Contact_DAO_Group();
$group->id = $se->group_id;
$group->find(true);
require_once 'CRM/Mailing/BAO/Component.php';
$component =& new CRM_Mailing_BAO_Component();
$component->domain_id = $domain->id;
$component->is_default = 1;
$component->is_active = 1;
$component->component_type = 'Welcome';
$component->find(true);
$headers = array('Subject' => $component->subject, 'From' => ts('"%1 Administrator" <do-not-reply@%2>', array(1 => $domain->name, 2 => $domain->email_domain)), 'To' => $email, 'Reply-To' => "do-not-reply@{$domain->email_domain}", 'Return-Path' => "do-not-reply@{$domain->email_domain}");
$html = $component->body_html;
require_once 'CRM/Utils/Token.php';
$html = CRM_Utils_Token::replaceDomainTokens($html, $domain, true);
$html = CRM_Utils_Token::replaceWelcomeTokens($html, $group->name, true);
$text = $component->body_text;
$text = CRM_Utils_Token::replaceDomainTokens($text, $domain, false);
$text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->name, false);
$message =& new Mail_Mime("\n");
$message->setHTMLBody($html);
$message->setTxtBody($text);
$b = $message->get();
$h = $message->headers($headers);
$mailer =& $config->getMailer();
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('CRM_Mailing_BAO_Mailing', 'catchSMTP'));
$mailer->send($email, $h, $b);
CRM_Core_Error::setCallback();
return true;
}