/** * send_notification() * * Send the notification e-mails to the addresses defined in options */ function send_notification($topic_id = 0, $forum_id = 0, $anonymous_data = false, $topic_author = 0) { // Grab stuff we will be needing for the email $recipients = $this->get_recipients(); $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $topic_title = html_entity_decode(strip_tags(bbp_get_topic_title($topic_id)), ENT_NOQUOTES, 'UTF-8'); $topic_content = html_entity_decode(strip_tags(bbp_get_topic_content($topic_id)), ENT_NOQUOTES, 'UTF-8'); $topic_excerpt = html_entity_decode(strip_tags(bbp_get_topic_excerpt($topic_id, 100)), ENT_NOQUOTES, 'UTF-8'); $topic_author = bbp_get_topic_author($topic_id); $topic_url = bbp_get_topic_permalink($topic_id); // Get the template $email_template = get_option('ja_bbp_notification_email_template'); // Swap out the shortcodes with useful information :) $find = array('[topic-title]', '[topic-content]', '[topic-excerpt]', '[topic-author]', '[topic-url]'); $replace = array($topic_title, $topic_content, $topic_excerpt, $topic_author, $topic_url); $email_body = str_replace($find, $replace, $email_template); $email_subject = $blogname . __(' new topic', 'ja_bbp_notifications') . ' - ' . $topic_title; if (!empty($recipients)) { // Send email to each user foreach ($recipients as $recipient) { @wp_mail($recipient, $email_subject, $email_body); } } }
/** * Deprecated. Use bbp_topic_author_display_name() instead. * * Output the author of the topic. * * @since 2.0.0 bbPress (r2590) * * @deprecated 2.5.0 bbPress (r5119) * * @param int $topic_id Optional. Topic id * @uses bbp_get_topic_author() To get the topic author */ function bbp_topic_author($topic_id = 0) { echo bbp_get_topic_author($topic_id); }
/** * Custom function from bbp_get_author_link(), returns only author name * -------------------------------------------------------------------------------------------*/ function aq_get_author($post_id = 0) { // Confirmed topic if (bbp_is_topic($post_id)) { return bbp_get_topic_author($post_id); // Confirmed reply } elseif (bbp_is_reply($post_id)) { return bbp_get_reply_author($post_id); // Get the post author and proceed } else { $user_id = get_post_field('post_author', $post_id); } // Neither a reply nor a topic, so could be a revision if (!empty($post_id)) { // Assemble some link bits $anonymous = bbp_is_reply_anonymous($post_id); // Add links if not anonymous if (empty($anonymous) && bbp_user_has_profile($user_id)) { $author_link = get_the_author_meta('display_name', $user_id); // No links if anonymous } else { $author_link = join(' ', $author_links); } // No post so link is empty } else { $author_link = ''; } return $author_link; }
function bbp_tweet_new_reply($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author) { global $wpdb; $forum_settings_table = $wpdb->prefix . 'bbp_tweet_forum_settings'; $bbp_tweet_replies_results = $wpdb->get_results("SELECT bbp_tweet_forum_settings_replies FROM {$forum_settings_table} WHERE bbp_tweet_forum_settings_id = 1", ARRAY_A); $bbp_tweet_replies = $bbp_tweet_replies_results[0]['bbp_tweet_forum_settings_replies']; if ($bbp_tweet_replies == true) { $topic_title = html_entity_decode(strip_tags(bbp_get_topic_title($topic_id)), ENT_NOQUOTES, 'UTF-8'); $topic_author = bbp_get_topic_author($topic_id); $topic_url = bbp_get_topic_permalink($topic_id); $message = 'New Reply to ' . $topic_title . ' by ' . $topic_author . ' ' . $topic_url; $bbp_tweet_reply_tweeted = bbp_tweet_chirp($message); } }
/** * @since 1.4 */ private function _build_email($type, $post_id) { $email_subject = get_option("bbpress_notify_new{$type}_email_subject"); $email_body = get_option("bbpress_notify_new{$type}_email_body"); $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $excerpt_size = apply_filters('bpnns_excerpt_size', 100); // Replace shortcodes if ('topic' === $type) { $content = bbp_get_topic_content($post_id); $title = html_entity_decode(strip_tags(bbp_get_topic_title($post_id)), ENT_NOQUOTES, 'UTF-8'); $excerpt = html_entity_decode(strip_tags(bbp_get_topic_excerpt($post_id, $excerpt_size)), ENT_NOQUOTES, 'UTF-8'); $author = bbp_get_topic_author($post_id); $url = apply_filters('bbpnns_topic_url', bbp_get_topic_permalink($post_id), $post_id, $title); $forum = html_entity_decode(strip_tags(get_the_title(bbp_get_topic_forum_id($post_id))), ENT_NOQUOTES, 'UTF-8'); } elseif ('reply' === $type) { $content = bbp_get_reply_content($post_id); $title = html_entity_decode(strip_tags(bbp_get_reply_title($post_id)), ENT_NOQUOTES, 'UTF-8'); $excerpt = html_entity_decode(strip_tags(bbp_get_reply_excerpt($post_id, $excerpt_size)), ENT_NOQUOTES, 'UTF-8'); $author = bbp_get_reply_author($post_id); $url = apply_filters('bbpnns_reply_url', bbp_get_reply_permalink($post_id), $post_id, $title); $forum = html_entity_decode(strip_tags(get_the_title(bbp_get_reply_forum_id($post_id))), ENT_NOQUOTES, 'UTF-8'); } else { wp_die('Invalid type!'); } $content = preg_replace('/<br\\s*\\/?>/is', PHP_EOL, $content); $content = preg_replace('/(?:<\\/p>\\s*<p>)/ism', PHP_EOL . PHP_EOL, $content); $content = html_entity_decode(strip_tags($content), ENT_NOQUOTES, 'UTF-8'); $topic_reply = apply_filters('bbpnns_topic_reply', bbp_get_reply_url($post_id), $post_id, $title); $email_subject = str_replace('[blogname]', $blogname, $email_subject); $email_subject = str_replace("[{$type}-title]", $title, $email_subject); $email_subject = str_replace("[{$type}-content]", $content, $email_subject); $email_subject = str_replace("[{$type}-excerpt]", $excerpt, $email_subject); $email_subject = str_replace("[{$type}-author]", $author, $email_subject); $email_subject = str_replace("[{$type}-url]", $url, $email_subject); $email_subject = str_replace("[{$type}-replyurl]", $topic_reply, $email_subject); $email_subject = str_replace("[{$type}-forum]", $forum, $email_subject); $email_body = str_replace('[blogname]', $blogname, $email_body); $email_body = str_replace("[{$type}-title]", $title, $email_body); $email_body = str_replace("[{$type}-content]", $content, $email_body); $email_body = str_replace("[{$type}-excerpt]", $excerpt, $email_body); $email_body = str_replace("[{$type}-author]", $author, $email_body); $email_body = str_replace("[{$type}-url]", $url, $email_body); $email_body = str_replace("[{$type}-replyurl]", $topic_reply, $email_body); $email_body = str_replace("[{$type}-forum]", $forum, $email_body); /** * Allow subject and body modifications * @since 1.6.6 */ $email_subject = apply_filters('bbpnns_filter_email_subject_in_build', $email_subject, $type, $post_id); $email_body = apply_filters('bbpnns_filter_email_body_in_build', $email_body, $type, $post_id); return array($email_subject, $email_body); }
bbp_topic_permalink(); ?> " title="<?php bbp_topic_title(); ?> "><?php bbp_topic_title(); ?> </a> <?php do_action('bbp_theme_before_topic_started_by'); ?> <span class="bbp-topic-started-by"><?php printf(__(' by %1$s', 'bbpress'), bbp_get_topic_author(array('type' => 'name'))); ?> </span> <?php if (!bbp_is_single_forum() || bbp_get_topic_forum_id() != bbp_get_forum_id()) { ?> <?php do_action('bbp_theme_before_topic_started_in'); ?> <span class="bbp-topic-started-in"><?php printf(__('in <a href="%1$s">%2$s</a>', 'bbpress'), bbp_get_forum_permalink(bbp_get_topic_forum_id()), bbp_get_forum_title(bbp_get_topic_forum_id())); ?> </span>
function new_reply_notification($reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0, $is_edit = false, $reply_to = 0) { $admin_email = get_option('admin_email'); $user_id = (int) $reply_author_id; $reply_id = bbp_get_reply_id($reply_id); $topic_id = bbp_get_topic_id($topic_id); $forum_id = bbp_get_forum_id($forum_id); $email_subject = get_option('bbpress_notify_newreply_email_subject'); $email_body = get_option('bbpress_notify_newreply_email_body'); $blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $topic_title = html_entity_decode(strip_tags(bbp_get_topic_title($topic_id)), ENT_NOQUOTES, 'UTF-8'); $topic_content = html_entity_decode(strip_tags(bbp_get_topic_content($topic_id)), ENT_NOQUOTES, 'UTF-8'); $topic_excerpt = html_entity_decode(strip_tags(bbp_get_topic_excerpt($topic_id, 100)), ENT_NOQUOTES, 'UTF-8'); $topic_author = bbp_get_topic_author($topic_id); $topic_url = bbp_get_topic_permalink($topic_id); $topic_reply = bbp_get_reply_url($topic_id); $reply_url = bbp_get_reply_url($reply_id); $reply_content = get_post_field('post_content', $reply_id, 'raw'); $reply_author = bbp_get_topic_author($user_id); $email_subject = $blog_name . " New Reply Alert: " . $topic_title; $email_body = $blog_name . ": {$topic_title}\n\r"; $email_body .= $reply_content; $email_body .= "\n\r--------------------------------\n\r"; $email_body .= "Reply Url: " . $reply_url . "\n\rAuthor: {$reply_author}" . "\n\rYou can reply at: {$reply_url}"; @wp_mail($admin_email, $email_subject, $email_body); }