Changeset 2194
- Timestamp:
- 12/17/2009 12:24:10 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
bp-forums.php (modified) (4 diffs)
-
bp-forums/bp-forums-templatetags.php (modified) (6 diffs)
-
bp-themes/bp-default/_inc/ajax.php (modified) (2 diffs)
-
bp-themes/bp-default/_inc/css/default.css (modified) (3 diffs)
-
bp-themes/bp-default/forums/index.php (modified) (4 diffs)
-
bp-themes/bp-default/forums/topics-loop.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-forums.php
r2168 r2194 128 128 } 129 129 130 function bp_forums_get_forum_topicpost_count( $forum_id ) {131 global $wpdb, $bbdb;132 133 do_action( 'bbpress_init' );134 135 /* Need to find a bbPress function that does this */136 return $wpdb->get_results( $wpdb->prepare( "SELECT topics, posts from {$bbdb->forums} WHERE forum_id = %d", $forum_id ) );137 }138 139 130 /* Topic Functions */ 140 131 … … 147 138 'type' => 'newest', 148 139 'forum_id' => false, 140 'user_id' => false, 149 141 'page' => 1, 150 142 'per_page' => 15, … … 159 151 switch ( $type ) { 160 152 case 'newest': 161 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'per_page' => $per_page, 'page' => $page, 'number' => $per_page, 'exclude' => $exclude, 'topic_title' => $filter, 'sticky' => $show_stickies ), 'get_latest_topics' ); 162 $topics = $query->results; 163 break; 164 165 case 'popular': 166 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_posts', 'topic_title' => $filter, 'sticky' => $show_stickies ) ); 153 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'per_page' => $per_page, 'page' => $page, 'number' => $per_page, 'exclude' => $exclude, 'topic_title' => $filter, 'sticky' => $show_stickies ), 'get_latest_topics' ); 167 154 $topics =& $query->results; 168 155 break; 169 156 170 case ' unreplied':171 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, ' post_count' => 1, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_time', 'topic_title' => $filter, 'sticky' => $show_stickies ) );157 case 'popular': 158 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_posts', 'topic_title' => $filter, 'sticky' => $show_stickies ) ); 172 159 $topics =& $query->results; 173 160 break; 174 161 175 case ' personal':176 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, ' per_page' => $per_page, 'page' => $page, 'topic_author_id' => $bp->loggedin_user->id, 'order_by' => 't.topic_time', 'topic_title' => $filter, 'sticky' => $show_stickies ), 'get_recent_user_threads');162 case 'unreplied': 163 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'post_count' => 1, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_time', 'topic_title' => $filter, 'sticky' => $show_stickies ) ); 177 164 $topics =& $query->results; 178 165 break; 179 166 180 167 case 'tag': 181 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 't ag' => $filter, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_time', 'sticky' => $show_stickies ) );168 $query = new BB_Query( 'topic', array( 'forum_id' => $forum_id, 'topic_author_id' => $user_id, 'tag' => $filter, 'per_page' => $per_page, 'page' => $page, 'order_by' => 't.topic_time', 'sticky' => $show_stickies ) ); 182 169 $topics =& $query->results; 183 170 break; … … 319 306 } 320 307 308 function bp_forums_total_topic_count() { 309 do_action( 'bbpress_init' ); 310 311 $query = new BB_Query( 'topic', array( 'page' => 1, 'per_page' => false, 'count' => true ) ); 312 return $query->count; 313 } 314 315 function bp_forums_total_topic_count_for_user( $user_id = false ) { 316 global $bp; 317 318 do_action( 'bbpress_init' ); 319 320 if ( !$user_id ) 321 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 322 323 $query = new BB_Query( 'topic', array( 'topic_author_id' => $user_id, 'page' => 1, 'per_page' => false, 'count' => true ) ); 324 return $query->count; 325 } 326 321 327 /* Post Functions */ 322 328 -
trunk/bp-forums/bp-forums-templatetags.php
r2168 r2194 19 19 var $order; 20 20 21 function BP_Forums_Template_Forum( $type, $forum_id, $ page, $per_page, $max, $no_stickies, $filter) {21 function BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms ) { 22 22 global $bp; 23 23 … … 31 31 switch ( $type ) { 32 32 case 'newest': default: 33 $this->topics = bp_forums_get_forum_topics( array( ' forum_id' => $forum_id, 'filter' => $filter, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) );33 $this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'forum_id' => $forum_id, 'filter' => $search_terms, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) ); 34 34 break; 35 35 36 36 case 'popular': 37 $this->topics = bp_forums_get_forum_topics( array( ' type' => 'popular', 'filter' => $filter, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) );37 $this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'type' => 'popular', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) ); 38 38 break; 39 39 40 40 case 'unreplied': 41 $this->topics = bp_forums_get_forum_topics( array( ' type' => 'unreplied', 'filter' => $filter, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) );41 $this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'type' => 'unreplied', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) ); 42 42 break; 43 43 44 case 'personal':45 $this->topics = bp_forums_get_forum_topics( array( 'type' => 'personal', 'filter' => $filter, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) );46 break;47 48 44 case 'tag': 49 $this->topics = bp_forums_get_forum_topics( array( ' type' => 'tag', 'filter' => $filter, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) );45 $this->topics = bp_forums_get_forum_topics( array( 'user_id' => $user_id, 'type' => 'tag', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $show_stickies ) ); 50 46 break; 51 47 } … … 158 154 'type' => 'newest', 159 155 'forum_id' => false, 156 'user_id' => false, 160 157 'page' => 1, 161 158 'per_page' => 15, 162 159 'max' => false, 163 160 'no_stickies' => false, 164 ' filter' => false161 'search_terms' => false 165 162 ); 166 163 … … 170 167 /* If we're in a single group, set this group's forum_id */ 171 168 if ( !$forum_id && $bp->groups->current_group ) { 172 $ forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );169 $bp->groups->current_group->forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ); 173 170 174 171 /* If it turns out there is no forum for this group, return false so we don't fetch all global topics */ 175 if ( !$ forum_id )172 if ( !$bp->groups->current_group->forum_id ) 176 173 return false; 177 174 } … … 179 176 /* If we're viewing a tag in the directory, let's auto set the filter to the tag name */ 180 177 if ( $bp->is_directory && 'tag' == $type && !empty( $bp->action_variables[0] ) ) 181 $ filter= $bp->action_variables[0];182 183 /* If $_GET[' s'] is set, let's auto populate the filtervar */178 $search_terms = $bp->action_variables[0]; 179 180 /* If $_GET['fs'] is set, let's auto populate the search_terms var */ 184 181 if ( $bp->is_directory && !empty( $_GET['fs'] ) ) 185 $ filter= $_GET['fs'];186 187 $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $ page, $per_page, $max, $no_stickies, $filter);182 $search_terms = $_GET['fs']; 183 184 $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms ); 188 185 189 186 return apply_filters( 'bp_has_topics', $forum_template->has_topics(), &$forum_template ); … … 935 932 936 933 function bp_directory_forums_search_form() { 937 global $bp; ?> 938 <form action="<?php echo $bp->root_domain . '/' . $bp->forums->slug . '/'; ?>" method="get" id="search-forums-form"> 939 <label><input type="text" name="fs" id="forums_search" value="<?php if ( isset( $_GET['fs'] ) ) { echo attribute_escape( $_GET['fs'] ); } else { _e( 'Search anything...', 'buddypress' ); } ?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label> 940 <input type="submit" id="forums_search_submit" name="submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 934 global $bp; 935 936 $search_value = __( 'Search anything...', 'buddypress' ); 937 if ( !empty( $_REQUEST['fs'] ) ) 938 $search_value = $_REQUEST['fs']; 939 940 else if ( !empty( $_COOKIE['bp-forums-search-terms'] ) && 'false' != $_COOKIE['bp-forums-search-terms'] ) 941 $search_value = $_COOKIE['bp-forums-search-terms']; 942 943 ?> 944 <form action="" method="get" id="search-forums-form"> 945 <label><input type="text" name="s" id="forums_search" value="<?php echo attribute_escape($search_value) ?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label> 946 <input type="submit" id="forums_search_submit" name="forums_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 941 947 </form> 942 948 <?php 943 949 } 944 945 950 function bp_forum_permalink() { 946 951 echo bp_get_forum_permalink(); -
trunk/bp-themes/bp-default/_inc/ajax.php
r2191 r2194 138 138 139 139 /* Sort out type ordering */ 140 if ( 'active' != $filter && ' newest' != $filter && 'alphabetical' != $filter )140 if ( 'active' != $filter && 'popular' != $filter && 'unreplied' != $filter ) 141 141 $type = 'active'; 142 142 … … 146 146 $bp->ajax_querystring .= '&search_terms=' . $search_terms; 147 147 148 if ( !$type || ( 'all' != $type && 'my blogs' != $type ) )148 if ( !$type || ( 'all' != $type && 'mytopics' != $type ) ) 149 149 $type = 'all'; 150 150 151 if ( ( 'my blogs' == $type ) && !is_user_logged_in() )151 if ( ( 'mytopics' == $type ) && !is_user_logged_in() ) 152 152 $type = 'all'; 153 153 154 if ( 'my ' == $type || $bp->displayed_user->id ) {154 if ( 'mytopics' == $type || $bp->displayed_user->id ) { 155 155 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 156 156 $bp->ajax_querystring .= '&user_id=' . $user_id; -
trunk/bp-themes/bp-default/_inc/css/default.css
r2191 r2194 198 198 width: 224px; 199 199 margin-left: -226px; 200 margin-top: 1px; 200 201 border-left: 1px solid #e4e4e4; 202 -moz-border-radius-topright: 3px; 203 -webkit-border-top-right-radius: 3px; 204 background: url( ../images/sidebar_back.gif ) top left repeat-x; 201 205 } 202 206 div#sidebar div#sidebar-me img.avatar { … … 480 484 div.item-list-tabs#group-subnav { 481 485 background: #fff; 482 margin: 0 -15px 20px-15px;486 margin: 0 -15px 0 -15px; 483 487 border-bottom: 1px solid #eaeaea; 484 488 min-height: 35px; 489 overflow: hidden; 485 490 } 486 491 … … 519 524 background: #f8f8f8; 520 525 border: none; 521 margin-top: -20px;522 526 padding: 8px 15px; 523 527 } -
trunk/bp-themes/bp-default/forums/index.php
r2170 r2194 10 10 11 11 <div id="forums-dir-search" class="dir-search"> 12 <?php bp_directory_ groups_search_form() ?>12 <?php bp_directory_forums_search_form() ?> 13 13 </div> 14 14 </form> … … 17 17 <?php if ( is_user_logged_in() ) : ?> 18 18 19 <?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max= 20&per_page=20' ) ) : ?>19 <?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?> 20 20 21 21 <form action="" method="post" id="forum-topic-form" class="standard-form"> … … 70 70 <div class="item-list-tabs"> 71 71 <ul> 72 <li class="selected" id="forums-all"><a href="<?php bp_root_domain() ?>"><?php _e( 'All Group Forums', 'buddypress' ) ?></a></li> 72 <li class="selected" id="forums-all"><a href="<?php bp_root_domain() ?>"><?php printf( __( 'All Topics (%d)', 'buddypress' ), bp_forums_total_topic_count() ) ?></a></li> 73 74 <?php if ( is_user_logged_in() && bp_forums_total_topic_count_for_user( bp_loggedin_user_id() ) ) : ?> 75 <li id="forums-mytopics"><a href="<?php echo bp_loggedin_user_domain() . BP_GROUPS_SLUG . '/' ?>"><?php printf( __( 'My Topics (%d)', 'buddypress' ), bp_forums_total_topic_count_for_user( bp_loggedin_user_id() ) ) ?></a></li> 76 <?php endif; ?> 73 77 74 78 <?php do_action( 'bp_members_directory_group_types' ) ?> … … 80 84 <option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option> 81 85 <option value="popular"><?php _e( 'Most Posts', 'buddypress' ) ?></option> 82 <option value=" newest"><?php _e( 'Unreplied', 'buddypress' ) ?></option>86 <option value="unreplied"><?php _e( 'Unreplied', 'buddypress' ) ?></option> 83 87 84 88 <?php do_action( 'bp_groups_directory_order_options' ) ?> -
trunk/bp-themes/bp-default/forums/topics-loop.php
r2170 r2194 23 23 <tr> 24 24 <th id="th-title"><?php _e( 'Topic Title', 'buddypress' ) ?></th> 25 <th id="th-poster"><?php _e( 'La st Poster', 'buddypress' ) ?></th>25 <th id="th-poster"><?php _e( 'Latest Poster', 'buddypress' ) ?></th> 26 26 27 27 <?php if ( !bp_is_group_forum() ) : ?> 28 <th id="th-group"><?php _e( 'Posted In ', 'buddypress' ) ?></th>28 <th id="th-group"><?php _e( 'Posted In Group', 'buddypress' ) ?></th> 29 29 <?php endif; ?> 30 30
Note: See TracChangeset
for help on using the changeset viewer.