Поддержка Проблемы и решения Уведомление о черновиках

  • Решено ws256

    (@ws256)


    Как включить уведомление, что кто то добавил новую запись и она ждет рассмотрения админа на email?

Просмотр 2 ответов — с 1 по 2 (всего 2)
  • Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Возможно, будет полезен один из плагинов:
    http://wordpress.org/extend/plugins/wp-status-notifier/
    http://wordpress.org/extend/plugins/pending-posts-indicator/

    Автор ws256

    (@ws256)

    wp-status-notifier — то что нужно, но он не работает с wp 2.8
    Второй это не совсем то что нужно.

    Что изменилось в версии 2.8 в отправке писем? Может получится исправить плагин. Вот собственно код:

    // Hook for post status changes
    add_filter('transition_post_status', 'notify_status',10,3);
    function notify_status($new_status, $old_status, $post) {
        global $current_user;
    	$contributor = get_userdata($post->post_author);
        if ($old_status != 'pending' && $new_status == 'pending') {
          $emails=get_option('notificationemails');
          if(strlen($emails)) {
            $subject='['.get_option('blogname').'] "'.$post->post_title.'" pending review';
            $message="A new post by {$contributor->display_name} is pending review.\n\n";
            $message.="Author   : {$contributor->user_login} <{$contributor->user_email}> (IP: {$_SERVER['REMOTE_ADDR']})\n";
            $message.="Title    : {$post->post_title}\n";
    		$category = get_the_category($post->ID);
    		if(isset($category[0]))
    			$message.="Category : {$category[0]->name}\n";;
            $message.="Review it: ".get_option('siteurl')."/wp-admin/post.php?action=edit&post={$post->ID}\n\n\n";
            $message.="Powered by: WP Status Notifier <http://wordpresssupplies.com/wordpress-plugins/status-notifier/>";
            wp_mail( $emails, $subject, $message);
          }
    	} elseif ($old_status == 'pending' && $new_status == 'publish' && $current_user->ID!=$contributor->ID) {
          if(get_option('approvednotification')=='yes') {
            $subject='['.get_option('blogname').'] "'.$post->post_title.'" approved';
            $message="{$contributor->display_name},\n\nYour post has been approved and published at ".get_permalink($post->ID)." .\n\n";
            $message.="By {$current_user->display_name} <{$current_user->user_email}>\n\n\n";
            $message.="Powered by: WP Status Notifier <http://wordpresssupplies.com/wordpress-plugins/status-notifier/>";
            wp_mail( $contributor->user_email, $subject, $message);
          }
    	} elseif ($old_status == 'pending' && $new_status == 'draft' && $current_user->ID!=$contributor->ID) {
          if(get_option('declinednotification')=='yes') {
            $subject='['.get_option('blogname').'] "'.$post->post_title.'" declined';
            $message="{$contributor->display_name},\n\nYour post has not been approved. You can edit the post at ".get_option('siteurl')."/wp-admin/post.php?action=edit&post={$post->ID} .\n\n";
            $message.="By {$current_user->display_name} <{$current_user->user_email}>\n\n\n";
            $message.="Powered by: WP Status Notifier <http://wordpresssupplies.com/wordpress-plugins/status-notifier/>";
            wp_mail( $contributor->user_email, $subject, $message);
          }
    	}
    }

    На сайте плагина я нашел вот такой коммент:

    Keith
    Posted June 19, 2009 at 9:28 am | Permalink

    FYI, this plugin needs updating for WP 2.8. Ever since upgrading, it will email anytime a pending post is changed and saved, not just the first time it’s saved.

    This change seems to do the trick:

    94c94
    < if ($new_status == ‘pending’) {
    —
    > if ($new_status == ‘pending’ && $old_status != ‘pending’) {

    После которого автор написал что баг пофиксил, но мне все равно не приходят уведомления.

Просмотр 2 ответов — с 1 по 2 (всего 2)
  • Тема «Уведомление о черновиках» закрыта для новых ответов.