Ejemplo n.º 1
0
        $type = $post->post_type === $this->bbpress_topic_post_type ? 'topic' : 'reply';
        if (!isset($_POST["bbpress_send_{$type}_notification_nonce"]) || !wp_verify_nonce($_POST["bbpress_send_{$type}_notification_nonce"], "bbpress_send_{$type}_notification_nonce")) {
            return;
        }
        // Still here, so we can notify
        if ($post->post_type === $this->bbpress_topic_post_type) {
            return $this->notify_new_topic($post_id);
        } else {
            return $this->notify_new_reply($post_id);
        }
    }
    /**
     * @since 1.5.4
     */
    public static function missing_bbpress_notice()
    {
        ?>
		<div class="error">
			<p>
				<?php 
        _e('<strong>bbPress Notify (No-Spam)</strong> could not find an active bbPress plugin. It will not load until bbPress is installed and active.');
        ?>
			</p>
		</div>
		<?php 
    }
}
/* Kick off the class */
bbPress_Notify_NoSpam::bootstrap();
/* End of file bbpress-notify-nospam.php */
/* Location: bbpress-notify-nospam/bbpress-notify-nospam.php */
Ejemplo n.º 2
0
 public function test_notify_on_save()
 {
     $bbpnns = bbPress_Notify_NoSpam::bootstrap();
     $bbpnns->set_post_types();
     $author_id = $this->factory->user->create(array('role' => 'administrator'));
     wp_set_current_user($author_id);
     $nonce_id = wp_create_nonce('bbpress_send_topic_notification_nonce');
     $_POST = array('bbpress_notify_send_notification' => true, 'bbpress_send_topic_notification_nonce' => $nonce_id);
     $post = array('post_content' => 'Test content', 'post_name' => 'Test name', 'post_status' => 'publish', 'post_author' => $author_id, 'post_type' => 'topic');
     $topic_id = wp_insert_post($post);
     $post = get_post($topic_id);
     $result = $bbpnns->notify_on_save($topic_id, $post);
     $this->assertFalse(empty($result));
 }