Function Reference: geodir_payment_clientEmail
Summary
This function has not been documented yet.
Filters
‘geodir_payment_clientEmail_to’ [Line: 1864]
‘geodir_payment_clientEmail_subject’ [Line: 1875]
‘geodir_payment_clientEmail_message’ [Line: 1886]
‘geodir_payment_clientEmail_headers’ [Line: 1897]
Source Code
function geodir_payment_clientEmail($post_id, $user_id, $message_type, $extra = '') { $login_details = ''; $to_message = ''; $to_subject = ''; if ($message_type == 'payment_success') { $subject = get_option('geodir_post_payment_success_client_email_subject'); $message = get_option('geodir_post_payment_success_client_email_content'); } elseif ($message_type == 'expiration') { $subject = get_option('geodir_renew_email_subject'); $message = get_option('geodir_renew_email_content'); } elseif ($message_type == 'payment_upgrade') { $subject = get_option('geodir_post_upgrade_success_email_subject'); $message = get_option('geodir_post_upgrade_success_email_content'); } elseif ($message_type == 'payment_renew') { $subject = get_option('geodir_post_renew_success_email_subject'); $message = get_option('geodir_post_renew_success_email_content'); } else { return false; } if (!empty($subject)) { $subject = __(stripslashes_deep($subject), 'geodirectory'); } if (!empty($message)) { $message = __(stripslashes_deep($message), 'geodirectory'); } $number_of_grace_days = get_option('geodir_listing_preexpiry_notice_days'); if ($number_of_grace_days == '') { $number_of_grace_days = 1; } $alivedays = geodir_get_post_meta($post_id, 'alive_days', true); $user_info = get_userdata($user_id); $toEmail = $user_info->user_email; $toEmailName = $user_info->display_name; $user_login = $user_info->user_login; $user_email = $user_info->user_email; $to_message = nl2br($to_message); $sitefromEmail = get_option('site_email'); $sitefromEmailName = get_site_emailName(); $productlink = get_permalink($post_id); $post_info = get_post($post_id); $posted_date = $post_info->post_date; $listingLink =''.$post_info->post_title.''; $siteurl = home_url(); $siteurl_link = ''.$siteurl.''; $loginurl = geodir_login_url(); $loginurl_link = 'login'; $fromEmail = $sitefromEmail; $fromEmailName = $sitefromEmailName; $search_array = array('[#listing_link#]','[#site_name_url#]','[#post_id#]','[#site_name#]','[#to_name#]','[#from_name#]','[#subject#]','[#comments#]','[#login_url#]','[#login_details#]','[#client_name#]', '[#posted_date#]', '[#transaction_details#]', '[#number_of_grace_days#]', '[#number_of_days#]', '[#username#]', '[#user_email#]' ); $replace_array = array($listingLink,$siteurl_link,$post_id,$sitefromEmailName,$toEmailName,$fromEmailName,$to_subject,$to_message,$loginurl_link,$login_details,$toEmailName, $posted_date, $extra, $number_of_grace_days, $alivedays, $user_login, $user_email); $message = str_replace($search_array,$replace_array,$message); $search_array = array('[#listing_link#]','[#site_name_url#]','[#post_id#]','[#site_name#]','[#to_name#]','[#from_name#]','[#subject#]','[#client_name#]', '[#posted_date#]'); $replace_array = array($listingLink,$siteurl_link,$post_id,$sitefromEmailName,$toEmailName,$fromEmailName,$to_subject,$toEmailName, $posted_date); $subject = str_replace($search_array,$replace_array,$subject); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= "Reply-To: ".$fromEmail. "\r\n"; $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>' . "\r\n"; /** * Filter the client email to address. * * @since 1.4.0 * @package GeoDirectory_Payment_Manager * @param string $toEmail The email address the email is being sent to. * @param int $post_id The post id of the post the email is regarding. * @param string $message_type The type of email being sent. * @param string $extra Transaction details if available. */ $toEmail = apply_filters('geodir_payment_clientEmail_to',$toEmail,$post_id, $user_id, $message_type, $extra); /** * Filter the client email subject. * * @since 1.4.0 * @package GeoDirectory_Payment_Manager * @param string $subject The email subject. * @param int $post_id The post id of the post the email is regarding. * @param string $message_type The type of email being sent. * @param string $extra Transaction details if available. */ $subject = apply_filters('geodir_payment_clientEmail_subject',$subject,$post_id, $user_id, $message_type, $extra); /** * Filter the client email message. * * @since 1.4.0 * @package GeoDirectory_Payment_Manager * @param string $message The email message text. * @param int $post_id The post id of the post the email is regarding. * @param string $message_type The type of email being sent. * @param string $extra Transaction details if available. */ $message = apply_filters('geodir_payment_clientEmail_message',$message,$post_id, $user_id, $message_type, $extra); /** * Filter the client email headers. * * @since 1.4.0 * @package GeoDirectory_Payment_Manager * @param string $headers The email headers. * @param int $post_id The post id of the post the email is regarding. * @param string $message_type The type of email being sent. * @param string $extra Transaction details if available. */ $headers = apply_filters('geodir_payment_clientEmail_headers',$headers,$post_id, $user_id, $message_type, $extra); $sent = wp_mail($toEmail, $subject, $message, $headers); if( !$sent && function_exists( 'geodir_error_log' ) ) { if ( is_array( $toEmail ) ) { $toEmail = implode( ',', $toEmail ); } $log_message = sprintf( __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), $message_type, date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), $toEmail, $subject ); geodir_error_log( $log_message ); } // send bcc to admin for expired listing if ($message_type == 'expiration' && get_option('geodir_bcc_expire')) { $adminEmail = get_bloginfo('admin_email'); $subject .= ' ' . __('- ADMIN BCC COPY', 'geodir_payments'); $sent = wp_mail($adminEmail, $subject, $message, $headers); if( !$sent && function_exists( 'geodir_error_log' ) ) { if ( is_array( $adminEmail ) ) { $adminEmail = implode( ',', $adminEmail ); } $log_message = sprintf( __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), $message_type, date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), $adminEmail, $subject ); geodir_error_log( $log_message ); } } }