Stackoverflow gibi herhangi yeni yanıtlar $ email_address bildir

0 Cevap php

Ben Kayıtlı Kullanıcılar bir formu (başlık, kategori, giriş) oluşturulmuş, bir Wordpress blog sonrası sağlayan bir tema üzerinde çalışacak.

Soru nasıl "Yeni bir yanıt gönderdi olduğunda bana bildir" yeni bir onay kutusunu ekleyebilir mi? Ben bir işlev değil, bir eklenti gerekir.

İşte soru ilanı kolları fonksiyonudur:

fonksiyonu post_new_question ($ question_title, $ question_content, $ question_category) {

 $question_title_stripped = strip_tags($question_title);
 $question_content_stripped = strip_tags($question_content);

 $user = wp_get_current_user();

 global $wpdb;
 $gather_questions = "SELECT * FROM wp_posts WHERE post_author = '" . $user->ID . "'";
 $user_questions = $wpdb->get_results($gather_questions);

 if (isEmptyString($question_title_stripped)) return new WP_Error('no_title_entered', 'Enter a title for your quesion');
 if (isEmptyString($question_content_stripped)) return new WP_Error('no_content', 'Enter a breif description for your quesion');

 foreach ($user_questions as $user_question) {
  if ($user_question->post_author == $user->ID ) {
   if ($user_question->post_title == $question_title_stripped) {
    return new WP_Error('duplicate_user_question', 'You have already asked this exact question.');
   } else {}   
  } else {}
 }

 $question_author = $user->ID;

 $post = array(
   'ID' => '',
   'post_author' => $question_author, 
   'post_category' => array($question_category),
   'post_content' => $question_content_stripped, 
   'post_title' => $question_title_stripped,
   'post_status' => 'publish'
 );  

 $question_id = wp_insert_post($post); }

PS: wp_email fonksiyonunun kullanımı harika olurdu.

0 Cevap