コード例 #1
0
 public function send_recipient_email($name = '', $email = '', $gift_message = '', $payment_id = 0)
 {
     if (!class_exists('RCP_Discounts')) {
         return false;
     }
     global $edd_options;
     $db = new RCP_Discounts();
     $site_name = get_bloginfo('name');
     $discount = $db->get_by('code', md5($name . $email . $payment_id));
     $subject = sprintf(__('Gift Certificate to %s', 'rcp-gifts'), $site_name);
     $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
     $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
     $body = '<p>' . __("Hello!", "rcp-gifts") . '</p>';
     $body .= '<p>' . sprintf(__("Someone has gifted you a membership to %s", "rcp-gifts"), $site_name) . '</p>';
     if (!empty($gift_message) && __('Enter the a message to send to the recipient', 'rcp-gifts') != $gift_message) {
         $body .= '<p>' . __("The following message was included with the gift: ", "rcp-gifts") . '</p>';
         $body .= '<blockquote>' . $gift_message . '</blockquote>';
     }
     $body .= '<p>' . sprintf(__("Enter %s during registration to redeem your gift.", "rcp-gifts"), $discount->code) . '</p>';
     $body .= '<p>' . sprintf(__("Visit %s to claim your membership gift.", "rcp-gifts"), '<a href="' . home_url() . '">' . home_url() . '</a>') . '</p>';
     $emails = new EDD_Emails();
     $emails->__set('from_address', $from_email);
     $emails->__set('from_name', $from_name);
     $emails->send($email, $subject, $body);
 }
コード例 #2
0
 /**
  * Notifications
  * Sends the user an email with their logins details and also sends the site admin an email notifying them of a signup
  *
  * @since 1.1
  */
 public function email_notifications($user_id = 0, $user_data = array())
 {
     global $edd_options;
     $user = get_userdata($user_id);
     $user_email_disabled = edd_get_option('edd_auto_register_disable_user_email', '');
     $admin_email_disabled = edd_get_option('edd_auto_register_disable_admin_email', '');
     // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     // we want to reverse this for the plain text arena of emails.
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $message = sprintf(__('New user registration on your site %s:', 'edd-auto-register'), $blogname) . "\r\n\r\n";
     $message .= sprintf(__('Username: %s', 'edd-auto-register'), $user->user_login) . "\r\n\r\n";
     $message .= sprintf(__('E-mail: %s', 'edd-auto-register'), $user->user_email) . "\r\n";
     if (!$admin_email_disabled) {
         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration', 'edd-auto-register'), $blogname), $message);
     }
     // user registration
     if (empty($user_data['user_pass'])) {
         return;
     }
     // message
     $message = $this->get_email_body_content($user_data['first_name'], sanitize_user($user_data['user_login'], true), $user_data['user_pass']);
     // subject line
     $subject = apply_filters('edd_auto_register_email_subject', sprintf(__('[%s] Your username and password', 'edd-auto-register'), $blogname));
     // get from name and email from EDD options
     $from_name = edd_get_option('from_name', get_bloginfo('name'));
     $from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
     $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
     $headers .= "Reply-To: " . $from_email . "\r\n";
     $headers = apply_filters('edd_auto_register_headers', $headers);
     $emails = new EDD_Emails();
     $emails->__set('from_name', $from_name);
     $emails->__set('from_email', $from_email);
     $emails->__set('headers', $headers);
     // Email the user
     if (!$user_email_disabled) {
         $emails->send($user_data['user_email'], $subject, $message);
     }
 }
コード例 #3
0
/**
 * Sends an email to the specified user with a URL to verify their account
 *
 * @access  public
 * @since   2.4.4
 * @return  void
 */
function edd_send_user_verification_email($user_id = 0)
{
    if (empty($user_id)) {
        return;
    }
    if (!edd_user_pending_verification($user_id)) {
        return;
    }
    $user_data = get_userdata($user_id);
    if (!$user_data) {
        return;
    }
    $verify_url = edd_get_user_verification_url($user_id);
    $name = $user_data->display_name;
    $url = edd_get_user_verification_url($user_id);
    $from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
    $subject = apply_filters('edd_user_verification_email_subject', __('Verify your account', 'easy-digital-downloads'), $user_id);
    $heading = apply_filters('edd_user_verification_email_heading', __('Verify your account', 'easy-digital-downloads'), $user_id);
    $message = sprintf(__("Hello %s,\n\nYour account with %s needs to be verified before you can access your purchase history. <a href='%s'>Click here</a> to verify your account.\n\nLink missing? Visit the following URL: %s", 'easy-digital-downloads'), $name, $from_name, $url, $url);
    $message = apply_filters('edd_user_verification_email_message', $message, $user_id);
    $emails = new EDD_Emails();
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('heading', $heading);
    $emails->send($user_data->user_email, $subject, $message);
}