Changeset 289

Show
Ignore:
Timestamp:
03/12/07 11:47:31 (2 years ago)
Author:
Atsutane
Message:

Add category link under sidebar list
Optimize the code a little

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bbpress-latest-discussion-for-wp/trunk/BBpress.php

    r288 r289  
    55Description: Put bbpress Latest Discussions on your wp page. 
    66Author: Atsutane Shirane 
    7 Version: 0.7.1 
     7Version: 0.7.2 
    88Author URI: http://www.atsutane.net/ 
    99*/ 
     10 
     11### BBpress Latest Discussions Version Number 
     12$BbLD_version = '0.7.2'; 
    1013 
    1114if (!defined('ABSPATH')) die("Aren't you supposed to come here via WP-Admin?"); 
     
    1922### Function: BBpress Latest Discussions Option 
    2023function wp_bb_option() { 
    21         global $wpdb
     24        global $wpdb,$BbLD_version
    2225        $ori_url = $_SERVER['REQUEST_URI']; 
    2326        if ($_POST['wpbb_save']){ 
     
    3639        } 
    3740        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' 
    3942                $wpbburl = get_settings('home') . $bbpath; 
    4043                update_option('wpbb_path', $wpbburl); 
     
    7679        <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 /> 
    7780        <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> 
    7982        <p><strong><?php _e('ToDo List:'); ?></strong></p> 
    8083        <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> 
    8285        </ul> 
    8386        <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> 
     
    140143        global $table_prefix,$wpdb; 
    141144        $forum_slimit = get_option('wpbb_limit'); 
    142         $bbpress_table = get_option('wpbb_bbprefix') . "topics"; 
    143         $wordpress_table = $table_prefix . "users"; 
    144145        if (get_option('wpbb_exdb')) { 
    145146                $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_table WHERE 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"); 
    147148        } 
    148149        else { 
    149                 $bbtopic = $wpdb->get_results("SELECT * FROM $bbpress_table WHERE 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"); 
    150151        } 
    151152        if ($bbtopic) { 
     
    172173                        echo '<td class="num">' . __("$bbtopic->topic_posts") . '</td>'; 
    173174                        if (get_option('wpbb_intergrated')) { 
    174                                 $wpuid = $wpdb->get_row("SELECT * FROM $wordpress_table WHERE 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'"); 
    175176                                if ($wpuid) { 
    176177                                        $user_forum_data = "$bbtopic->topic_last_poster_name"; 
     
    195196function wp_bb_get_discuss_sidebar() { 
    196197        global $table_prefix,$wpdb; 
    197         $bbpress_table = get_option('wpbb_bbprefix') . "topics"; 
    198         $wordpress_table = $table_prefix . "users"; 
    199198        $forum_slimit = get_option('wpbb_limit'); 
    200199        if (get_option('wpbb_exdb')) { 
    201200                $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_table WHERE 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"); 
    203202        } 
    204203        else { 
    205                 $bbtopic = $wpdb->get_results("SELECT * FROM $bbpress_table WHERE 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"); 
    206205        } 
    207206        if ($bbtopic) { 
     
    211210                '; 
    212211                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                        } 
    213218                        if (get_option('wpbb_permalink')) { 
    214219                                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; 
    215221                        } 
    216222                        else { 
    217223                                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; 
    218225                        } 
    219226                        if (get_option('wpbb_intergrated')) { 
    220                                 $wpuid = $wpdb->get_row("SELECT * FROM $wordpress_table WHERE 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'"); 
    221228                                if ($wpuid) { 
    222229                                        $user_forum_data = "$bbtopic->topic_last_poster_name"; 
    223230                                        $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>'; 
    225232                                } 
    226233                                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>'; 
    228235                                } 
    229236                        } 
    230237                        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>'; 
    232239                        } 
    233240                } 
  • bbpress-latest-discussion-for-wp/trunk/readme.txt

    r288 r289  
    77 
    88This plugin will generates Latest Discussion list from your bbpress forum into your wordpress page. 
     9 
     10Discuss about option to exclude or include forum at http://www.atsutane.net/bbpress/topic/4 
    911 
    1012== Description == 
     
    3234 
    3335== Version History == 
     36 
     37Version 0.7.2 (2007-03-12): 
     38 
     39* Add Category link in sidebar list. 
     40* Optimize the code a little. 
    3441 
    3542Version 0.7.1 (2007-03-11):