versu5k
Forum Replies Created
Viewing 1 replies (of 1 total)
-
I had to write the code myself
Code should work for everyone
Correct me if I was wrong somewhereYou should add it to function.php of the template.
And Ultimate WP Mail plugin should be installed too$notifyUser = true; function emailNotify(){ global $wpdb; //Get an email address for current UFAQ post $answer_post_id = get_the_ID(); $sql_mail = "SELECT m.meta_value as email FROM wp_postmeta as m, wp_posts as p WHERE m.post_id = %s and m.meta_key = 'EWD_UFAQ_Post_Author_Email' and m.post_id = p.id"; $userMail = $wpdb->get_var( $wpdb->prepare( $sql_mail, $answer_post_id ) ); //Email template ID (Works only with "Ultimate WP Mail" plugin) $emailTemplate = '1323'; if ($userMail != null) { if (function_exists('EWD_URP_Send_Email_To_Non_User')) { $Params = array( 'Email_ID' => $emailTemplate, 'Email_Address' => $userMail, 'post_id' => $answer_post_id ); EWD_URP_Send_Email_To_Non_User($Params); /* header("Location: http://example.com/" . $userMail . ""); die();*/ } } } //Call emailNotify() function on publish ufaq post if ($notifyUser) {add_action('publish_ufaq', 'emailNotify');};
Viewing 1 replies (of 1 total)