Changeset 289
- Timestamp:
- 03/12/07 11:47:31 (2 years ago)
- Files:
-
- bbpress-latest-discussion-for-wp/trunk/BBpress.php (modified) (8 diffs)
- bbpress-latest-discussion-for-wp/trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bbpress-latest-discussion-for-wp/trunk/BBpress.php
r288 r289 5 5 Description: Put bbpress Latest Discussions on your wp page. 6 6 Author: Atsutane Shirane 7 Version: 0.7. 17 Version: 0.7.2 8 8 Author URI: http://www.atsutane.net/ 9 9 */ 10 11 ### BBpress Latest Discussions Version Number 12 $BbLD_version = '0.7.2'; 10 13 11 14 if (!defined('ABSPATH')) die("Aren't you supposed to come here via WP-Admin?"); … … 19 22 ### Function: BBpress Latest Discussions Option 20 23 function wp_bb_option() { 21 global $wpdb ;24 global $wpdb,$BbLD_version; 22 25 $ori_url = $_SERVER['REQUEST_URI']; 23 26 if ($_POST['wpbb_save']){ … … 36 39 } 37 40 elseif (get_option('wpbb_path') == FALSE) { 38 $bbpath = '/bbpress'; // Adjust the path to suit your bbpress location. Example: '/forums'41 $bbpath = '/bbpress'; // Adjust the path to suit your bbpress location. Example: '/forums' 39 42 $wpbburl = get_settings('home') . $bbpath; 40 43 update_option('wpbb_path', $wpbburl); … … 76 79 <strong><?php _e('Plugin URI:'); ?></strong> <a href="http://www.atsutane.net/2006/11/bbpress-latest-discussion-for-wordpress/">http://www.atsutane.net/2006/11/bbpress-latest-discussion-for-wordpress/</a><br /> 77 80 <strong><?php _e('Author:'); ?></strong> <a href="http://www.atsutane.net/">Atsutane Shirane</a><br /> 78 <strong><?php _e('Version:'); ?></strong> 0.7.1</p>81 <strong><?php _e('Version:'); ?></strong> <?php echo $BbLD_version; ?></p> 79 82 <p><strong><?php _e('ToDo List:'); ?></strong></p> 80 83 <ul> 81 <li><?php _e('Add option to exclude some forum.'); ?> </li>84 <li><?php _e('Add option to exclude some forum.'); ?> <a href="http://www.atsutane.net/bbpress/topic/4"><?php _e('Discuss here.'); ?></a></li> 82 85 </ul> 83 86 <p><?php _e('If you have any suggestion or feedback. Feel free to post it'); ?> <a href="http://www.atsutane.net/2006/11/bbpress-latest-discussion-for-wordpress/"><?php _e('here'); ?></a>.</p> … … 140 143 global $table_prefix,$wpdb; 141 144 $forum_slimit = get_option('wpbb_limit'); 142 $bbpress_table = get_option('wpbb_bbprefix') . "topics";143 $wordpress_table = $table_prefix . "users";144 145 if (get_option('wpbb_exdb')) { 145 146 $exbbdb = new wpdb(get_option('wpbb_dbuser'), get_option('wpbb_dbpass'), get_option('wpbb_dbname'), get_option('wpbb_dbhost')); 146 $bbtopic = $exbbdb->get_results("SELECT * FROM $bbpress_tableWHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit");147 $bbtopic = $exbbdb->get_results("SELECT * FROM ".get_option('wpbb_bbprefix')."topics WHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit"); 147 148 } 148 149 else { 149 $bbtopic = $wpdb->get_results("SELECT * FROM $bbpress_tableWHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit");150 $bbtopic = $wpdb->get_results("SELECT * FROM ".get_option('wpbb_bbprefix')."topics WHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit"); 150 151 } 151 152 if ($bbtopic) { … … 172 173 echo '<td class="num">' . __("$bbtopic->topic_posts") . '</td>'; 173 174 if (get_option('wpbb_intergrated')) { 174 $wpuid = $wpdb->get_row("SELECT * FROM $wordpress_tableWHERE user_login = '$bbtopic->topic_last_poster_name'");175 $wpuid = $wpdb->get_row("SELECT * FROM ".$table_prefix."users WHERE user_login = '$bbtopic->topic_last_poster_name'"); 175 176 if ($wpuid) { 176 177 $user_forum_data = "$bbtopic->topic_last_poster_name"; … … 195 196 function wp_bb_get_discuss_sidebar() { 196 197 global $table_prefix,$wpdb; 197 $bbpress_table = get_option('wpbb_bbprefix') . "topics";198 $wordpress_table = $table_prefix . "users";199 198 $forum_slimit = get_option('wpbb_limit'); 200 199 if (get_option('wpbb_exdb')) { 201 200 $exbbdb = new wpdb(get_option('wpbb_dbuser'), get_option('wpbb_dbpass'), get_option('wpbb_dbname'), get_option('wpbb_dbhost')); 202 $bbtopic = $exbbdb->get_results("SELECT * FROM $bbpress_tableWHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit");201 $bbtopic = $exbbdb->get_results("SELECT * FROM ".get_option('wpbb_bbprefix')."topics WHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit"); 203 202 } 204 203 else { 205 $bbtopic = $wpdb->get_results("SELECT * FROM $bbpress_tableWHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit");204 $bbtopic = $wpdb->get_results("SELECT * FROM ".get_option('wpbb_bbprefix')."topics WHERE topic_status = 0 ORDER BY topic_time DESC LIMIT $forum_slimit"); 206 205 } 207 206 if ($bbtopic) { … … 211 210 '; 212 211 foreach ( $bbtopic as $bbtopic ) { 212 if (get_option('wpbb_exdb')) { 213 $bbforum = $exbbdb->get_row("SELECT * FROM ".get_option('wpbb_bbprefix')."forums WHERE forum_id = '$bbtopic->forum_id'"); 214 } 215 else { 216 $bbforum = $wpdb->get_row("SELECT * FROM ".get_option('wpbb_bbprefix')."forums WHERE forum_id = '$bbtopic->forum_id'"); 217 } 213 218 if (get_option('wpbb_permalink')) { 214 219 echo '<li><a href="' . get_option('wpbb_path') . '/topic/' . $bbtopic->topic_id . '">' . __("$bbtopic->topic_title") . '</a><br />'; 220 $forum_url = get_option('wpbb_path') . '/forum/' . $bbtopic->forum_id; 215 221 } 216 222 else { 217 223 echo '<li><a href="' . get_option('wpbb_path') . '/topic.php?id=' . $bbtopic->topic_id . '">' . __("$bbtopic->topic_title") . '</a><br />'; 224 $forum_url = get_option('wpbb_path') . '/forum.php?id=/' . $bbtopic->forum_id; 218 225 } 219 226 if (get_option('wpbb_intergrated')) { 220 $wpuid = $wpdb->get_row("SELECT * FROM $wordpress_tableWHERE user_login = '$bbtopic->topic_last_poster_name'");227 $wpuid = $wpdb->get_row("SELECT * FROM ".$table_prefix."users WHERE user_login = '$bbtopic->topic_last_poster_name'"); 221 228 if ($wpuid) { 222 229 $user_forum_data = "$bbtopic->topic_last_poster_name"; 223 230 $user_forum_data = get_userdata($wpuid->ID); 224 echo '<small>' . __('Last Post By: ') . $user_forum_data->display_name . '< /small></li>';231 echo '<small>' . __('Last Post By: ') . $user_forum_data->display_name . '<br />' . __('Inside: ') . '<a href="'.$forum_url.'">' . __("$bbforum->forum_name") . '</a></small></li>'; 225 232 } 226 233 else { 227 echo '<small>' . __('Last Post By: ') . $bbtopic->topic_last_poster_name . '< /small></li>';234 echo '<small>' . __('Last Post By: ') . $bbtopic->topic_last_poster_name . '<br />' . __('Inside: ') . '<a href="'.$forum_url.'">' . __("$bbforum->forum_name") . '</a></small></li>'; 228 235 } 229 236 } 230 237 else { 231 echo '<small>' . __('Last Post By: ') . $bbtopic->topic_last_poster_name . '< /small></li>';238 echo '<small>' . __('Last Post By: ') . $bbtopic->topic_last_poster_name . '<br />' . __('Inside: ') . '<a href="'.$forum_url.'">' . __("$bbforum->forum_name") . '</a></small></li>'; 232 239 } 233 240 } bbpress-latest-discussion-for-wp/trunk/readme.txt
r288 r289 7 7 8 8 This plugin will generates Latest Discussion list from your bbpress forum into your wordpress page. 9 10 Discuss about option to exclude or include forum at http://www.atsutane.net/bbpress/topic/4 9 11 10 12 == Description == … … 32 34 33 35 == Version History == 36 37 Version 0.7.2 (2007-03-12): 38 39 * Add Category link in sidebar list. 40 * Optimize the code a little. 34 41 35 42 Version 0.7.1 (2007-03-11):
