Changeset 2914
- Timestamp:
- 02/18/2011 10:16:22 AM (13 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-forum-functions.php
r2908 r2914 186 186 * @param int $reply_id Optional. Reply id 187 187 * @uses bbp_get_forum_id() To get the forum id 188 * @uses bbp_get_reply_id() To get the reply id189 188 * @uses update_post_meta() To update the forum's last reply id meta 190 189 * @return bool True on success, false on failure -
branches/plugin/bbp-includes/bbp-forum-template.php
r2905 r2914 64 64 65 65 $r = wp_parse_args( $args, $default ); 66 67 // Allow all forums to be queried if post_parent is set to -1 68 if ( -1 == $r['post_parent'] ) 69 unset( $r['post_parent'] ); 66 70 67 71 // Don't show private forums to normal users … … 152 156 // Fallback 153 157 else 154 $bbp_forum_id = 0;155 156 // Check the post_type for good measure157 if ( get_post_field( 'post_type', $bbp_forum_id ) != bbp_get_forum_post_type() )158 158 $bbp_forum_id = 0; 159 159 … … 416 416 $active_id = bbp_get_forum_last_topic_id( $forum_id ); 417 417 418 if ( bbp_ get_topic_id( $active_id ) ) {418 if ( bbp_is_topic( $active_id ) ) { 419 419 $link_url = bbp_get_forum_last_topic_permalink( $forum_id ); 420 420 $title = bbp_get_forum_last_topic_title( $forum_id ); 421 } elseif ( bbp_ get_reply_id( $active_id ) ) {421 } elseif ( bbp_is_reply( $active_id ) ) { 422 422 $link_url = bbp_get_forum_last_reply_url( $forum_id ); 423 423 $title = bbp_get_forum_last_reply_title( $forum_id ); … … 488 488 * reading private forums 489 489 * @uses get_posts() To get the subforums 490 * @uses apply_filters() Calls 'bbp_forum_ has_subforums' with the subforums490 * @uses apply_filters() Calls 'bbp_forum_get_subforums' with the subforums 491 491 * and the args 492 492 * @return mixed false if none, array of subs if yes 493 493 */ 494 function bbp_forum_ has_subforums( $args = '' ) {494 function bbp_forum_get_subforums( $args = '' ) { 495 495 if ( is_numeric( $args ) ) 496 496 $args = array( 'post_parent' => $args ); … … 516 516 $sub_forums = !empty( $r['post_parent'] ) ? get_posts( $r ) : ''; 517 517 518 return apply_filters( 'bbp_forum_ has_sub_forums', (array) $sub_forums, $args );518 return apply_filters( 'bbp_forum_get_sub_forums', (array) $sub_forums, $args ); 519 519 } 520 520 … … 533 533 * - show_topic_count - To show forum topic count or not. Defaults to true 534 534 * - show_reply_count - To show forum reply count or not. Defaults to true 535 * @uses bbp_forum_ has_subforums() To check if the forum has subforums or not535 * @uses bbp_forum_get_subforums() To check if the forum has subforums or not 536 536 * @uses bbp_get_forum_permalink() To get forum permalink 537 537 * @uses bbp_get_forum_title() To get forum title … … 565 565 566 566 // Loop through forums and create a list 567 if ( $sub_forums = bbp_forum_ has_subforums( $forum_id ) ) {567 if ( $sub_forums = bbp_forum_get_subforums( $forum_id ) ) { 568 568 // Total count (for separator) 569 569 $total_subs = count( $sub_forums ); -
branches/plugin/bbp-includes/bbp-general-template.php
r2905 r2914 47 47 global $wp_query, $bbp; 48 48 49 if ( is_singular( bbp_get_forum_post_type() ) ) 50 return true; 51 52 if ( isset( $wp_query->query_vars['post_type'] ) && bbp_get_forum_post_type() === $wp_query->query_vars['post_type'] ) 53 return true; 54 55 if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && bbp_get_forum_post_type() === $_GET['post_type'] ) 56 return true; 57 58 if ( !empty( $post_id ) && ( bbp_get_forum_post_type() == get_post_field( 'post_type', $post_id ) ) ) 49 if ( empty( $post_id ) ) { 50 51 if ( is_singular( bbp_get_forum_post_type() ) ) 52 return true; 53 54 if ( isset( $wp_query->query_vars['post_type'] ) && ( bbp_get_forum_post_type() === $wp_query->query_vars['post_type'] ) ) 55 return true; 56 57 if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && ( bbp_get_forum_post_type() === $_GET['post_type'] ) ) 58 return true; 59 60 } elseif ( !empty( $post_id ) && ( bbp_get_forum_post_type() == get_post_field( 'post_type', $post_id ) ) ) 59 61 return true; 60 62 … … 80 82 return false; 81 83 82 if ( is_singular( bbp_get_topic_post_type() ) ) 83 return true; 84 85 if ( isset( $wp_query->query_vars['post_type'] ) && bbp_get_topic_post_type() === $wp_query->query_vars['post_type'] ) 86 return true; 87 88 if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && bbp_get_topic_post_type() === $_GET['post_type'] ) 89 return true; 90 91 if ( !empty( $post_id ) && ( bbp_get_topic_post_type() == get_post_field( 'post_type', $post_id ) ) ) 84 if ( empty( $post_id ) ) { 85 86 if ( is_singular( bbp_get_topic_post_type() ) ) 87 return true; 88 89 if ( isset( $wp_query->query_vars['post_type'] ) && ( bbp_get_topic_post_type() === $wp_query->query_vars['post_type'] ) ) 90 return true; 91 92 if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && ( bbp_get_topic_post_type() === $_GET['post_type'] ) ) 93 return true; 94 95 } elseif ( !empty( $post_id ) && ( bbp_get_topic_post_type() == get_post_field( 'post_type', $post_id ) ) ) 92 96 return true; 93 97 … … 122 126 function bbp_is_topic_merge() { 123 127 124 if ( bbp_is_topic_edit() && !empty( $_GET['action'] ) && 'merge' == $_GET['action'])128 if ( bbp_is_topic_edit() && !empty( $_GET['action'] ) && ( 'merge' == $_GET['action'] ) ) 125 129 return true; 126 130 … … 138 142 function bbp_is_topic_split() { 139 143 140 if ( bbp_is_topic_edit() && !empty( $_GET['action'] ) && 'split' == $_GET['action'])144 if ( bbp_is_topic_edit() && !empty( $_GET['action'] ) && ( 'split' == $_GET['action'] ) ) 141 145 return true; 142 146 … … 162 166 return false; 163 167 164 if ( is_singular( bbp_get_reply_post_type() ) ) 165 return true; 166 167 if ( isset( $wp_query->query_vars['post_type'] ) && bbp_get_reply_post_type() === $wp_query->query_vars['post_type'] ) 168 return true; 169 170 if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && bbp_get_reply_post_type() === $_GET['post_type'] ) 171 return true; 172 173 if ( !empty( $post_id ) && ( bbp_get_reply_post_type() == get_post_field( 'post_type', $post_id ) ) ) 168 if ( empty( $post_id ) ) { 169 170 if ( is_singular( bbp_get_reply_post_type() ) ) 171 return true; 172 173 if ( isset( $wp_query->query_vars['post_type'] ) && ( bbp_get_reply_post_type() === $wp_query->query_vars['post_type'] ) ) 174 return true; 175 176 if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && ( bbp_get_reply_post_type() === $_GET['post_type'] ) ) 177 return true; 178 179 } elseif ( !empty( $post_id ) && ( bbp_get_reply_post_type() == get_post_field( 'post_type', $post_id ) ) ) 174 180 return true; 175 181 … … 188 194 global $wp_query; 189 195 190 if ( !empty( $wp_query->bbp_is_reply_edit ) && $wp_query->bbp_is_reply_edit == true)196 if ( !empty( $wp_query->bbp_is_reply_edit ) && ( true == $wp_query->bbp_is_reply_edit ) ) 191 197 return true; 192 198 … … 211 217 return false; 212 218 213 if ( !empty( $query_name_check ) && 'bbp_user_profile_favorites' != bbp_get_query_name() )219 if ( !empty( $query_name_check ) && ( 'bbp_user_profile_favorites' != bbp_get_query_name() ) ) 214 220 return false; 215 221 … … 234 240 return false; 235 241 236 if ( !empty( $query_name_check ) && 'bbp_user_profile_subscriptions' != bbp_get_query_name() )242 if ( !empty( $query_name_check ) && ( 'bbp_user_profile_subscriptions' != bbp_get_query_name() ) ) 237 243 return false; 238 244 … … 258 264 return false; 259 265 260 if ( !empty( $query_name_check ) && 'bbp_user_profile_topics_created' != bbp_get_query_name() )266 if ( !empty( $query_name_check ) && ( 'bbp_user_profile_topics_created' != bbp_get_query_name() ) ) 261 267 return false; 262 268 … … 292 298 global $wp_query; 293 299 294 if ( !empty( $wp_query->bbp_is_user_profile_page ) && $wp_query->bbp_is_user_profile_page == true)300 if ( !empty( $wp_query->bbp_is_user_profile_page ) && ( true == $wp_query->bbp_is_user_profile_page ) ) 295 301 return true; 296 302 … … 309 315 global $wp_query; 310 316 311 if ( !empty( $wp_query->bbp_is_user_profile_edit ) && $wp_query->bbp_is_user_profile_edit == true)317 if ( !empty( $wp_query->bbp_is_user_profile_edit ) && ( true == $wp_query->bbp_is_user_profile_edit ) ) 312 318 return true; 313 319 … … 326 332 global $wp_query; 327 333 328 if ( !empty( $wp_query->bbp_is_view ) && $wp_query->bbp_is_view == true)334 if ( !empty( $wp_query->bbp_is_view ) && ( true == $wp_query->bbp_is_view ) ) 329 335 return true; 330 336 -
branches/plugin/bbp-includes/bbp-reply-functions.php
r2905 r2914 430 430 431 431 // Reply meta relating to most recent reply 432 if ( bbp_ get_reply_id( $ancestor ) ) {432 if ( bbp_is_reply( $ancestor ) ) { 433 433 // @todo - hierarchical replies 434 434 435 435 // Topic meta relating to most recent reply 436 } elseif ( bbp_ get_topic_id( $ancestor ) ) {436 } elseif ( bbp_is_topic( $ancestor ) ) { 437 437 438 438 // Last reply and active ID's … … 454 454 455 455 // Forum meta relating to most recent topic 456 } elseif ( bbp_ get_forum_id( $ancestor ) ) {456 } elseif ( bbp_is_forum( $ancestor ) ) { 457 457 458 458 // Last topic and reply ID's -
branches/plugin/bbp-includes/bbp-reply-template.php
r2905 r2914 195 195 // Fallback 196 196 else 197 $bbp_reply_id = 0;198 199 // Check the post_type for good measure200 if ( get_post_field( 'post_type', $bbp_reply_id ) != bbp_get_reply_post_type() )201 197 $bbp_reply_id = 0; 202 198 … … 502 498 // Create necessary variables 503 499 $reply_id = bbp_get_reply_id( $reply_id ); 504 $revisions = bbp_get_reply_revisions( $reply_id );505 500 $revision_log = bbp_get_reply_raw_revision_log( $reply_id ); 506 501 507 if ( empty( $reply_id ) || empty( $revisions ) || empty( $revision_log ) || !is_array( $revisions ) || !is_array( $revision_log ) ) 502 // Check reply and revision log exist 503 if ( empty( $reply_id ) || empty( $revision_log ) || !is_array( $revision_log ) ) 504 return false; 505 506 // Get the actual revisions 507 if ( !$revisions = bbp_get_reply_revisions( $reply_id ) ) 508 508 return false; 509 509 … … 547 547 */ 548 548 function bbp_get_reply_raw_revision_log( $reply_id = 0 ) { 549 $reply_id = bbp_get_reply_id( $reply_id ); 550 549 $reply_id = bbp_get_reply_id( $reply_id ); 551 550 $revision_log = get_post_meta( $reply_id, '_bbp_revision_log', true ); 552 551 $revision_log = empty( $revision_log ) ? array() : $revision_log; … … 628 627 629 628 // Finally, update 630 return update_post_meta( $reply_id, '_bbp_revision_log', $revision_log ); 629 update_post_meta( $reply_id, '_bbp_revision_log', $revision_log ); 630 631 return apply_filters( 'bbp_update_reply_revision_log', $revision_log, $reply_id ); 631 632 } 632 633 -
branches/plugin/bbp-includes/bbp-topic-functions.php
r2907 r2914 1358 1358 1359 1359 // If it's a reply, then get the parent (topic id) 1360 if ( $reply_id = bbp_get_reply_id( $topic_id ) )1361 $topic_id = bbp_get_reply_topic_id( $ reply_id );1360 if ( bbp_is_reply( $topic_id ) ) 1361 $topic_id = bbp_get_reply_topic_id( $topic_id ); 1362 1362 else 1363 1363 $topic_id = bbp_get_topic_id( $topic_id ); … … 1391 1391 1392 1392 // If it's a reply, then get the parent (topic id) 1393 if ( $reply_id = bbp_get_reply_id( $topic_id ) )1393 if ( bbp_is_reply( $topic_id ) ) 1394 1394 $topic_id = bbp_get_reply_topic_id( $reply_id ); 1395 1395 else … … 1426 1426 1427 1427 // If it's a reply, then get the parent (topic id) 1428 if ( $reply_id = bbp_get_reply_id( $topic_id ) )1429 $topic_id = bbp_get_reply_topic_id( $ reply_id );1428 if ( bbp_is_reply( $topic_id ) ) 1429 $topic_id = bbp_get_reply_topic_id( $topic_id ); 1430 1430 else 1431 1431 $topic_id = bbp_get_topic_id( $topic_id ); … … 1455 1455 1456 1456 // If it's a reply, then get the parent (topic id) 1457 if ( $reply_id = bbp_get_reply_id( $topic_id ) )1458 $topic_id = bbp_get_reply_topic_id( $ reply_id );1457 if ( bbp_is_reply( $topic_id ) ) 1458 $topic_id = bbp_get_reply_topic_id( $topic_id ); 1459 1459 else 1460 1460 $topic_id = bbp_get_topic_id( $topic_id ); … … 1488 1488 1489 1489 // If it's a reply, then get the parent (topic id) 1490 if ( $reply_id = bbp_get_reply_id( $topic_id ) )1490 if ( bbp_is_reply( $topic_id ) ) 1491 1491 $topic_id = bbp_get_reply_topic_id( $reply_id ); 1492 1492 else … … 1517 1517 1518 1518 // If it's a reply, then get the parent (topic id) 1519 if ( empty( $reply_id ) && $reply_id = bbp_get_reply_id( $topic_id ) ) { 1519 if ( empty( $reply_id ) && bbp_is_reply( $topic_id ) ) { 1520 $reply_id = bbp_get_reply_id( $topic_id ); 1520 1521 $topic_id = bbp_get_reply_topic_id( $reply_id ); 1521 1522 } else { … … 1556 1557 1557 1558 // If it's a reply, then get the parent (topic id) 1558 if ( $reply_id = bbp_get_reply_id( $topic_id ) )1559 $topic_id = bbp_get_reply_topic_id( $ reply_id );1559 if ( bbp_is_reply( $topic_id ) ) 1560 $topic_id = bbp_get_reply_topic_id( $topic_id ); 1560 1561 else 1561 1562 $topic_id = bbp_get_topic_id( $topic_id ); -
branches/plugin/bbp-includes/bbp-topic-template.php
r2905 r2914 314 314 $bbp_topic_id = 0; 315 315 316 // Check the post_type for good measure317 if ( get_post_field( 'post_type', $bbp_topic_id ) != bbp_get_topic_post_type() )318 $bbp_topic_id = 0;319 320 316 $bbp->current_topic_id = $bbp_topic_id; 321 317 … … 552 548 // Create necessary variables 553 549 $topic_id = bbp_get_topic_id( $topic_id ); 554 $revisions = bbp_get_topic_revisions( $topic_id );555 550 $revision_log = bbp_get_topic_raw_revision_log( $topic_id ); 556 551 557 if ( empty( $topic_id ) || empty( $revisions ) || empty( $revision_log ) || !is_array( $revisions ) || !is_array( $revision_log ) ) 552 if ( empty( $topic_id ) || empty( $revision_log ) || !is_array( $revision_log ) ) 553 return false; 554 555 if ( !$revisions = bbp_get_topic_revisions( $topic_id ) ) 558 556 return false; 559 557 -
branches/plugin/bbp-includes/bbp-user-template.php
r2894 r2914 889 889 $post_id = $args; 890 890 891 if ( bbp_ get_topic_id( $post_id ) )891 if ( bbp_is_topic( $post_id ) ) 892 892 return bbp_get_topic_author_link( $args ); 893 elseif ( bbp_ get_reply_id( $post_id ) )893 elseif ( bbp_is_reply( $post_id ) ) 894 894 return bbp_get_reply_author_link( $args ); 895 895 else -
branches/plugin/bbp-includes/bbp-widgets.php
r2879 r2914 194 194 195 195 $title = apply_filters( 'bbp_forum_widget_title', $instance['title'] ); 196 $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : false;196 $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : 0; 197 197 198 198 $default = array( 199 199 'post_parent' => $parent_forum, 200 'posts_per_page' => -1,200 'posts_per_page' => get_option( '_bbp_forums_per_page', 15 ), 201 201 'orderby' => 'menu_order', 202 202 'order' => 'ASC' 203 203 ); 204 204 205 // Don't show private forums to normal users 206 if ( !current_user_can( 'read_private_forums' ) && empty( $default['meta_key'] ) && empty( $default['meta_value'] ) ) { 207 $default['meta_key'] = '_bbp_visibility'; 208 $default['meta_value'] = 'public'; 209 } 210 205 211 if ( bbp_has_forums( $default ) ) : 206 212 … … 234 240 $instance = $old_instance; 235 241 $instance['title'] = strip_tags( $new_instance['title'] ); 236 $instance['parent_forum'] = absint ( $new_instance['parent_forum'] );242 $instance['parent_forum'] = $new_instance['parent_forum']; 237 243 238 244 return $instance; … … 250 256 function form( $instance ) { 251 257 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 252 $parent_forum = !empty( $instance['parent_forum'] ) ? esc_attr( $instance['parent_forum'] ) : ''; ?>258 $parent_forum = !empty( $instance['parent_forum'] ) ? esc_attr( $instance['parent_forum'] ) : 0; ?> 253 259 254 260 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> … … 260 266 <br /> 261 267 262 <small><?php _e( 'Forum ID number. Blank to display all top level forums, "null" to display all forums.', 'bbpress' ); ?></small>268 <small><?php _e( 'Forum ID number. "0" to show only root forums, "-1" to display all forums.', 'bbpress' ); ?></small> 263 269 </p> 264 270 … … 321 327 $max_shown = !empty( $instance['max_shown'] ) ? $instance['max_shown'] : '5'; 322 328 $show_date = !empty( $instance['show_date'] ) ? 'on' : false; 323 $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : false;329 $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : 0; 324 330 $pop_check = ( $instance['pop_check'] < $max_shown || empty( $instance['pop_check'] ) ) ? -1 : $instance['pop_check']; 325 331
Note: See TracChangeset
for help on using the changeset viewer.