?>
">

	<fieldset>
		<legend><?php 
_e('Edit Reply', 'message-board');
?>
</legend>

		<p>
			<label for="mb_reply_content" name="mb_reply_content"><?php 
_e('Please put code in between <code>`backtick`</code> characters.', 'message-board');
?>
</label>
			<textarea id="mb_reply_content" name="mb_reply_content"><?php 
echo format_to_edit(mb_code_trick_reverse(mb_get_reply_content(mb_get_reply_id(), 'raw')));
?>
</textarea>
		</p>

		<p>
			<input type="submit" value="<?php 
esc_attr_e('Submit', 'message-board');
?>
" />
		</p>

		<p>
			<label>
				<input type="checkbox" name="mb_topic_subscribe" value="<?php 
echo mb_is_user_subscribed_topic(mb_get_reply_author_id(), mb_get_reply_topic_id()) ? 1 : 0;
function mb_notify_topic_subscribers($topic_id, $post)
{
    $reply_id = mb_get_reply_id($post->ID);
    $topic_id = mb_get_topic_id($topic_id);
    $forum_id = mb_get_topic_forum_id($topic_id);
    $forum_subscribers = $forum_id ? mb_get_forum_subscribers($forum_id) : array();
    $topic_subscribers = $topic_id ? mb_get_topic_subscribers($topic_id) : array();
    /* Remove users who are already subscribed to the topic's forum or who wrote the post. */
    $subscribers = array_diff($topic_subscribers, $forum_subscribers, array($post->post_author));
    /* If there are no subscribers, bail. */
    if (empty($subscribers)) {
        return false;
    }
    /* Get needed topic data. */
    $topic_title = strip_tags(mb_get_topic_title($topic_id));
    /* Get needed reply data. */
    $reply_url = mb_get_reply_url($reply_id);
    $reply_author = mb_get_reply_author($reply_id);
    $reply_author_id = mb_get_reply_author_id($reply_id);
    $reply_content = mb_get_reply_content($reply_id, 'raw');
    /* Filter the reply content for email. */
    $reply_content = apply_filters('mb_pre_email_reply_content', $reply_content, $reply_id);
    /* Build the email message. */
    $message = sprintf(__('%1$s replied: %4$s%2$s %4$sPost Link: %3$s %4$sYou are receiving this email because you subscribed to a forum topic. Log in and visit the topic to unsubscribe from these emails.', 'message-board'), $reply_author, $reply_content, $reply_url, "\n\n");
    /* Get the site name and domain. */
    $site_name = esc_html(strip_tags(get_option('blogname')));
    $site_domain = untrailingslashit(str_replace(array('http://', 'https://'), '', home_url()));
    /* Who's the message from? */
    $from = '<noreply@' . $site_domain . '>';
    /* Translators: Email subject. 1 is the blog name. 2 is the topic title. */
    $subject = sprintf(esc_attr__('[$1%s] $2%s', 'message-board'), $site_name, $topic_title);
    /* Build the email headers. */
    $headers = array();
    $headers[] = sprintf('From: %s %s', $site_name, $from);
    foreach ($subscribers as $user_id) {
        $headers[] = 'Bcc: ' . get_userdata($user_id)->user_email;
    }
    /* Send the email. */
    return wp_mail($from, $subject, $message, $headers);
}
Example #3
0
/**
 * Topic content editor.
 *
 * @since  1.0.0
 * @access public
 * @return void
 */
function mb_reply_editor()
{
    add_action('wp_enqueue_editor', 'mb_dequeue_editor_scripts');
    add_filter('the_editor', 'mb_reply_the_editor_filter');
    wp_editor(format_to_edit(mb_code_trick_reverse(mb_get_reply_content(mb_get_reply_id(), 'raw'))), 'mb_reply_content', array('tinymce' => false, 'media_buttons' => false, 'editor_height' => 250));
}