/** * Alerts user's friends when they write a new forum topic * * @Param: the id of the topic * * @author: Joe Hoyle * @version 1.0 **/ function nm_alert_user_wrote_forum_topic($topicID) { $userInfo = wp_get_current_user(); $friendList = new userFriends(); $friends = $friendList->get_friends($userInfo->ID); if (is_array($friends)) { $friends = nm_array_invert($friends); $alert = array(); $alert['content'] = '<a href="' . getProfileLink($userInfo->ID) . '" title="View ' . nm_user_public_name($userInfo->ID) . 's profile">' . nm_user_public_name($userInfo->ID) . '</a> has written a new forum topic: <a href="' . get_topic_link($topicID) . '" title="View ' . get_topic_title($topicID) . '">' . get_topic_title($topicID) . '</a>.'; $alert['type'] = 'forum'; nm_add_alert($friends, $alert); } return $topicID; }
/** * Plugin Name: Post Notification * Plugin Description: Sends an Notification email if there's a new post to an favorite topic. (Modified Version 1.4 with Post Content included in E-Mail) * Author: Thomas Klaiber * Author URI: http://thomasklaiber.com/ * Plugin URI: http://thomasklaiber.com/bbpress/post-notification/ * Version: 1.4 */ function notification_new_post($post_id = 0) { global $bbdb, $bb_table_prefix, $topic_id, $bb_current_user; $all_users = notification_select_all_users(); foreach ($all_users as $userdata) { if (notification_is_activated($userdata->ID)) { if (is_user_favorite($userdata->ID, $topic_id)) { //$topic = get_topic($topic_id); $message = __("Hello,\n\nA new post on \"%1\$s\" has been added by %2\$s at DHAnswers. \n\nMessage:\n\n%3\$s \n\n%4\$s "); mail($userdata->user_email, '[DHAnswers] New Post for Favorite Question', sprintf($message, get_topic_title($topic_id), get_user_name($bb_current_user->ID), strip_tags(get_post_text($post_id)), get_topic_link($topic_id)), 'From: ' . bb_get_option('name') . ' <' . bb_get_option('from_email') . '>'); } } } }
function tweet_new_topic($topic_id, $topic_title) { global $bb_post; if ($bb_post) { // post already exists } else { $t_title = get_topic_title($topic_id); $t_link = get_topic_link($topic_id); //shorten URL exec("curl http://is.gd/api.php?longurl=" . $t_link, $shorturl); $message = "New ? at DHAnswers: " . $t_title . " ({$shorturl['0']})"; if (strlen($message) > 140) { $message = substr($message, 0, 139) . '…'; } // New Tweet using Twitter OAuth // TODO: check return status bb_post_tweet($message); } return $topic_title; }
function get_socialit() { global $socialit_plugopts, $bbdb, $public_tags, $socialit_is_mobile, $socialit_is_bot; $dont_get_si = false; $topic = get_topic(get_topic_id()); if (class_exists('Support_Forum') && $topic) { //compatibility with Support Forum plugin for bbPress $support_forum = new Support_Forum(); if ($support_forum->isActive() && in_array($topic->forum_id, $support_forum->enabled)) { if ($socialit_plugopts['sfpnonres'] == "no" && $support_forum->getTopicStatus() == "no" || $socialit_plugopts['sfpres'] == "no" && $support_forum->getTopicStatus() == "yes" || $socialit_plugopts['sfpnonsup'] == "no" && $support_forum->getTopicStatus() == "mu") { $dont_get_si = true; } } } if ($socialit_plugopts['mobile-hide'] == 'yes' && ($socialit_is_mobile || $socialit_is_bot)) { $dont_get_si = true; } if (bb_is_topic() && bb_get_topicmeta($topic->topic_id, 'hide_socialit') == true) { $dont_get_si = true; } if (!$dont_get_si) { if (bb_is_topic()) { $perms = urlencode(get_topic_link()); $title = get_topic_title(); $feedperms = strtolower($perms); // Grab post tags for Twittley tags. If there aren't any, use default tags set in plugin options page $get_tags = bb_get_topic_tags(get_topic_id()); if ($get_tags) { foreach ($get_tags as $tag) { $keywords = $keywords . $tag->name . ','; } } $topic_id_ft = get_topic_id(); //topic id for getting text $first_post = (int) $bbdb->get_var("SELECT post_id FROM {$bbdb->posts} WHERE topic_id = {$topic_id_ft} ORDER BY post_id ASC LIMIT 1"); $socialit_content = get_post_text($first_post); } else { $perms = socialit_get_current_url(); $title = bb_get_title(); $feedperms = strtolower($perms); $socialit_content = bb_get_option('description'); } if (strlen($title) >= 80) { $short_title = urlencode(substr($title, 0, 80) . "[..]"); } else { $short_title = urlencode($title); } $title = urlencode($title); $site_name = bb_get_option('name'); $socialit_content = urlencode(substr(strip_tags(strip_shortcodes($socialit_content)), 0, 300)); $socialit_content = socialit_change_plus_apos($socialit_content); $mail_subject = socialit_change_plus_apos($title); $post_summary = stripslashes($socialit_content); if (!empty($keywords)) { $d_tags = $keywords; } else { $d_tags = $socialit_plugopts['defaulttags']; } $site_name = bb_get_option('name'); $y_cat = $socialit_plugopts['ybuzzcat']; $y_med = $socialit_plugopts['ybuzzmed']; $t_cat = $socialit_plugopts['twittcat']; $short_url = socialit_get_fetch_url(); $current_rss_link = socialit_get_current_rss_link(); // Temporary fix for bug that breaks layout when using NextGen Gallery plugin if (strpos($post_summary, '[') || strpos($post_summary, ']')) { $post_summary = ""; } if (strpos($socialit_content, '[') || strpos($socialit_content, ']')) { $socialit_content = ""; } // select the background if (!isset($socialit_plugopts['bgimg-yes'])) { $bgchosen = ''; } elseif ($socialit_plugopts['bgimg'] == 'sexy') { $bgchosen = ' social-it-bg-sexy'; } elseif ($socialit_plugopts['bgimg'] == 'caring') { $bgchosen = ' social-it-bg-caring'; } elseif ($socialit_plugopts['bgimg'] == 'care-old') { $bgchosen = ' social-it-bg-caring-old'; } elseif ($socialit_plugopts['bgimg'] == 'love') { $bgchosen = ' social-it-bg-love'; } elseif ($socialit_plugopts['bgimg'] == 'wealth') { $bgchosen = ' social-it-bg-wealth'; } elseif ($socialit_plugopts['bgimg'] == 'enjoy') { $bgchosen = ' social-it-bg-enjoy'; } $style = $socialit_plugopts['autocenter'] ? '' : ' style="' . __($socialit_plugopts['xtrastyle']) . '"'; $isfeed = bb_is_feed(); if ($isfeed) { $style = ''; } // do not add inline styles to the feed. $expand = $socialit_plugopts['expand'] ? ' social-it-expand' : ''; if ($socialit_plugopts['autocenter'] == 1) { $autocenter = ' social-it-center'; } elseif ($socialit_plugopts['autocenter'] == 2) { $autocenter = ' social-it-spaced'; } else { $autocenter = ''; } //write the menu $socials = "\n\n" . '<!-- Start Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n" . '<div class="social-it' . $expand . $autocenter . $bgchosen . '"' . $style . '><ul class="socials">'; foreach ($socialit_plugopts['bookmark'] as $name) { if ($name == 'socialit-twitter') { $socials .= bookmark_list_item($name, array('post_by' => !empty($socialit_plugopts['twittid']) ? "(via+@" . $socialit_plugopts['twittid'] . ")" : '', 'short_title' => $short_title, 'fetch_url' => $short_url)); } elseif ($name == 'socialit-mail') { $socials .= bookmark_list_item($name, array('title' => $mail_subject, 'post_summary' => $post_summary, 'permalink' => $perms)); } elseif ($name == 'socialit-diigo') { $socials .= bookmark_list_item($name, array('socialit_teaser' => $socialit_content, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'socialit-linkedin') { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'site_name' => $site_name, 'permalink' => $perms, 'title' => $title)); } elseif ($name == 'socialit-comfeed') { $socials .= bookmark_list_item($name, array('permalink' => $current_rss_link)); } elseif ($name == 'socialit-yahoobuzz') { $socials .= bookmark_list_item($name, array('permalink' => $perms, 'title' => $title, 'yahooteaser' => $socialit_content, 'yahoocategory' => $y_cat, 'yahoomediatype' => $y_med)); } elseif ($name == 'socialit-twittley') { $socials .= bookmark_list_item($name, array('permalink' => urlencode($perms), 'title' => $title, 'post_summary' => $post_summary, 'twitt_cat' => $t_cat, 'default_tags' => $d_tags)); } else { $socials .= bookmark_list_item($name, array('post_summary' => $post_summary, 'permalink' => $perms, 'title' => $title)); } } $socials .= '</ul><div style="clear:both;"></div></div><!-- End Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n\n"; return $socials; } }
function topic_title($id = 0) { echo apply_filters('topic_title', get_topic_title($id), get_topic_id($id)); }
} else { printf(__('<a href="%1$s">Post</a> on <a href="%2$s">%3$s</a> by %4$s'), esc_attr(add_query_arg('view', 'all', get_post_link())), get_topic_link($bb_post->topic_id), get_topic_title($bb_post->topic_id), get_post_author()); } ?> </li> <?php } elseif ('topic' == $object['type']) { global $topic; $topic = $object['data']; ?> <li> <?php if ($topic->topic_poster) { printf(__('Topic titled <a href="%1$s">%2$s</a> started by <a href="%3$s">%4$s</a>'), esc_attr(add_query_arg('view', 'all', get_topic_link())), get_topic_title($topic->topic_id), get_user_profile_link($topic->topic_poster), get_topic_author($topic->topic_id)); } else { printf(__('Topic titled <a href="%1$s">%2$s</a> started by %3$s'), esc_attr(add_query_arg('view', 'all', get_topic_link())), get_topic_title($topic->topic_id), get_topic_author($topic->topic_id)); } ?> </li> <?php } } remove_filter('get_topic_where', 'bb_no_where'); ?> </ul> <?php } else { ?> <p> <?php _e('No moderated posts or topics… you must have very well behaved members.');
$posts = array(); foreach ($topics as $topic) { $posts[] = bb_get_first_post($topic->topic_id); } $title = esc_html(sprintf(__('%1$s » View: %2$s'), bb_get_option('name'), $bb_views[$feed_id]['title'])); $link = get_view_link($feed_id); $link_self = bb_get_view_rss_link($feed_id); break; case 'topic': if (!($topic = get_topic($feed_id))) { die; } if (!($posts = get_thread($feed_id, 0, 1))) { die; } $title = esc_html(sprintf(__('%1$s » Topic: %2$s'), bb_get_option('name'), get_topic_title())); $link = get_topic_link($feed_id); $link_self = get_topic_rss_link($feed_id); break; case 'profile': if (bb_get_option('mod_rewrite') === 'slugs') { $user = bb_get_user_by_nicename($feed_id); } else { $user = bb_get_user($feed_id); } if (!$user) { die; } if (!($posts = get_user_favorites($user->ID))) { die; }
?> <?php } ?> <?php if ($topic_title) { ?> <p role="main"> <label for="topic"><?php _e('Topic:'); ?> <br /> <input name="topic" type="text" id="topic" size="50" maxlength="80" tabindex="31" value="<?php echo esc_attr(get_topic_title()); ?> " /> </label> </p> <?php } do_action('edit_form_pre_post'); ?> <p> <label for="post_content"><?php _e('Post:'); ?> <br /> <textarea name="post_content" cols="50" rows="8" tabindex="32" id="post_content"><?php
function bb_attachments($post_id = 0) { global $bb_attachments_on_page; if (isset($bb_attachments_on_page)) { return; } else { $bb_attachments_on_page = true; } // only insert once per page -> pre 0.9.0.2 if ($post_id == 0) { if (isset($_GET['bb_attachments'])) { $post_id = intval($_GET['bb_attachments']); } else { global $bb_post; $post_id = $bb_post->post_id; } } if ($post_id) { $bb_post = bb_get_post($post_id); if (bb_attachments_location() != 'edit.php') { echo "<h3 class='bbcrumb'><a href='" . bb_get_option('uri') . "'>" . bb_get_option('name') . "</a> » <a href='" . get_topic_link() . "'>" . get_topic_title($bb_post->topic_id) . "</a> » <a href='" . get_post_link($bb_post->post_id) . "'>" . __('Post') . " {$bb_post->post_position}</a> » " . __('Attachments') . "</h3>"; } echo "<div class='indent'>"; if (isset($_FILES['bb_attachments'])) { bb_attachments_process_post(intval($_GET['bb_attachments']), 1); echo "<br />"; } echo bb_attachments_post_attachments($post_id); echo "<br />"; bb_attachments_upload_form($post_id); echo "<br />"; echo "</div>"; } }
protected function _get_topic() { return get_topic_title($this->_get_topic_id()); }
<?php if ($topic_title) { ?> <p> <label><?php _e('Topic:'); ?> <br /> <input name="topic" type="text" id="topic" size="50" maxlength="80" value="<?php echo attribute_escape(get_topic_title()); ?> " /> </label> </p> <?php } ?> <p><label><?php _e('Post:'); ?> <br /> <textarea name="post_content" cols="50" rows="8" id="post_content"><?php echo apply_filters('edit_text', get_post_text()); ?> </textarea> </label> </p> <p class="submit"> <input type="submit" name="Submit" value="<?php
global $bb_post; $bb_post = $object['data']; ?> <li> <?php printf(__('<a href="%1$s">Post</a> on <a href="%2$s">%3$s</a> by <a href="%4$s">%5$s</a>'), esc_attr(add_query_arg('view', 'all', get_post_link())), get_topic_link($bb_post->topic_id), get_topic_title($bb_post->topic_id), get_user_profile_link($bb_post->poster_id), get_post_author()); ?> </li> <?php } elseif ('topic' == $object['type']) { global $topic; $topic = $object['data']; ?> <li> <?php printf(__('Topic titled <a href="%1$s">%2$s</a> started by <a href="%3$s">%4$s</a>'), esc_attr(add_query_arg('view', 'all', get_topic_link())), get_topic_title(), get_user_profile_link($topic->topic_poster), get_topic_author()); ?> </li> <?php } } remove_filter('get_topic_where', 'bb_no_where'); ?> </ul> <?php } else { ?> <p> <?php _e('No moderated posts or topics… you must have very well behaved members.'); ?>
?> </h4> <ol> <?php foreach ($relevant as $topic) { $bb_post = bb_get_first_post($topic); ?> <li<?php alt_class('relevant'); ?> > <a class="result" href="<?php post_link(); ?> "><?php echo bb_show_topic_context($q, get_topic_title()); ?> </a> <span class="freshness"><?php printf(__('By <a href="%1$s">%2$s</a> on %3$s'), get_user_profile_link($topic->topic_poster), get_topic_author(), bb_datetime_format_i18n(get_topic_start_time(array('format' => 'timestamp')))); ?> </span> <p><?php echo bb_show_context($q, $bb_post->post_text); ?> </p> </li> <?php } ?> </ol>
$fromUser = $_SESSION["authid"]; } else { $fromUser = 0; } $tpl->set("NAME", get_n($fromUser)); $tpl->set("BEITRAG", get_topic_title($topicId)); $tpl->set("PID", $postId); $tpl->set("TID", $topicId); sendpm($fromUser, 1, $tpl->get("pm_betreff"), $tpl->get("pm_content"), 0); // weiterleitung wd("index.php?forum-showposts-" . $topicId, $tpl->get("weiterleitung")); } else { // An die Mods schicken foreach ($getmodids as $userid) { if (isset($_SESSION["authid"])) { $fromUser = $_SESSION["authid"]; } else { $fromUser = 0; } $tpl->set("NAME", get_n($fromUser)); $tpl->set("BEITRAG", get_topic_title($topicId)); $tpl->set("PID", $postId); $tpl->set("TID", $topicId); sendpm($fromUser, $userid, $tpl->get("pm_betreff"), $tpl->get("pm_content"), 0); // weiterleitung wd("index.php?forum-showposts-" . $topicId, $tpl->get("weiterleitung")); } } } } $design->footer();
bb_die('Could not update posts table'); } //bot if (isset($_POST['after_split_to_old'])) { insert_post('after_split_to_old', $topic_id, $forum_id, '', $new_topic_id, trim($_POST['subject'])); } if (isset($_POST['after_split_to_new'])) { insert_post('after_split_to_new', $new_topic_id, $new_forum_id, $forum_id, $new_topic_id, '', $topic_id); } sync('topic', array($topic_id, $new_topic_id)); sync('forum', array($forum_id, $new_forum_id)); //bot $message = $lang['TOPIC_SPLIT'] . '<br /><br /><a href="' . "viewtopic.php?" . POST_TOPIC_URL . "={$topic_id}&sid=" . $userdata['session_id'] . '">' . $lang['TOPIC_SPLIT_OLD'] . '</a>'; $message .= ' :: <a href="' . "viewtopic.php?" . POST_TOPIC_URL . "={$new_topic_id}&sid=" . $userdata['session_id'] . '">' . $lang['TOPIC_SPLIT_NEW'] . '</a>'; // Log action $log_action->mod('mod_topic_split', array('forum_id' => $forum_id, 'forum_id_new' => $new_forum_id, 'topic_id' => $topic_id, 'topic_title' => get_topic_title($topic_id), 'topic_id_new' => $new_topic_id, 'topic_title_new' => htmlCHR($_POST['subject']))); bb_die($message); } } elseif ($post_id_sql && $delete_posts) { if (!$is_auth['auth_delete']) { bb_die(sprintf($lang['SORRY_AUTH_DELETE'], $is_auth['auth_delete_type'])); } // Delete posts $result = post_delete(explode(',', $post_id_sql)); $msg = $result ? $lang['DELETE_POSTS_SUCCESFULLY'] : 'No posts were removed'; bb_die(return_msg_mcp($msg)); } else { $sql = "SELECT u.username, p.*, pt.post_text, p.post_username\n\t\t\t\tFROM " . BB_POSTS . " p, " . BB_USERS . " u, " . BB_POSTS_TEXT . " pt\n\t\t\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t\t\tAND p.poster_id = u.user_id\n\t\t\t\t\tAND p.post_id = pt.post_id\n\t\t\t\tORDER BY p.post_time ASC"; if (!($result = DB()->sql_query($sql))) { bb_die('Could not get topic / post information'); }
function mass_edit_list_posts() { global $bb_posts, $bb_post; if ($bb_posts) { foreach ($bb_posts as $bb_post) { ?> <li<?php alt_class('post'); ?> > <div class="threadauthor"> <p><strong><?php poster_id_link(); ?> </strong><br /> <small><?php poster_id_type(); ?> </small></p> </div> <div class="threadpost"> <div class="post"><?php post_text(); ?> </div> <div class="poststuff"> <?php printf(__('Posted: %1$s in <a href="%2$s">%3$s</a>'), bb_get_post_time(), get_topic_link($bb_post->topic_id), get_topic_title($bb_post->topic_id)); ?> IP: <?php post_ip_link(); ?> <?php post_edit_link(); ?> <?php post_delete_link(); ?> </div> </div> </li><?php } } }