Ejemplo n.º 1
0
function wppb_notify_user_registration_email($bloginfo, $user_name, $email, $send_credentials_via_email, $password, $adminApproval)
{
    //send email to the admin
    $message_from = apply_filters('wppb_register_from_email_message_admin_email', $bloginfo);
    $message_subject = '[' . $message_from . '] ' . __('A new subscriber has (been) registered!', 'profilebuilder');
    $message_subject = apply_filters('wppb_register_admin_email_subject_without_admin_approval', $message_subject, $email, $password, $message_from, 'wppb_admin_emailc_default_registration_email_subject');
    $message_content = sprintf(__('New subscriber on %1$s.<br/><br/>Username:%2$s<br/>E-mail:%3$s<br/>', 'profilebuilder'), $message_from, $user_name, $email);
    if ($adminApproval == 'yes') {
        $message_subject = apply_filters('wppb_register_admin_email_subject_with_admin_approval', $message_subject, $email, $password, $message_from, 'wppb_admin_emailc_registration_with_admin_approval_email_subject');
        $message_content .= '<br/>' . __('The "Admin Approval" feature was activated at the time of registration, so please remember that you need to approve this user before he/she can log in!', 'profilebuilder') . "\r\n";
        $message_content = apply_filters('wppb_register_admin_email_message_with_admin_approval', $message_content, $email, $password, $message_from, 'wppb_admin_emailc_registration_with_admin_approval_email_content');
    } else {
        $message_content = apply_filters('wppb_register_admin_email_message_without_admin_approval', $message_content, $email, $password, $message_from, 'wppb_admin_emailc_default_registration_email_content');
    }
    if (trim($message_content) != '') {
        wppb_mail(get_option('admin_email'), $message_subject, $message_content, $message_from);
    }
    //send an email to the newly registered user, if this option was selected
    if (isset($send_credentials_via_email) && $send_credentials_via_email == 'sending') {
        $user_message_from = apply_filters('wppb_register_from_email_message_user_email', $bloginfo);
        $user_message_subject = sprintf(__('[%1$s] Your new account information', 'profilebuilder'), $user_message_from, $user_name, $password);
        $user_message_subject = apply_filters('wppb_register_user_email_subject_without_admin_approval', $user_message_subject, $email, $password, $user_message_subject, 'wppb_user_emailc_default_registration_email_subject');
        $user_message_content = sprintf(__('Welcome to %1$s!<br/><br/><br/>Your username is:%2$s and password:%3$s', 'profilebuilder'), $user_message_from, $user_name, $password);
        if ($adminApproval == 'yes') {
            $user_message_subject = apply_filters('wppb_register_user_email_subject_with_admin_approval', $user_message_subject, $email, $password, $user_message_subject, 'wppb_user_emailc_registration_with_admin_approval_email_subject');
            $user_message_content .= '<br/><br/>' . __('Before you can access your account, an administrator needs to approve it. You will be notified via email.', 'profilebuilder');
            $user_message_content = apply_filters('wppb_register_user_email_message_with_admin_approval', $user_message_content, $email, $password, $user_message_subject, 'wppb_user_emailc_registration_with_admin_approval_email_content');
        } else {
            $user_message_content = apply_filters('wppb_register_user_email_message_without_admin_approval', $user_message_content, $email, $password, $user_message_subject, 'wppb_user_emailc_default_registration_email_content');
        }
        $message_sent = wppb_mail($email, $user_message_subject, $user_message_content, $user_message_from);
        return $message_sent ? 2 : 1;
    }
}
Ejemplo n.º 2
0
function wppb_notify_user_registration_email($bloginfo, $user_name, $email, $send_credentials_via_email, $password, $adminApproval)
{
    /* if login with email is enabled user_name gets the value of the users email */
    $wppb_general_settings = get_option('wppb_general_settings');
    if (isset($wppb_general_settings['loginWith']) && $wppb_general_settings['loginWith'] == 'email') {
        $user_name = $email;
    }
    //send email to the admin
    $message_from = apply_filters('wppb_register_from_email_message_admin_email', $bloginfo);
    $message_subject = '[' . $message_from . '] ' . __('A new subscriber has (been) registered!', 'profile-builder');
    $message_subject = apply_filters('wppb_register_admin_email_subject_without_admin_approval', $message_subject, $email, $password, $message_from, 'wppb_admin_emailc_default_registration_email_subject');
    $message_content = sprintf(__('New subscriber on %1$s.<br/><br/>Username:%2$s<br/>E-mail:%3$s<br/>', 'profile-builder'), $message_from, $user_name, $email);
    $message_context = 'email_admin_new_subscriber';
    if ($adminApproval == 'yes') {
        $user_data = get_user_by('email', $email);
        $wppb_generalSettings = get_option('wppb_general_settings', 'not_found');
        $adminApproval_mailAdmin = 0;
        if ($wppb_generalSettings != 'not_found' && !empty($wppb_generalSettings['adminApprovalOnUserRole'])) {
            foreach ($user_data->roles as $role) {
                if (in_array($role, $wppb_generalSettings['adminApprovalOnUserRole'])) {
                    if (!current_user_can('delete_users')) {
                        $adminApproval_mailAdmin = 1;
                    }
                }
            }
        } else {
            if (!current_user_can('delete_users')) {
                $adminApproval_mailAdmin = 1;
            }
        }
        if ($adminApproval_mailAdmin == 1) {
            $message_subject = apply_filters('wppb_register_admin_email_subject_with_admin_approval', $message_subject, $email, $password, $message_from, 'wppb_admin_emailc_registration_with_admin_approval_email_subject');
            $message_content .= wppb_adminApproval_adminEmailContent();
            $message_content = apply_filters('wppb_register_admin_email_message_with_admin_approval', $message_content, $email, $password, $message_from, 'wppb_admin_emailc_registration_with_admin_approval_email_content');
            $message_context = 'email_admin_approve';
        }
    } else {
        $message_content = apply_filters('wppb_register_admin_email_message_without_admin_approval', $message_content, $email, $password, $message_from, 'wppb_admin_emailc_default_registration_email_content');
    }
    if (trim($message_content) != '') {
        wppb_mail(get_option('admin_email'), $message_subject, $message_content, $message_from, $message_context);
    }
    //send an email to the newly registered user, if this option was selected
    if (isset($send_credentials_via_email) && $send_credentials_via_email == 'sending') {
        $user_message_from = apply_filters('wppb_register_from_email_message_user_email', $bloginfo);
        $user_message_subject = sprintf(__('[%1$s] Your new account information', 'profile-builder'), $user_message_from, $user_name, $password);
        $user_message_subject = apply_filters('wppb_register_user_email_subject_without_admin_approval', $user_message_subject, $email, $password, $user_message_subject, 'wppb_user_emailc_default_registration_email_subject');
        if ($password === NULL) {
            $password = __('Your selected password at signup', 'profile-builder');
        }
        $user_message_content = sprintf(__('Welcome to %1$s!<br/><br/><br/>Your username is:%2$s and password:%3$s', 'profile-builder'), $user_message_from, $user_name, $password);
        if ($password === __('Your selected password at signup', 'profile-builder')) {
            $password = NULL;
        }
        $user_message_context = 'email_user_account_info';
        if ($adminApproval == 'yes') {
            $user_data = get_user_by('email', $email);
            $wppb_generalSettings = get_option('wppb_general_settings', 'not_found');
            $adminApproval_mailUser = 0;
            if ($wppb_generalSettings != 'not_found' && !empty($wppb_generalSettings['adminApprovalOnUserRole'])) {
                foreach ($user_data->roles as $role) {
                    if (in_array($role, $wppb_generalSettings['adminApprovalOnUserRole'])) {
                        if (!current_user_can('delete_users')) {
                            $adminApproval_mailUser = 1;
                        }
                    }
                }
            } else {
                if (!current_user_can('delete_users')) {
                    $adminApproval_mailUser = 1;
                }
            }
            if ($adminApproval_mailUser == 1) {
                $user_message_subject = apply_filters('wppb_register_user_email_subject_with_admin_approval', $user_message_subject, $email, $password, $user_message_subject, 'wppb_user_emailc_registration_with_admin_approval_email_subject');
                $user_message_content .= wppb_adminApproval_userEmailContent();
                $user_message_context = 'email_user_need_approval';
                $user_message_content = apply_filters('wppb_register_user_email_message_with_admin_approval', $user_message_content, $email, $password, $user_message_subject, 'wppb_user_emailc_registration_with_admin_approval_email_content');
            }
        } else {
            $user_message_content = apply_filters('wppb_register_user_email_message_without_admin_approval', $user_message_content, $email, $password, $user_message_subject, 'wppb_user_emailc_default_registration_email_content');
        }
        $message_sent = wppb_mail($email, $user_message_subject, $user_message_content, $user_message_from, $user_message_context);
        return $message_sent ? 2 : 1;
    }
}
Ejemplo n.º 3
0
function wppb_notify_user_registration_email($bloginfo, $user_name, $email, $send_credentials_via_email, $passw1, $adminApproval, $user_meta)
{
    $registerFilterArray['adminMessageOnRegistration'] = sprintf(__('New subscriber on %1$s.<br/><br/>Username:%2$s<br/>E-mail:%3$s<br/>', 'profilebuilder'), $bloginfo, $user_name, $email);
    if ($adminApproval == 'yes') {
        $registerFilterArray['adminMessageOnRegistration'] .= '<br/>' . __('The "Admin Approval" feature was activated at the time of registration, so please remember that you need to approve this user before he/she can log in!', 'profilebuilder') . "\r\n";
    }
    $registerFilterArray['adminMessageOnRegistration'] = apply_filters('wppb_register_admin_message_content', $registerFilterArray['adminMessageOnRegistration'], $bloginfo, $user_name, $email, $adminApproval);
    $registerFilterArray['adminMessageOnRegistrationSubject'] = '[' . $bloginfo . '] ' . __('A new subscriber has (been) registered!', 'profilebuilder');
    $registerFilterArray['adminMessageOnRegistrationSubject'] = apply_filters('wppb_register_admin_message_title', $registerFilterArray['adminMessageOnRegistrationSubject']);
    if (trim($registerFilterArray['adminMessageOnRegistration']) != '') {
        wppb_mail(get_option('admin_email'), $registerFilterArray['adminMessageOnRegistrationSubject'], $registerFilterArray['adminMessageOnRegistration'], $blogInfo, '', $user_name, $passw1, $email, 'register_w_o_admin_approval_admin_email', $adminApproval, '');
    }
    //send an email to the newly registered user, if this option was selected
    if (isset($send_credentials_via_email) && $send_credentials_via_email == 'sending') {
        //change these variables to modify sent email message, destination and source.
        /*
        		$registerFilterArray['userMessageFrom'] = $bloginfo;
        		$registerFilterArray['userMessageFrom'] = apply_filters('wppb_register_from_email_content', $registerFilterArray['userMessageFrom']);
        
        		$registerFilterArray['userMessageSubject'] = __('A new account has been created for you.', 'profilebuilder');
        		$registerFilterArray['userMessageSubject'] = apply_filters('wppb_register_subject_email_content', $registerFilterArray['userMessageSubject']);
        		
        		$registerFilterArray['userMessageContent'] = sprintf(__( 'Welcome to %1$s!<br/><br/> Your username is:%2$s and password:%3$s', 'profilebuilder'), $registerFilterArray['userMessageFrom'], $user_name, $passw1);
        		if ($adminApproval == 'yes')
        			$registerFilterArray['userMessageContent'] .= '<br/>'. __('Before you can access your account, an administrator needs to approve it. You will be notified via email.', 'profilebuilder');
        		$registerFilterArray['userMessageContent'] = apply_filters('wppb_register_email_content', $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], $user_name, $passw1);
        		
        		$messageSent = wppb_mail( $email, $registerFilterArray['userMessageSubject'], $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], '', $user_name, $passw1, $email, 'register_w_o_admin_approval', $adminApproval, '' );
        */
        //
        // ksk - Content-Type: multipart/alternative; boundary
        $admin_email = get_site_option('admin_email');
        if ($admin_email == '') {
            $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
        }
        $EOF = "\r\n";
        $from_name = 'Т3С';
        //Письмо с вложением состоит из нескольких частей, которые разделяются разделителем
        // Генерируем разделитель
        $boundary = md5(uniqid(time()));
        //$message_headers = apply_filters ("wppb_signup_user_notification_from", "MIME-Version: 1.0;".$EOF."From: \"{$from_name}\" <{$admin_email}>".$EOF."Content-Type: multipart/mixed; boundary=$boundary".$EOF);
        $message_headers = "MIME-Version: 1.0;" . $EOF;
        $message_headers .= "From: {$from_name} <{$admin_email}>" . $EOF;
        //$message_headers .= "Content-Type: multipart/alternative; boundary=$boundary".$EOF;
        $message_headers .= "Content-Type: multipart/mixed; boundary=\"{$boundary}\"" . $EOF;
        // ksk
        // Текст письма содержится на странице, ID которой указан в параметре t3s_setting_signup_user_notification_page_id
        $subject = 'Ваша регистрация на портале Т3С завершена успешно';
        $page_id = get_option('t3s_setting_registration_user_notification_page_id');
        $page_data = get_page($page_id);
        $page_content = apply_filters('the_content', $page_data->post_content);
        //$user_meta = unserialize($meta);
        $fname1 = get_site_url() . '/wp-content/themes/twentytwelve/images/reg_mail_logo.png';
        $fname2 = get_site_url() . '/wp-content/themes/twentytwelve/images/reg_mail_bottom.png';
        $message = "--{$boundary}" . $EOF;
        $message .= 'Content-type: text/html; charset="' . get_option('blog_charset') . '"' . $EOF;
        //$message .= "Content-Transfer-Encoding: base64".$EOF;
        $message .= "Content-Transfer-Encoding: 8bit" . $EOF;
        $message .= $EOF;
        $message .= "<html>" . $EOF;
        $message .= "<head>" . $EOF;
        $message .= "  <meta content=\"text/html; charset=" . get_option('blog_charset') . "\" http-equiv=\"Content-Type\">" . $EOF;
        $message .= "</head>" . $EOF;
        $message .= "<body>" . $EOF;
        $message .= str_replace('#t3s_biz_img_1#', $fname1, str_replace('#t3s_biz_img_2#', $fname2, str_replace('#login#', $user_name, str_replace('#fio#', $user_meta['first_name'] . ' ' . $user_meta['last_name'], $page_content)))) . $EOF;
        $message .= "</body>" . $EOF;
        $message .= "</html>" . $EOF;
        //
        //wppb_mail( $user_email, $subject, $message, $from_name, '', $user, '', $user_email, 'register_w_email_confirmation', $siteURL, $meta );
        // отправляем письмо
        $messageSent = mail($user_email, $subject, $message, $message_headers);
        //
        if ($messageSent == TRUE) {
            return 2;
        } else {
            return 1;
        }
    }
}
Ejemplo n.º 4
0
function wppb_send_new_user_status_email($userID, $newStatus)
{
    $user_info = get_userdata($userID);
    $bloginfo = get_bloginfo('name');
    $userMessageFrom = $bloginfo;
    $userMessageFrom = apply_filters('wppb_new_user_status_from_email_content', $userMessageFrom, $bloginfo, $userID, $newStatus);
    if ($newStatus == 'approved') {
        $userMessageSubject = sprintf(__('Your account on %1$s has been approved!', 'profilebuilder'), $bloginfo);
        $userMessageContent = sprintf(__('An administrator has just approved your account on %1$s (%2$s).', 'profilebuilder'), $bloginfo, $user_info->user_login);
        $userMessageSubject = apply_filters('wppb_new_user_status_subject_approved', $userMessageSubject, $userMessageFrom, $newStatus, $userID, $user_info, $bloginfo);
        $userMessageContent = apply_filters('wppb_new_user_status_content_approved', $userMessageContent, $newStatus, $userMessageFrom, $user_info);
    } elseif ($newStatus == 'unapproved') {
        $userMessageSubject = sprintf(__('Your account on %1$s has been unapproved!', 'profilebuilder'), $bloginfo);
        $userMessageContent = sprintf(__('An administrator has just unapproved your account on %1$s (%2$s).', 'profilebuilder'), $bloginfo, $user_info->user_login);
        $userMessageSubject = apply_filters('wppb_new_user_status_subject_unapproved', $userMessageSubject, $userMessageFrom, $newStatus, $userID, $user_info, $bloginfo);
        $userMessageContent = apply_filters('wppb_new_user_status_content_unapproved', $userMessageContent, $newStatus, $userMessageFrom, $user_info);
    }
    wppb_mail($user_info->user_email, $userMessageSubject, $userMessageContent, $userMessageFrom, $userID, '', '', '', $newStatus . '_userFunction', $user_info, $newStatus);
}
function wppb_notify_user_registration_email($bloginfo, $user_name, $email, $send_credentials_via_email, $passw1, $adminApproval)
{
    $registerFilterArray['adminMessageOnRegistration'] = sprintf(__('New subscriber on %1$s.<br/><br/>Username:%2$s<br/>E-mail:%3$s<br/>', 'profilebuilder'), $bloginfo, $user_name, $email);
    if ($adminApproval == 'yes') {
        $registerFilterArray['adminMessageOnRegistration'] .= '<br/>' . __('The "Admin Approval" feature was activated at the time of registration, so please remember that you need to approve this user before he/she can log in!', 'profilebuilder') . "\r\n";
    }
    $registerFilterArray['adminMessageOnRegistration'] = apply_filters('wppb_register_admin_message_content', $registerFilterArray['adminMessageOnRegistration'], $bloginfo, $user_name, $email);
    $registerFilterArray['adminMessageOnRegistrationSubject'] = '[' . $bloginfo . '] ' . __('A new subscriber has (been) registered!', 'profilebuilder');
    $registerFilterArray['adminMessageOnRegistrationSubject'] = apply_filters('wppb_register_admin_message_title', $registerFilterArray['adminMessageOnRegistrationSubject']);
    if (trim($registerFilterArray['adminMessageOnRegistration']) != '') {
        wppb_mail(get_option('admin_email'), $registerFilterArray['adminMessageOnRegistrationSubject'], $registerFilterArray['adminMessageOnRegistration'], $blogInfo, '', $user_name, $passw1, $email, 'register_w_o_admin_approval_admin_email', $adminApproval, '');
    }
    //send an email to the newly registered user, if this option was selected
    if (isset($send_credentials_via_email) && $send_credentials_via_email == 'sending') {
        //change these variables to modify sent email message, destination and source.
        $registerFilterArray['userMessageFrom'] = $bloginfo;
        $registerFilterArray['userMessageFrom'] = apply_filters('wppb_register_from_email_content', $registerFilterArray['userMessageFrom']);
        $registerFilterArray['userMessageSubject'] = __('A new account has been created for you.', 'profilebuilder');
        $registerFilterArray['userMessageSubject'] = apply_filters('wppb_register_subject_email_content', $registerFilterArray['userMessageSubject']);
        $registerFilterArray['userMessageContent'] = sprintf(__('Welcome to %1$s!<br/><br/> Your username is:%2$s and password:%3$s', 'profilebuilder'), $registerFilterArray['userMessageFrom'], $user_name, $passw1);
        if ($adminApproval == 'yes') {
            $registerFilterArray['userMessageContent'] .= '<br/>' . __('Before you can access your account, an administrator needs to approve it. You will be notified via email.', 'profilebuilder');
        }
        $registerFilterArray['userMessageContent'] = apply_filters('wppb_register_email_content', $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], $user_name, $passw1);
        $messageSent = wppb_mail($email, $registerFilterArray['userMessageSubject'], $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], '', $user_name, $passw1, $email, 'register_w_o_admin_approval', $adminApproval, '');
        if ($messageSent == TRUE) {
            return 2;
        } else {
            return 1;
        }
    }
}
function wppb_send_new_user_status_email($userID, $newStatus)
{
    $wppb_general_settings = get_option('wppb_general_settings');
    $user_info = get_userdata($userID);
    if (isset($wppb_general_settings['loginWith']) && $wppb_general_settings['loginWith'] == 'email') {
        $user_login = $user_info->user_email;
    } else {
        $user_login = $user_info->user_login;
    }
    $userMessageFrom = apply_filters('wppb_new_user_status_from_email_content', get_bloginfo('name'), $userID, $newStatus);
    if ($newStatus == 'approved') {
        $userMessageSubject = sprintf(__('Your account on %1$s has been approved!', 'profile-builder'), get_bloginfo('name'));
        $userMessageSubject = apply_filters('wppb_new_user_status_subject_approved', $userMessageSubject, $user_info, __('approved', 'profile-builder'), $userMessageFrom, 'wppb_user_emailc_admin_approval_notif_approved_email_subject');
        $userMessageContent = sprintf(__('An administrator has just approved your account on %1$s (%2$s).', 'profile-builder'), get_bloginfo('name'), $user_login);
        $userMessageContent = apply_filters('wppb_new_user_status_message_approved', $userMessageContent, $user_info, __('approved', 'profile-builder'), $userMessageFrom, 'wppb_user_emailc_admin_approval_notif_approved_email_content');
        $userMessage_context = 'email_user_approved';
    } elseif ($newStatus == 'unapproved') {
        $userMessageSubject = sprintf(__('Your account on %1$s has been unapproved!', 'profile-builder'), get_bloginfo('name'));
        $userMessageSubject = apply_filters('wppb_new_user_status_subject_unapproved', $userMessageSubject, $user_info, __('unapproved', 'profile-builder'), $userMessageFrom, 'wppb_user_emailc_admin_approval_notif_unapproved_email_subject');
        $userMessageContent = sprintf(__('An administrator has just unapproved your account on %1$s (%2$s).', 'profile-builder'), get_bloginfo('name'), $user_login);
        $userMessageContent = apply_filters('wppb_new_user_status_message_unapproved', $userMessageContent, $user_info, __('unapproved', 'profile-builder'), $userMessageFrom, 'wppb_user_emailc_admin_approval_notif_unapproved_email_content');
        $userMessage_context = 'email_user_unapproved';
    }
    wppb_mail($user_info->user_email, $userMessageSubject, $userMessageContent, $userMessageFrom, $userMessage_context);
}