Changeset 10183 for trunk/src/bp-forums/bp-forums-template.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-template.php
r10126 r10183 213 213 * Constructor method. 214 214 * 215 * @param string $type The 'type' is the sort order/kind. 'newest', 216 * 'popular', 'unreplied', 'tags'. 217 * @param int $forum_id The ID of the forum for which topics are being 218 * queried. 219 * @param int $user_id The ID of the user to whom topics should be 220 * limited. Pass false to remove this filter. 221 * @param int $page The number of the page being requested. 222 * @param int $per_page The number of items being requested per page. 223 * @param string $no_stickies Requested sticky format. 224 * @param string $search_terms Filter results by a string. 225 * @param int $offset Optional. Offset results by a given numeric value. 226 * @param int $number Optional. Total number of items to retrieve. 215 * @param string $type The 'type' is the sort order/kind. 'newest', 216 * 'popular', 'unreplied', 'tags'. 217 * @param int $forum_id The ID of the forum for which topics are being 218 * queried. 219 * @param int $user_id The ID of the user to whom topics should be 220 * limited. Pass false to remove this filter. 221 * @param int $page The number of the page being requested. 222 * @param int $per_page The number of items being requested per page. 223 * @param int $max Max amount to retrieve. 224 * @param string $no_stickies Requested sticky format. 225 * @param string $search_terms Filter results by a string. 226 * @param int|bool $offset Optional. Offset results by a given numeric value. 227 * @param int|bool $number Optional. Total number of items to retrieve. 227 228 */ 228 229 function __construct( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms, $offset = false, $number = false ) { … … 275 276 } else { 276 277 // Get a total topic count, for use in pagination. This value will differ 277 // depending on scope 278 // depending on scope. 278 279 if ( !empty( $forum_id ) ) { 279 // Group forums 280 // Group forums. 280 281 $topic_count = bp_forums_get_forum( $forum_id ); 281 282 $topic_count = (int) $topic_count->topics; … … 284 285 } else if ( bp_is_user_forums_started() || ( bp_is_directory() && $user_id ) ) { 285 286 // This covers the case of Profile > Forums > Topics Started, as 286 // well as Forum Directory > My Topics 287 // well as Forum Directory > My Topics. 287 288 $topic_count = bp_forums_total_topic_count_for_user( bp_displayed_user_id(), $type ); 288 289 } else if ( bp_is_user_forums_replied_to() ) { 289 // Profile > Forums > Replied To 290 // Profile > Forums > Replied To. 290 291 $topic_count = bp_forums_total_replied_count_for_user( bp_displayed_user_id(), $type ); 291 292 } else if ( 'tags' == $type ) { … … 294 295 } else { 295 296 // For forum directories (All Topics), get a true count 296 $status = bp_current_user_can( 'bp_moderate' ) ? 'all' : 'public'; // todo: member-of297 $status = bp_current_user_can( 'bp_moderate' ) ? 'all' : 'public'; // @todo: member-of. 297 298 $topic_count = (int)groups_total_forum_topic_count( $status, $search_terms ); 298 299 } … … 348 349 $this->total_topic_count = apply_filters_ref_array( 'bp_forums_template_total_topic_count', array( $this->total_topic_count, $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) ); 349 350 350 // Fetch extra information for topics, so we don't have to query inside the loop 351 // Fetch extra information for topics, so we don't have to query inside the loop. 351 352 $this->topics = bp_forums_get_topic_extras( $this->topics ); 352 353 … … 373 374 */ 374 375 function has_topics() { 375 if ( $this->topic_count ) 376 if ( $this->topic_count ) { 376 377 return true; 378 } 377 379 378 380 return false; … … 423 425 */ 424 426 do_action('forum_loop_end'); 425 // Do some cleaning up after the loop 427 // Do some cleaning up after the loop. 426 428 $this->rewind_topics(); 427 429 } … … 466 468 * of has_topics(). 467 469 * 468 * @param array $args {470 * @param array|string $args { 469 471 * Arguments for limiting the contents of the forum topics loop. 470 472 * 471 * @type string $typeThe 'type' is the sort order/kind. 'newest',472 * 'popular', 'unreplied', 'tags'. Default: 'newest'.473 * @type int $forum_idThe ID of the forum for which topics are being474 * queried. Default: the ID of the forum belonging to the current475 * group, if available.476 * @type int $user_idThe ID of a user to whom to limit results. If viewing477 * a member's profile, defaults to that member's ID; otherwise478 * defaults to 0.479 * @type int $pageThe number of the page being requested. Default: 1, or480 * the value of $_GET['p'].481 * @type int $per_pagThe number items to return per page. Default: 20, or482 * the value of $_GET['n'].483 * @type int $maxOptional. Max records to return. Default: false (no max).484 * @type int $numberOptional. Number of records to return. Default: false.485 * @type int $offsetOptional. Offset results by a given value.486 * Default: false.487 * @type string $search_terms Optional. A string to which results should be488 * limited. Default: false, or the value of $_GET['fs'].489 * @type string|bool $do_stickies Whether to move stickies to the top of490 * the sort order. Default: true if looking at a group forum,491 * otherwise false.473 * @type string $type The 'type' is the sort order/kind. 'newest', 474 * 'popular', 'unreplied', 'tags'. Default: 'newest'. 475 * @type int $forum_id The ID of the forum for which topics are being 476 * queried. Default: the ID of the forum belonging to the current 477 * group, if available. 478 * @type int $user_id The ID of a user to whom to limit results. If viewing 479 * a member's profile, defaults to that member's ID; otherwise 480 * defaults to 0. 481 * @type int $page The number of the page being requested. Default: 1, or 482 * the value of $_GET['p']. 483 * @type int $per_pag The number items to return per page. Default: 20, or 484 * the value of $_GET['n']. 485 * @type int $max Optional. Max records to return. Default: false (no max). 486 * @type int $number Optional. Number of records to return. Default: false. 487 * @type int $offset Optional. Offset results by a given value. 488 * Default: false. 489 * @type string $search_terms Optional. A string to which results should be 490 * limited. Default: false, or the value of $_GET['fs']. 491 * @type string|bool $do_stickies Whether to move stickies to the top of 492 * the sort order. Default: true if looking at a group forum, 493 * otherwise false. 492 494 * } 493 495 * @return bool True when forum topics are found corresponding to the args, … … 499 501 $bp = buddypress(); 500 502 501 /* **503 /* 502 504 * Set the defaults based on the current page. Any of these will be overridden 503 505 * if arguments are directly passed into the loop. Custom plugins should always … … 510 512 $do_stickies = false; 511 513 512 // User filtering 514 // User filtering. 513 515 if ( bp_displayed_user_id() ) 514 516 $user_id = bp_displayed_user_id(); … … 516 518 // "Replied" query must be manually modified 517 519 if ( 'replies' == bp_current_action() ) { 518 $user_id = 0; // User id must be handled manually by the filter, not by BB_Query 520 $user_id = 0; // User id must be handled manually by the filter, not by BB_Query. 519 521 520 522 add_filter( 'get_topics_distinct', 'bp_forums_add_replied_distinct_sql', 20 ); … … 523 525 } 524 526 525 // If we're in a single group, set this group's forum_id 527 // If we're in a single group, set this group's forum_id. 526 528 if ( !$forum_id && !empty( $bp->groups->current_group ) ) { 527 529 $bp->groups->current_group->forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ); 528 530 529 531 // If it turns out there is no forum for this group, return false so 530 // we don't fetch all global topics 532 // we don't fetch all global topics. 531 533 if ( empty( $bp->groups->current_group->forum_id ) ) 532 534 return false; … … 535 537 } 536 538 537 // If $_GET['fs'] is set, let's auto populate the search_terms var 539 // If $_GET['fs'] is set, let's auto populate the search_terms var. 538 540 if ( bp_is_directory() && !empty( $_GET['fs'] ) ) 539 541 $search_terms = $_GET['fs']; 540 542 541 // Get the pagination arguments from $_REQUEST 543 // Get the pagination arguments from $_REQUEST. 542 544 $page = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : 1; 543 545 $per_page = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : 20; 544 546 545 // By default, stickies are only pushed to the top of the order on individual group forums 547 // By default, stickies are only pushed to the top of the order on individual group forums. 546 548 if ( bp_is_group_forum() ) 547 549 $do_stickies = true; … … 564 566 565 567 // If we're viewing a tag URL in the directory, let's override the type and 566 // set it to tags and the filter to the tag name 568 // set it to tags and the filter to the tag name. 567 569 if ( bp_is_current_action( 'tag' ) && $search_terms = bp_action_variable( 0 ) ) { 568 570 $type = 'tags'; … … 572 574 573 575 if ( $do_stickies ) { 574 // Fetch the stickies 576 // Fetch the stickies. 575 577 $stickies_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, 0, 0, $max, 'sticky', $search_terms ); 576 578 577 // If stickies are found, try merging them 579 // If stickies are found, try merging them. 578 580 if ( $stickies_template->has_topics() ) { 579 581 580 // If stickies are for current $page 582 // If stickies are for current $page. 581 583 $page_start_num = ( ( $page - 1 ) * $per_page ) + 1; 582 584 $page_end_num = $page * $per_page <= $stickies_template->total_topic_count ? $page * $per_page : $stickies_template->total_topic_count; 583 585 584 // Calculate the number of sticky topics that will be shown on this page 586 // Calculate the number of sticky topics that will be shown on this page. 585 587 if ( $stickies_template->topic_count < $page_start_num ) { 586 588 $this_page_stickies = 0; 587 589 } else { 588 $this_page_stickies = $stickies_template->topic_count - $per_page * floor( $stickies_template->topic_count / $per_page ) * ( $page - 1 ); // Total stickies minus sticky count through this page 590 $this_page_stickies = $stickies_template->topic_count - $per_page * floor( $stickies_template->topic_count / $per_page ) * ( $page - 1 ); // Total stickies minus sticky count through this page. 589 591 590 592 // $this_page_stickies cannot be more than $per_page or less than 0 … … 595 597 } 596 598 597 // Calculate the total number of topics that will be shown on this page 599 // Calculate the total number of topics that will be shown on this page. 598 600 $this_page_topics = $stickies_template->total_topic_count >= ( $page * $per_page ) ? $per_page : $page_end_num - ( $page_start_num - 1 ); 599 601 600 602 // If the number of stickies to be shown is less than $per_page, fetch some 601 // non-stickies to fill in the rest 603 // non-stickies to fill in the rest. 602 604 if ( $this_page_stickies < $this_page_topics ) { 603 605 // How many non-stickies do we need? … … 609 611 610 612 // The offset is the number of total non-stickies, less the number 611 // to be shown on this page 613 // to be shown on this page. 612 614 $non_sticky_offset = $non_sticky_total - $non_sticky_number; 613 615 614 // Fetch the non-stickies 616 // Fetch the non-stickies. 615 617 $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, 1, $per_page, $max, 'no', $search_terms, $non_sticky_offset, $non_sticky_number ); 616 618 617 // If there are stickies to merge on this page, do it now 619 // If there are stickies to merge on this page, do it now. 618 620 if ( $this_page_stickies ) { 619 // Correct the topic_count 621 // Correct the topic_count. 620 622 $forum_template->topic_count += (int) $this_page_stickies; 621 623 622 // Figure out which stickies need to be included 624 // Figure out which stickies need to be included. 623 625 $this_page_sticky_topics = array_slice( $stickies_template->topics, 0 - $this_page_stickies ); 624 626 625 // Merge these topics into the forum template 627 // Merge these topics into the forum template. 626 628 $forum_template->topics = array_merge( $this_page_sticky_topics, (array) $forum_template->topics ); 627 629 } 628 630 } else { 629 // This page has no non-stickies 631 // This page has no non-stickies. 630 632 $forum_template = $stickies_template; 631 633 632 // Adjust the topic count and trim the topics 634 // Adjust the topic count and trim the topics. 633 635 $forum_template->topic_count = $this_page_stickies; 634 636 $forum_template->topics = array_slice( $forum_template->topics, $page - 1 ); … … 636 638 637 639 // Because we're using a manual offset and number for the topic query, we 638 // must set the page number manually, and recalculate the pagination links 640 // must set the page number manually, and recalculate the pagination links. 639 641 $forum_template->pag_num = $per_page; 640 642 $forum_template->pag_page = $page; … … 652 654 653 655 } else { 654 // Fetch the non-sticky topics if no stickies were found 656 // Fetch the non-sticky topics if no stickies were found. 655 657 $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'all', $search_terms ); 656 658 } 657 659 } else { 658 // When skipping the sticky logic, just pull up the forum topics like usual 660 // When skipping the sticky logic, just pull up the forum topics like usual. 659 661 $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'all', $search_terms ); 660 662 } … … 822 824 * @see bp_get_the_topic_poster_avatar() for a description of arguments. 823 825 * 824 * @param array $args See {@link bp_get_the_topic_poster_avatar()}.826 * @param array|string $args See {@link bp_get_the_topic_poster_avatar()}. 825 827 */ 826 828 function bp_the_topic_poster_avatar( $args = '' ) { … … 830 832 * Return the avatar of the user who posted the current topic in the loop. 831 833 * 832 * @param array $args {834 * @param array|string $args { 833 835 * Arguments for building the avatar. 834 * @type string $type Avatar type. 'thumb' or 'full'. Default:835 * 'thumb'.836 * @type int $widthWidth of the avatar, in pixels. Default: the837 * width corresponding to $type.838 * See {@link bp_core_fetch_avatar()}.839 * @type int $height Height of the avatar, in pixels. Default: the840 * height corresponding to $type.841 * See {@link bp_core_fetch_avatar()}.842 * @type string $alt The text of the image's 'alt' attribute.843 * Default: 'Profile picture of [user name]'.836 * @type string $type Avatar type. 'thumb' or 'full'. Default: 837 * 'thumb'. 838 * @type int $width Width of the avatar, in pixels. Default: the 839 * width corresponding to $type. 840 * See {@link bp_core_fetch_avatar()}. 841 * @type int $height Height of the avatar, in pixels. Default: the 842 * height corresponding to $type. 843 * See {@link bp_core_fetch_avatar()}. 844 * @type string $alt The text of the image's 'alt' attribute. 845 * Default: 'Profile picture of [user name]'. 844 846 * } 845 847 * @return string HTML of user avatar. … … 1006 1008 function bp_get_the_topic_object_permalink() { 1007 1009 1008 // Currently this will only work with group forums, extended support in the future 1010 // Currently this will only work with group forums, extended support in the future. 1009 1011 if ( bp_is_active( 'groups' ) ) { 1010 1012 $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum' ); … … 1036 1038 * 1037 1039 * @return string HTML link to the profile of the user who last posted 1038 * to the current topic.1040 * to the current topic. 1039 1041 */ 1040 1042 function bp_get_the_topic_last_poster_name() { … … 1044 1046 1045 1047 // In the case where no user is found, bp_core_get_user_domain() may return the URL 1046 // of the Members directory 1048 // of the Members directory. 1047 1049 if ( empty( $domain ) || ( bp_get_members_directory_permalink() === $domain ) ) { 1048 1050 return __( 'Deleted User', 'buddypress' ); … … 1064 1066 * @see bp_get_the_topic_object_avatar() for description of arguments. 1065 1067 * 1066 * @param array $args See {@bp_get_the_topic_object_avatar()}.1068 * @param array|string $args See {@bp_get_the_topic_object_avatar()}. 1067 1069 */ 1068 1070 function bp_the_topic_object_avatar( $args = '' ) { … … 1075 1077 * avatar of the group associated with the forum topic, if it exists. 1076 1078 * 1077 * @param array $args {1079 * @param array|string $args { 1078 1080 * Arguments for building the avatar. 1079 * @type string $type Avatar type. 'thumb' or 'full'. Default:1080 * 'thumb'.1081 * @type int $widthWidth of the avatar, in pixels. Default: the1082 * width corresponding to $type.1083 * See {@link bp_core_fetch_avatar()}.1084 * @type int $height Height of the avatar, in pixels. Default:1085 * the height corresponding to $type.1086 * See {@link bp_core_fetch_avatar()}.1087 * @type string $alt The text of the image's 'alt' attribute.1088 * Default: 'Group logo for [group name]'.1081 * @type string $type Avatar type. 'thumb' or 'full'. Default: 1082 * 'thumb'. 1083 * @type int $width Width of the avatar, in pixels. Default: the 1084 * width corresponding to $type. 1085 * See {@link bp_core_fetch_avatar()}. 1086 * @type int $height Height of the avatar, in pixels. Default: 1087 * the height corresponding to $type. 1088 * See {@link bp_core_fetch_avatar()}. 1089 * @type string $alt The text of the image's 'alt' attribute. 1090 * Default: 'Group logo for [group name]'. 1089 1091 * } 1090 1092 * @return string Object avatar. … … 1121 1123 * @see bp_get_the_topic_last_poster_avatar() for description of arguments. 1122 1124 * 1123 * @param array $args See {@bp_get_the_topic_last_poster_avatar()}.1125 * @param array|string $args See {@bp_get_the_topic_last_poster_avatar()}. 1124 1126 */ 1125 1127 function bp_the_topic_last_poster_avatar( $args = '' ) { … … 1129 1131 * Return the avatar for the user who last posted to the current topic in the loop. 1130 1132 * 1131 * @param array $args {1133 * @param array|string $args { 1132 1134 * Arguments for building the avatar. 1133 * @type string $type Avatar type. 'thumb' or 'full'. Default:1134 * 'thumb'.1135 * @type int $widthWidth of the avatar, in pixels. Default: the1136 * width corresponding to $type.1137 * See {@link bp_core_fetch_avatar()}.1138 * @type int $height Height of the avatar, in pixels. Default:1139 * the height corresponding to $type.1140 * See {@link bp_core_fetch_avatar()}.1141 * @type string $alt The text of the image's 'alt' attribute.1142 * Default: 'Profile picture of [group name]'.1135 * @type string $type Avatar type. 'thumb' or 'full'. Default: 1136 * 'thumb'. 1137 * @type int $width Width of the avatar, in pixels. Default: the 1138 * width corresponding to $type. 1139 * See {@link bp_core_fetch_avatar()}. 1140 * @type int $height Height of the avatar, in pixels. Default: 1141 * the height corresponding to $type. 1142 * See {@link bp_core_fetch_avatar()}. 1143 * @type string $alt The text of the image's 'alt' attribute. 1144 * Default: 'Profile picture of [group name]'. 1143 1145 * } 1144 1146 * @return string User avatar. … … 1272 1274 * Return whether the current topic in the loop is open. 1273 1275 * 1274 * @return unknown1276 * @return string 1275 1277 */ 1276 1278 function bp_get_the_topic_is_topic_open() { … … 1320 1322 * Return whether the current topic in the loop is sticky. 1321 1323 * 1322 * @return unknown1324 * @return bool 1323 1325 */ 1324 1326 function bp_get_the_topic_is_sticky() { … … 1428 1430 global $forum_template; 1429 1431 1430 // The topic is in a loop where its parent object is loaded 1432 // The topic is in a loop where its parent object is loaded. 1431 1433 if ( bp_get_the_topic_object_slug() ) { 1432 1434 $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum' ); 1433 1435 1434 // We are viewing a single group topic, so use the current item 1436 // We are viewing a single group topic, so use the current item. 1435 1437 } elseif ( bp_is_group_forum_topic() ) { 1436 1438 $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_current_item() . '/forum' ); 1437 1439 1438 // We are unsure what the context is, so fallback to forum root slug 1440 // We are unsure what the context is, so fallback to forum root slug. 1439 1441 } elseif ( bp_is_single_item() ) { 1440 1442 $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item() ); 1441 1443 1442 // This is some kind of error situation, so use forum root 1444 // This is some kind of error situation, so use forum root. 1443 1445 } else { 1444 1446 $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ); … … 1483 1485 /** 1484 1486 * Output an excerpt from the latest post of the current topic in the loop. 1487 * 1488 * @param array|string $args See {@bp_get_the_topic_latest_post_excerpt()}. 1485 1489 */ 1486 1490 function bp_the_topic_latest_post_excerpt( $args = '' ) { … … 1490 1494 * Return an excerpt from the latest post of the current topic in the loop. 1491 1495 * 1492 * @param array $args {1496 * @param array|string $args { 1493 1497 * @type int $length The length of the excerpted text. Default: 225. 1494 1498 * } … … 1555 1559 * 1556 1560 * @return bool True if the current topic in the loop was created by 1557 * the logged-in user, otherwise false.1561 * the logged-in user, otherwise false. 1558 1562 */ 1559 1563 function bp_get_the_topic_is_mine() { … … 1568 1572 * @see bp_get_the_topic_admin_links() for a description of arguments. 1569 1573 * 1570 * @param array $args See {@link bp_get_the_topic_admin_links()}.1574 * @param array|string $args See {@link bp_get_the_topic_admin_links()}. 1571 1575 */ 1572 1576 function bp_the_topic_admin_links( $args = '' ) { … … 1576 1580 * Return the admin links for the current topic in the loop. 1577 1581 * 1578 * @param array $args { 1579 * @type string $separator The character to use when separating 1580 * links. Default: '|'. 1582 * @param array|string $args { 1583 * @type string $separator The character to use when separating links. Default: '|'. 1581 1584 * } 1582 * @return HTML string containing the admin links for the current topic.1585 * @return string HTML string containing the admin links for the current topic. 1583 1586 */ 1584 1587 function bp_get_the_topic_admin_links( $args = '' ) { … … 1785 1788 * @uses apply_filters() Filter bp_get_forum_topic_new_reply_link to 1786 1789 * modify. 1790 * 1787 1791 * @return string The URL for the New Reply link. 1788 1792 */ … … 1791 1795 1792 1796 if ( $topic_template->pag->total_pages == $topic_template->pag_page ) { 1793 // If we are on the last page, no need for a URL base 1797 // If we are on the last page, no need for a URL base. 1794 1798 $link = ''; 1795 1799 } else { 1796 // Create a link to the last page for the topic 1800 // Create a link to the last page for the topic. 1797 1801 $link = add_query_arg( array( 1798 1802 'topic_page' => $topic_template->pag->total_pages, … … 1994 1998 * 1995 1999 * @access public 1996 * @var public2000 * @var int 1997 2001 */ 1998 2002 public $pag_page; … … 2002 2006 * 2003 2007 * @access public 2004 * @var public2008 * @var int 2005 2009 */ 2006 2010 public $pag_num; … … 2049 2053 * Constructor method. 2050 2054 * 2051 * @param int $topic_id ID of the topic whose posts are being requested.2052 * @param int $per_page Number of items to return per page.2053 * @param int $max Max records to return.2055 * @param int $topic_id ID of the topic whose posts are being requested. 2056 * @param int $per_page Number of items to return per page. 2057 * @param int $max Max records to return. 2054 2058 * @param string $order Direction to order results. 2055 2059 */ … … 2092 2096 } 2093 2097 2094 // Load topic tags 2098 // Load topic tags. 2095 2099 $this->topic_tags = bb_get_topic_tags( $this->topic_id ); 2096 2100 … … 2173 2177 */ 2174 2178 do_action('topic_loop_end'); 2175 // Do some cleaning up after the loop 2179 // Do some cleaning up after the loop. 2176 2180 $this->rewind_posts(); 2177 2181 } … … 2207 2211 * Initiate the loop for a single topic's posts. 2208 2212 * 2209 * @param array $args {2213 * @param array|string $args { 2210 2214 * Arguments for limiting the contents of the topic posts loop. 2211 * @type int $topic_id ID of the topic to which the posts belong.2212 * @type int $per_page Number of items to return per page. Default: 15.2213 * @type int $maxMax items to return. Default: false.2214 * @type string $order 'ASC' or 'DESC'.2215 * @type int $topic_id ID of the topic to which the posts belong. 2216 * @type int $per_page Number of items to return per page. Default: 15. 2217 * @type int $max Max items to return. Default: false. 2218 * @type string $order 'ASC' or 'DESC'. 2215 2219 * } 2216 2220 * @return bool True when posts are found corresponding to the args, 2217 * otherwise false.2221 * otherwise false. 2218 2222 */ 2219 2223 function bp_has_forum_topic_posts( $args = '' ) { … … 2241 2245 $topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order ); 2242 2246 2243 // Current topic forum_id needs to match current_group forum_id 2247 // Current topic forum_id needs to match current_group forum_id. 2244 2248 if ( bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta( bp_get_current_group_id(), 'forum_id' ) ) 2245 2249 return false; … … 2338 2342 * 2339 2343 * @return string String to put in the 'class' attribute of the current 2340 * post.2344 * post. 2341 2345 */ 2342 2346 function bp_get_the_topic_post_css_class() { … … 2372 2376 * @see bp_get_the_topic_post_poster_avatar() for a description of arguments. 2373 2377 * 2374 * @param array $args See {@link bp_get_the_topic_post_poster_avatar()}.2378 * @param array|string $args See {@link bp_get_the_topic_post_poster_avatar()}. 2375 2379 */ 2376 2380 function bp_the_topic_post_poster_avatar( $args = '' ) { … … 2380 2384 * Return the avatar of the user who posted the current post in the loop. 2381 2385 * 2382 * @param array $args {2386 * @param array|string $args { 2383 2387 * Arguments for building the avatar. 2384 * @type string $type Avatar type. 'thumb' or 'full'. Default:2385 * 'thumb'.2386 * @type int $widthWidth of the avatar, in pixels. Default: the2387 * width corresponding to $type.2388 * See {@link bp_core_fetch_avatar()}.2389 * @type int $height Height of the avatar, in pixels. Default: the2390 * height corresponding to $type.2391 * See {@link bp_core_fetch_avatar()}.2392 * @type string $alt The text of the image's 'alt' attribute.2393 * Default: 'Profile picture of [user name]'.2388 * @type string $type Avatar type. 'thumb' or 'full'. Default: 2389 * 'thumb'. 2390 * @type int $width Width of the avatar, in pixels. Default: the 2391 * width corresponding to $type. 2392 * See {@link bp_core_fetch_avatar()}. 2393 * @type int $height Height of the avatar, in pixels. Default: the 2394 * height corresponding to $type. 2395 * See {@link bp_core_fetch_avatar()}. 2396 * @type string $alt The text of the image's 'alt' attribute. 2397 * Default: 'Profile picture of [user name]'. 2394 2398 * } 2395 2399 * @return string HTML of user avatar. … … 2455 2459 * 2456 2460 * @return string Link to the profile of the user who posted the 2457 * current post.2461 * current post. 2458 2462 */ 2459 2463 function bp_get_the_topic_post_poster_link() { … … 2506 2510 * 2507 2511 * @return bool True if the current post in the loop was created by 2508 * the logged-in user, otherwise false.2512 * the logged-in user, otherwise false. 2509 2513 */ 2510 2514 function bp_get_the_topic_post_is_mine() { … … 2519 2523 * @see bp_get_the_post_admin_links() for a description of arguments. 2520 2524 * 2521 * @param array $args See {@link bp_get_the_post_admin_links()}.2525 * @param array|string $args See {@link bp_get_the_post_admin_links()}. 2522 2526 */ 2523 2527 function bp_the_topic_post_admin_links( $args = '' ) { … … 2527 2531 * Return the admin links for the current post in the loop. 2528 2532 * 2529 * @param array $args {2533 * @param array|string $args { 2530 2534 * @type string $separator The character to use when separating 2531 * links. Default: '|'.2535 * links. Default: '|'. 2532 2536 * } 2533 * @return HTML string containing the admin links for the current post.2537 * @return string HTML string containing the admin links for the current post. 2534 2538 */ 2535 2539 function bp_get_the_topic_post_admin_links( $args = '' ) { … … 2618 2622 * 2619 2623 * The "count" is a string of the form "Viewing x of y posts". 2620 *2621 * @return string2622 2624 */ 2623 2625 function bp_the_topic_pagination_count() { … … 2658 2660 * 2659 2661 * @return bool True if this is the last page of posts for the current 2660 * topic, otherwise false.2662 * topic, otherwise false. 2661 2663 */ 2662 2664 function bp_get_the_topic_is_last_page() { … … 2690 2692 * @since 1.9.0 2691 2693 * 2692 * @param string HTML search form for the forums directory.2694 * @param string $search_form_html HTML search form for the forums directory. 2693 2695 */ 2694 2696 echo apply_filters( 'bp_directory_forums_search_form', $search_form_html ); … … 2709 2711 * 2710 2712 * @param int $forum_id Optional. Defaults to the current forum, if 2711 * there is one.2713 * there is one. 2712 2714 * @return string|bool False on failure, a URL on success. 2713 2715 */ … … 2753 2755 * 2754 2756 * @param int $forum_id Optional. Defaults to the current forum, if 2755 * there is one.2757 * there is one. 2756 2758 * @return string|bool False on failure, a name on success. 2757 2759 */ … … 2786 2788 * defaults. 2787 2789 * 2788 * @param array $args {2790 * @param array|string $args { 2789 2791 * An array of optional arguments. 2790 * @type int $smallest Size of the smallest link. Default: 10.2791 * @type int $largestSize of the largest link. Default: 42.2792 * @type string $sizing Unit for $largest and $smallest. Default: 'px'.2793 * @type int $limitMax number of tags to display. Default: 50.2792 * @type int $smallest Size of the smallest link. Default: 10. 2793 * @type int $largest Size of the largest link. Default: 42. 2794 * @type string $sizing Unit for $largest and $smallest. Default: 'px'. 2795 * @type int $limit Max number of tags to display. Default: 50. 2794 2796 * } 2795 2797 */ … … 2809 2811 2810 2812 /** 2811 * Output the current topic's tag list, comma-separated 2813 * Output the current topic's tag list, comma-separated. 2812 2814 * 2813 2815 * @since 1.5.0 … … 2822 2824 * 2823 2825 * @param string $format 'string' returns comma-separated string; 2824 * otherwise returns array.2826 * otherwise returns array. 2825 2827 * @return mixed $tags 2826 2828 */
Note: See TracChangeset
for help on using the changeset viewer.