Changeset 10183 for trunk/src/bp-forums/bp-forums-functions.php
- Timestamp:
- 10/04/2015 07:29:24 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-forums/bp-forums-functions.php
r10096 r10183 21 21 function bp_forums_is_bbpress_active() { 22 22 23 // Single site 23 // Single site. 24 24 if ( is_plugin_active( 'bbpress/bbpress.php' ) ) 25 25 return true; 26 26 27 // Network active 27 // Network active. 28 28 if ( is_plugin_active_for_network( 'bbpress/bbpress.php' ) ) 29 29 return true; 30 30 31 // Nope 31 // Nope. 32 32 return false; 33 33 } … … 57 57 * Does the forums component have a directory page registered? 58 58 * 59 * Checks $bp pages global and looks for directory page 59 * Checks $bp pages global and looks for directory page. 60 60 * 61 61 * @since 1.5.0 … … 81 81 function bp_forums_get_forum( $forum_id ) { 82 82 83 /** This action is documented in bp-forums/bp-forums-screens */83 /** This action is documented in bp-forums/bp-forums-screens.php */ 84 84 do_action( 'bbpress_init' ); 85 85 return bb_get_forum( $forum_id ); … … 91 91 * Wrapper for {@link bb_new_forum()}. 92 92 * 93 * @param array $args {93 * @param array|string $args { 94 94 * Forum setup arguments. 95 * @type string $forum_name Name of the forum.96 * @type string $forum_desc Description of the forum.97 * @type int $forum_parent_idID of the forum parent. Default: value of98 * {@link bp_forums_parent_forums_id()}.99 * @type bool $forum_orderOrder.100 * @type int $forum_is_category Whether the forum is a category. Default: 0.95 * @type string $forum_name Name of the forum. 96 * @type string $forum_desc Description of the forum. 97 * @type int $forum_parent_id ID of the forum parent. Default: value of 98 * {@link bp_forums_parent_forums_id()}. 99 * @type bool $forum_order Order. 100 * @type int $forum_is_category Whether the forum is a category. Default: 0. 101 101 * } 102 102 * @return int ID of the newly created forum. … … 104 104 function bp_forums_new_forum( $args = '' ) { 105 105 106 /** This action is documented in bp-forums/bp-forums-screens */106 /** This action is documented in bp-forums/bp-forums-screens.php */ 107 107 do_action( 'bbpress_init' ); 108 108 … … 124 124 * Wrapper for {@link bb_update_forum(}. 125 125 * 126 * @param array $args {126 * @param array|string $args { 127 127 * Forum setup arguments. 128 * @type int $forum_idID of the forum to be updated.129 * @type string $forum_name Name of the forum.130 * @type string $forum_desc Description of the forum.131 * @type int $forum_parent_idID of the forum parent. Default: value of132 * {@link bp_forums_parent_forums_id()}.133 * @type bool $forum_orderOrder.134 * @type int $forum_is_category Whether the forum is a category. Default: 0.128 * @type int $forum_id ID of the forum to be updated. 129 * @type string $forum_name Name of the forum. 130 * @type string $forum_desc Description of the forum. 131 * @type int $forum_parent_id ID of the forum parent. Default: value of 132 * {@link bp_forums_parent_forums_id()}. 133 * @type bool $forum_order Order. 134 * @type int $forum_is_category Whether the forum is a category. Default: 0. 135 135 * } 136 136 * @return bool True on success, false on failure. … … 138 138 function bp_forums_update_forum( $args = '' ) { 139 139 140 /** This action is documented in bp-forums/bp-forums-screens */140 /** This action is documented in bp-forums/bp-forums-screens.php */ 141 141 do_action( 'bbpress_init' ); 142 142 … … 165 165 if ( !empty( $forum_id ) && is_int( $forum_id ) ) { 166 166 167 /** This action is documented in bp-forums/bp-forums-screens */167 /** This action is documented in bp-forums/bp-forums-screens.php */ 168 168 do_action( 'bbpress_init' ); 169 169 bb_delete_forum( $forum_id ); … … 177 177 * Fetch a set of forum topics. 178 178 * 179 * @param array $args {180 * @type string @typeOrder or filter type. Default: 'newest'.181 * @type int $forum_idOptional. Pass a forum ID to limit results to topics182 * associated with that forum.183 * @type int $user_idOptional. Pass a user ID to limit results to topics184 * belonging to that user.185 * @type int $pageOptional. Number of the results page to return.186 * Default: 1.187 * @type int $per_pageOptional. Number of results to return per page.188 * Default: 15.189 * @type int $offsetOptional. Numeric offset for results.190 * @type int $number191 * @type array $excludeOptional. Topic IDs to exclude.179 * @param array|string $args { 180 * @type string $type Order or filter type. Default: 'newest'. 181 * @type int $forum_id Optional. Pass a forum ID to limit results to topics 182 * associated with that forum. 183 * @type int $user_id Optional. Pass a user ID to limit results to topics 184 * belonging to that user. 185 * @type int $page Optional. Number of the results page to return. 186 * Default: 1. 187 * @type int $per_page Optional. Number of results to return per page. 188 * Default: 15. 189 * @type int $offset Optional. Numeric offset for results. 190 * @type int $number Amount to query for. 191 * @type array $exclude Optional. Topic IDs to exclude. 192 192 * @type string $show_stickies Whether to show sticky topics. 193 * @type mixed $filterIf $type = 'tag', filter is the tag name. Otherwise,194 * $filter is terms to search on.193 * @type mixed $filter If $type = 'tag', filter is the tag name. Otherwise, 194 * $filter is terms to search on. 195 195 * } 196 196 * @return array Found topics. … … 198 198 function bp_forums_get_forum_topics( $args = '' ) { 199 199 200 /** This action is documented in bp-forums/bp-forums-screens */200 /** This action is documented in bp-forums/bp-forums-screens.php */ 201 201 do_action( 'bbpress_init' ); 202 202 … … 211 211 'exclude' => false, 212 212 'show_stickies' => 'all', 213 'filter' => false // if $type = tag then filter is the tag name, otherwise it's terms to search on.213 'filter' => false // If $type = tag then filter is the tag name, otherwise it's terms to search on. 214 214 ) ); 215 215 extract( $r, EXTR_SKIP ); … … 260 260 function bp_forums_get_topic_details( $topic_id ) { 261 261 262 /** This action is documented in bp-forums/bp-forums-screens */262 /** This action is documented in bp-forums/bp-forums-screens.php */ 263 263 do_action( 'bbpress_init' ); 264 264 … … 278 278 function bp_forums_get_topic_id_from_slug( $topic_slug ) { 279 279 280 /** This action is documented in bp-forums/bp-forums-screens */280 /** This action is documented in bp-forums/bp-forums-screens.php */ 281 281 do_action( 'bbpress_init' ); 282 282 … … 290 290 * Create a new forum topic. 291 291 * 292 * @param array $args {293 * @type string $topic_titleTitle of the new topic.294 * @type string $topic_slugSlug of the new topic.295 * @type string $topic_textText of the new topic.296 * @type int $topic_posterID of the user posting the topic. Default: ID of297 * the logged-in user.298 * @type string $topic_poster_nameDisplay name of the user posting the299 * topic. Default: 'fullname' of the logged-in user.300 * @type i d $topic_last_posterID of the user who last posted to the topic.301 * Default: ID of the logged-in user.302 * @type string $topic_last_poster_name Display name of the user who last303 * posted to the topic. Default: 'fullname' of the logged-in user.304 * @type string $topic_start_timeDate/time when the topic was created.305 * Default: the current time, as reported by bp_core_current_time().306 * @type string $topic_timeDate/time when the topic was created.307 * Default: the current time, as reported by bp_core_current_time().308 * @type int $topic_openWhether the topic is open. Default: 1 (open).309 * @type array|string|bool $topic_tags Array or comma-separated list of310 * topic tags. False to leave empty. Default: false.311 * @type int $forum_idID of the forum to which the topic belongs.312 * Default: 0.292 * @param array|string $args { 293 * @type string $topic_title Title of the new topic. 294 * @type string $topic_slug Slug of the new topic. 295 * @type string $topic_text Text of the new topic. 296 * @type int $topic_poster ID of the user posting the topic. Default: ID of 297 * the logged-in user. 298 * @type string $topic_poster_name Display name of the user posting the 299 * topic. Default: 'fullname' of the logged-in user. 300 * @type int $topic_last_poster ID of the user who last posted to the topic. 301 * Default: ID of the logged-in user. 302 * @type string $topic_last_poster_name Display name of the user who last 303 * posted to the topic. Default: 'fullname' of the logged-in user. 304 * @type string $topic_start_time Date/time when the topic was created. 305 * Default: the current time, as reported by bp_core_current_time(). 306 * @type string $topic_time Date/time when the topic was created. 307 * Default: the current time, as reported by bp_core_current_time(). 308 * @type int $topic_open Whether the topic is open. Default: 1 (open). 309 * @type array|string|bool $topic_tags Array or comma-separated list of 310 * topic tags. False to leave empty. Default: false. 311 * @type int $forum_id ID of the forum to which the topic belongs. 312 * Default: 0. 313 313 * } 314 314 * @return object Details about the new topic, as returned by 315 * {@link bp_forums_get_topic_details()}.315 * {@link bp_forums_get_topic_details()}. 316 316 */ 317 317 function bp_forums_new_topic( $args = '' ) { 318 318 $bp = buddypress(); 319 319 320 /** This action is documented in bp-forums/bp-forums-screens */320 /** This action is documented in bp-forums/bp-forums-screens.php */ 321 321 do_action( 'bbpress_init' ); 322 322 … … 325 325 'topic_slug' => '', 326 326 'topic_text' => '', 327 'topic_poster' => bp_loggedin_user_id(), // accepts ids328 'topic_poster_name' => $bp->loggedin_user->fullname, // accept names329 'topic_last_poster' => bp_loggedin_user_id(), // accepts ids330 'topic_last_poster_name' => $bp->loggedin_user->fullname, // accept names327 'topic_poster' => bp_loggedin_user_id(), // Accepts ids. 328 'topic_poster_name' => $bp->loggedin_user->fullname, // Accept names. 329 'topic_last_poster' => bp_loggedin_user_id(), // Accepts ids. 330 'topic_last_poster_name' => $bp->loggedin_user->fullname, // Accept names. 331 331 'topic_start_time' => bp_core_current_time(), 332 332 'topic_time' => bp_core_current_time(), 333 333 'topic_open' => 1, 334 'topic_tags' => false, // accepts array or comma delimited335 'forum_id' => 0 // accepts ids or slugs334 'topic_tags' => false, // Accepts array or comma delimited. 335 'forum_id' => 0 // Accepts ids or slugs. 336 336 ) ); 337 337 extract( $r, EXTR_SKIP ); … … 373 373 * Update a topic's details. 374 374 * 375 * @param array $args {375 * @param array|string $args { 376 376 * Array of arguments. 377 * @type int $topic_id ID of the topic being updated. 378 * @type string $topic_title Updated title of the topic. 379 * @type string $topic_title Updated text of the topic. 380 * @type array|string|bool $topic_tags Array or comma-separated list of 381 * topic tags. False to leave empty. Default: false. 377 * @type int $topic_id ID of the topic being updated. 378 * @type string $topic_title Updated title of the topic. 379 * @type string $topic_text Updated text of the topic. 380 * @type array|string|bool $topic_tags Array or comma-separated list of 381 * topic tags. False to leave empty. 382 * Default false. 382 383 * } 383 384 * @return object Details about the new topic, as returned by 384 * {@link bp_forums_get_topic_details()}.385 * {@link bp_forums_get_topic_details()}. 385 386 */ 386 387 function bp_forums_update_topic( $args = '' ) { 387 388 388 /** This action is documented in bp-forums/bp-forums-screens */389 /** This action is documented in bp-forums/bp-forums-screens.php */ 389 390 do_action( 'bbpress_init' ); 390 391 … … 397 398 extract( $r, EXTR_SKIP ); 398 399 399 // Check if the user is a spammer 400 // Check if the user is a spammer. 400 401 if ( bp_is_user_inactive( bp_loggedin_user_id() ) ) 401 402 return false; 402 403 403 // bb_insert_topic()will append tags, but not remove them. So we remove all existing tags.404 // The bb_insert_topic() function will append tags, but not remove them. So we remove all existing tags. 404 405 bb_remove_topic_tags( $topic_id ); 405 406 … … 410 411 return false; 411 412 412 // Update the first post 413 // Update the first post. 413 414 if ( !$post = bp_forums_insert_post( array( 'post_id' => $post->post_id, 'topic_id' => $topic_id, 'post_text' => $topic_text, 'post_time' => $post->post_time, 'poster_id' => $post->poster_id, 'poster_ip' => $post->poster_ip, 'post_status' => $post->post_status, 'post_position' => $post->post_position ) ) ) 414 415 return false; … … 419 420 function bp_forums_sticky_topic( $args = '' ) { 420 421 421 /** This action is documented in bp-forums/bp-forums-screens */422 /** This action is documented in bp-forums/bp-forums-screens.php */ 422 423 do_action( 'bbpress_init' ); 423 424 424 425 $r = wp_parse_args( $args, array( 425 426 'topic_id' => false, 426 'mode' => 'stick' // stick/unstick427 'mode' => 'stick' // Stick/unstick. 427 428 ) ); 428 429 extract( $r, EXTR_SKIP ); … … 439 440 * Set a topic's open/closed status. 440 441 * 441 * @param array $args {442 * @type int $topic_id ID of the topic whose status is being changed.443 * @type string $mode New status of the topic. 'open' or 'close'.444 * Default: 'close'.442 * @param array|string $args { 443 * @type int $topic_id ID of the topic whose status is being changed. 444 * @type string $mode New status of the topic. 'open' or 'close'. 445 * Default: 'close'. 445 446 * } 446 447 * @return bool True on success, false on failure. … … 448 449 function bp_forums_openclose_topic( $args = '' ) { 449 450 450 /** This action is documented in bp-forums/bp-forums-screens */451 /** This action is documented in bp-forums/bp-forums-screens.php */ 451 452 do_action( 'bbpress_init' ); 452 453 453 454 $r = wp_parse_args( $args, array( 454 455 'topic_id' => false, 455 'mode' => 'close' // stick/unstick456 'mode' => 'close' // Stick/unstick. 456 457 ) ); 457 458 extract( $r, EXTR_SKIP ); … … 468 469 * Delete a topic. 469 470 * 470 * @param array $args {471 * @param array|string $args { 471 472 * @type int $topic_id ID of the topic being deleted. 472 473 * } … … 475 476 function bp_forums_delete_topic( $args = '' ) { 476 477 477 /** This action is documented in bp-forums/bp-forums-screens */478 /** This action is documented in bp-forums/bp-forums-screens.php */ 478 479 do_action( 'bbpress_init' ); 479 480 … … 494 495 global $bbdb; 495 496 496 /** This action is documented in bp-forums/bp-forums-screens */497 /** This action is documented in bp-forums/bp-forums-screens.php */ 497 498 do_action( 'bbpress_init' ); 498 499 … … 528 529 * @since 1.6.0 529 530 * 530 * @param string $text The text of the comment.531 * @param int $topic_id The topic id.532 * @param int $user_idThe user id.531 * @param string $text The text of the comment. 532 * @param int $topic_id The topic id. 533 * @param int $user_id The user id. 533 534 * @return bool True if a duplicate reply exists, otherwise false. 534 535 */ … … 539 540 if ( $text && $topic_id && $user_id ) { 540 541 541 /** This action is documented in bp-forums/bp-forums-screens */542 /** This action is documented in bp-forums/bp-forums-screens.php */ 542 543 do_action( 'bbpress_init' ); 543 544 … … 547 548 ); 548 549 549 // Set the reply_exists_text so we can check it in the filter below 550 // Set the reply_exists_text so we can check it in the filter below. 550 551 buddypress()->forums->reply_exists_text = $text; 551 552 552 // BB_Query's post_text parameter does a MATCH, while we need exact matches 553 // BB_Query's post_text parameter does a MATCH, while we need exact matches. 553 554 add_filter( 'get_posts_where', '_bp_forums_reply_exists_posts_where' ); 554 555 $query = new BB_Query( 'post', $args ); 555 556 remove_filter( 'get_posts_where', '_bp_forums_reply_exists_posts_where' ); 556 557 557 // Cleanup 558 // Cleanup. 558 559 unset( buddypress()->forums->reply_exists_text ); 559 560 … … 574 575 } 575 576 /** 576 * Private one-time-use function used in conjunction with bp_forums_reply_exists() 577 * Private one-time-use function used in conjunction with bp_forums_reply_exists(). 577 578 * 578 579 * @access private … … 591 592 * Get a total "Topics Started" count for a given user. 592 593 * 593 * @param int $user_id ID of the user being queried. Falls back on displayed594 * user, then loggedin.595 * @param string $type The current filter/sort type. 'active', 'popular',596 * 'unreplied'.594 * @param int $user_id ID of the user being queried. Falls back on displayed 595 * user, then loggedin. 596 * @param string $type The current filter/sort type. 'active', 'popular', 597 * 'unreplied'. 597 598 * @return int $count The topic count. 598 599 */ 599 600 function bp_forums_total_topic_count_for_user( $user_id = 0, $type = 'active' ) { 600 601 601 /** This action is documented in bp-forums/bp-forums-screens */602 /** This action is documented in bp-forums/bp-forums-screens.php */ 602 603 do_action( 'bbpress_init' ); 603 604 … … 634 635 * @since 1.5.0 635 636 * 636 * @param int $user_id ID of the user whose replied topics are being counted. 637 * Defaults to displayed user, then to logged-in user. 637 * @param int $user_id ID of the user whose replied topics are being counted. 638 * Defaults to displayed user, then to logged-in user. 639 * @param string $type Forum thread type. 638 640 * @return int $count Topic count. 639 641 */ 640 642 function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active' ) { 641 643 642 /** This action is documented in bp-forums/bp-forums-screens */644 /** This action is documented in bp-forums/bp-forums-screens.php */ 643 645 do_action( 'bbpress_init' ); 644 646 … … 652 654 $query = new BB_Query( 'post', array( 'post_author_id' => $user_id, 'page' => 1, 'per_page' => -1, 'count' => true ) ); 653 655 654 // Count the unique topics. No better way to do this in the bbPress query API 656 // Count the unique topics. No better way to do this in the bbPress query API. 655 657 $topics = array(); 656 658 foreach( $query->results as $result ) { … … 659 661 } 660 662 661 // Even more unfortunate. If this is filtered by 'unreplied', we have to requery 663 // Even more unfortunate. If this is filtered by 'unreplied', we have to requery. 662 664 if ( 'unreplied' == $type ) { 663 665 $topic_ids = implode( ',', $topics ); … … 702 704 $bp = buddypress(); 703 705 704 // Get the topic ids 706 // Get the topic ids. 705 707 foreach ( (array) $topics as $topic ) $topic_ids[] = $topic->topic_id; 706 708 $topic_ids = implode( ',', wp_parse_id_list( $topic_ids ) ); 707 709 708 // Fetch the topic's last poster details 710 // Fetch the topic's last poster details. 709 711 $poster_details = $wpdb->get_results( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" ); 710 712 for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) { … … 719 721 } 720 722 721 // Fetch fullname for the topic's last poster 723 // Fetch fullname for the topic's last poster. 722 724 if ( bp_is_active( 'xprofile' ) ) { 723 725 $poster_names = $wpdb->get_results( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" ); … … 731 733 732 734 // Loop through to make sure that each topic has the proper values set. This covers the 733 // case of deleted users 735 // case of deleted users. 734 736 foreach ( (array) $topics as $key => $topic ) { 735 737 if ( !isset( $topic->topic_last_poster_email ) ) … … 754 756 * Get the posts belonging to a topic. 755 757 * 756 * @param array $args {757 * @type int $topic_id ID of the topic for which posts are being fetched.758 * @type int $pageOptional. Page of results to return. Default: 1.759 * @type int $pageOptional. Number of results to return per page.760 * Default: 15.761 * @type string $order 'ASC' or 'DESC'. Default: 'ASC'.758 * @param array|string $args { 759 * @type int $topic_id ID of the topic for which posts are being fetched. 760 * @type int $page Optional. Page of results to return. Default: 1. 761 * @type int $page Optional. Number of results to return per page. 762 * Default: 15. 763 * @type string $order 'ASC' or 'DESC'. Default: 'ASC'. 762 764 * } 763 765 * @return array List of posts. … … 765 767 function bp_forums_get_topic_posts( $args = '' ) { 766 768 767 /** This action is documented in bp-forums/bp-forums-screens */769 /** This action is documented in bp-forums/bp-forums-screens.php */ 768 770 do_action( 'bbpress_init' ); 769 771 … … 791 793 function bp_forums_get_post( $post_id ) { 792 794 793 /** This action is documented in bp-forums/bp-forums-screens */795 /** This action is documented in bp-forums/bp-forums-screens.php */ 794 796 do_action( 'bbpress_init' ); 795 797 return bb_get_post( $post_id ); … … 801 803 * Wrapper for {@link bb_delete_post()}. 802 804 * 803 * @param array $args {805 * @param array|string $args { 804 806 * @type int $post_id ID of the post being deleted. 805 807 * } … … 808 810 function bp_forums_delete_post( $args = '' ) { 809 811 810 /** This action is documented in bp-forums/bp-forums-screens */812 /** This action is documented in bp-forums/bp-forums-screens.php */ 811 813 do_action( 'bbpress_init' ); 812 814 … … 823 825 * Create a new post. 824 826 * 825 * @param array $args {826 * @type int $post_idOptional. ID of an existing post, if you want to827 * update rather than create. Default: false.828 * @type int $topic_idID of the topic to which the post belongs.829 * @type string $post_text Contents of the post.830 * @type string $post_time Optional. Time when the post was recorded.831 * Default: current time, as reported by {@link bp_core_current_time()}.832 * @type int $poster_idOptional. ID of the user creating the post.833 * Default: ID of the logged-in user.834 * @type string $poster_ip Optional. IP address of the user creating the835 * post. Default: the IP address found in $_SERVER['REMOTE_ADDR'].836 * @type int $post_statusPost status. Default: 0.837 * @type int $post_position Optional. Default: false (auto).827 * @param array|string $args { 828 * @type int $post_id Optional. ID of an existing post, if you want to 829 * update rather than create. Default: false. 830 * @type int $topic_id ID of the topic to which the post belongs. 831 * @type string $post_text Contents of the post. 832 * @type string $post_time Optional. Time when the post was recorded. 833 * Default: current time, as reported by {@link bp_core_current_time()}. 834 * @type int $poster_id Optional. ID of the user creating the post. 835 * Default: ID of the logged-in user. 836 * @type string $poster_ip Optional. IP address of the user creating the 837 * post. Default: the IP address found in $_SERVER['REMOTE_ADDR']. 838 * @type int $post_status Post status. Default: 0. 839 * @type int $post_position Optional. Default: false (auto). 838 840 * } 839 841 * @return int|bool ID of the new post on success, false on failure. … … 841 843 function bp_forums_insert_post( $args = '' ) { 842 844 843 /** This action is documented in bp-forums/bp-forums-screens */845 /** This action is documented in bp-forums/bp-forums-screens.php */ 844 846 do_action( 'bbpress_init' ); 845 847 … … 849 851 'post_text' => '', 850 852 'post_time' => bp_core_current_time(), 851 'poster_id' => bp_loggedin_user_id(), // accepts ids or names853 'poster_id' => bp_loggedin_user_id(), // Accepts ids or names. 852 854 'poster_ip' => $_SERVER['REMOTE_ADDR'], 853 'post_status' => 0, // use bb_delete_post() instead855 'post_status' => 0, // Use bb_delete_post() instead. 854 856 'post_position' => false 855 857 ); … … 914 916 $bp = buddypress(); 915 917 916 // Get the user ids 918 // Get the user ids. 917 919 foreach ( (array) $posts as $post ) $user_ids[] = $post->poster_id; 918 920 $user_ids = implode( ',', wp_parse_id_list( $user_ids ) ); 919 921 920 // Fetch the poster's user_email, user_nicename and user_login 922 // Fetch the poster's user_email, user_nicename and user_login. 921 923 $poster_details = $wpdb->get_results( "SELECT u.ID as user_id, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u WHERE u.ID IN ( {$user_ids} )" ); 922 924 … … 958 960 * @param int $forum_id ID of the forum. 959 961 * @return object Object with properties $topics (topic count) and $posts 960 * (post count).962 * (post count). 961 963 */ 962 964 function bp_forums_get_forum_topicpost_count( $forum_id ) { 963 965 global $wpdb, $bbdb; 964 966 965 /** This action is documented in bp-forums/bp-forums-screens */966 do_action( 'bbpress_init' ); 967 968 // Need to find a bbPress function that does this 967 /** This action is documented in bp-forums/bp-forums-screens.php */ 968 do_action( 'bbpress_init' ); 969 970 // Need to find a bbPress function that does this. 969 971 return $wpdb->get_results( $wpdb->prepare( "SELECT topics, posts from {$bbdb->forums} WHERE forum_id = %d", $forum_id ) ); 970 972 } … … 1023 1025 * 1024 1026 * @return bool True if stickies should be displayed at the top of the global 1025 * directory, otherwise false.1027 * directory, otherwise false. 1026 1028 */ 1027 1029 function bp_forums_enable_global_directory_stickies() { … … 1045 1047 */ 1046 1048 1047 // List actions to clear super cached pages on, if super cache is installed 1049 // List actions to clear super cached pages on, if super cache is installed. 1048 1050 add_action( 'bp_forums_new_forum', 'bp_core_clear_cache' ); 1049 1051 add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' ); … … 1077 1079 * Wrapper function for {@link bb_get_postmeta()}. 1078 1080 * 1079 * @package BuddyPress_Forums1080 1081 * @since 1.5.0 1082 * 1083 * @param object $cache Cache object. 1084 * @param int $id ID of the forum being cached. 1085 * @param string $cachekey Key to use with forum embed cache. 1081 1086 */ 1082 1087 function bp_embed_forum_cache( $cache, $id, $cachekey ) { … … 1090 1095 * 1091 1096 * @since 1.5.0 1097 * 1098 * @param object $cache Cache object. 1099 * @param string $cachekey Key to use with forum embed cache. 1100 * @param int $id ID of the forum being cached. 1092 1101 */ 1093 1102 function bp_embed_forum_save_cache( $cache, $cachekey, $id ) {
Note: See TracChangeset
for help on using the changeset viewer.