Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/04/2015 07:29:24 AM (5 years ago)
Author:
tw2113
Message:

Initial documentation cleanup for the BP Forums Component.

See #6397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-forums/bp-forums-template.php

    r10126 r10183  
    213213     * Constructor method.
    214214     *
    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.
    227228     */
    228229    function __construct( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms, $offset = false, $number = false ) {
     
    275276        } else {
    276277            // Get a total topic count, for use in pagination. This value will differ
    277             // depending on scope
     278            // depending on scope.
    278279            if ( !empty( $forum_id ) ) {
    279                 // Group forums
     280                // Group forums.
    280281                $topic_count = bp_forums_get_forum( $forum_id );
    281282                $topic_count = (int) $topic_count->topics;
     
    284285            } else if ( bp_is_user_forums_started() || ( bp_is_directory() && $user_id ) ) {
    285286                // This covers the case of Profile > Forums > Topics Started, as
    286                 // well as Forum Directory > My Topics
     287                // well as Forum Directory > My Topics.
    287288                $topic_count = bp_forums_total_topic_count_for_user( bp_displayed_user_id(), $type );
    288289            } else if ( bp_is_user_forums_replied_to() ) {
    289                 // Profile > Forums > Replied To
     290                // Profile > Forums > Replied To.
    290291                $topic_count = bp_forums_total_replied_count_for_user( bp_displayed_user_id(), $type );
    291292            } else if ( 'tags' == $type ) {
     
    294295            } else {
    295296                // For forum directories (All Topics), get a true count
    296                 $status = bp_current_user_can( 'bp_moderate' ) ? 'all' : 'public'; // todo: member-of
     297                $status = bp_current_user_can( 'bp_moderate' ) ? 'all' : 'public'; // @todo: member-of.
    297298                $topic_count = (int)groups_total_forum_topic_count( $status, $search_terms );
    298299            }
     
    348349        $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 ) );
    349350
    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.
    351352        $this->topics = bp_forums_get_topic_extras( $this->topics );
    352353
     
    373374     */
    374375    function has_topics() {
    375         if ( $this->topic_count )
     376        if ( $this->topic_count ) {
    376377            return true;
     378        }
    377379
    378380        return false;
     
    423425             */
    424426            do_action('forum_loop_end');
    425             // Do some cleaning up after the loop
     427            // Do some cleaning up after the loop.
    426428            $this->rewind_topics();
    427429        }
     
    466468 *       of has_topics().
    467469 *
    468  * @param array $args {
     470 * @param array|string $args {
    469471 *     Arguments for limiting the contents of the forum topics loop.
    470472 *
    471  *     @type string $type The 'type' is the sort order/kind. 'newest',
    472  *           'popular', 'unreplied', 'tags'. Default: 'newest'.
    473  *     @type int $forum_id The ID of the forum for which topics are being
    474  *           queried. Default: the ID of the forum belonging to the current
    475  *           group, if available.
    476  *     @type int $user_id The ID of a user to whom to limit results. If viewing
    477  *           a member's profile, defaults to that member's ID; otherwise
    478  *           defaults to 0.
    479  *     @type int $page The number of the page being requested. Default: 1, or
    480  *           the value of $_GET['p'].
    481  *     @type int $per_pag The number items to return per page. Default: 20, or
    482  *           the value of $_GET['n'].
    483  *     @type int $max Optional. Max records to return. Default: false (no max).
    484  *     @type int $number Optional. Number of records to return. Default: false.
    485  *     @type int $offset Optional. Offset results by a given value.
    486  *           Default: false.
    487  *     @type string $search_terms Optional. A string to which results should be
    488  *           limited. Default: false, or the value of $_GET['fs'].
    489  *     @type string|bool $do_stickies Whether to move stickies to the top of
    490  *           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.
    492494 * }
    493495 * @return bool True when forum topics are found corresponding to the args,
     
    499501    $bp = buddypress();
    500502
    501     /***
     503    /*
    502504     * Set the defaults based on the current page. Any of these will be overridden
    503505     * if arguments are directly passed into the loop. Custom plugins should always
     
    510512    $do_stickies  = false;
    511513
    512     // User filtering
     514    // User filtering.
    513515    if ( bp_displayed_user_id() )
    514516        $user_id = bp_displayed_user_id();
     
    516518    // "Replied" query must be manually modified
    517519    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.
    519521
    520522        add_filter( 'get_topics_distinct',   'bp_forums_add_replied_distinct_sql', 20 );
     
    523525    }
    524526
    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.
    526528    if ( !$forum_id && !empty( $bp->groups->current_group ) ) {
    527529        $bp->groups->current_group->forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );
    528530
    529531        // 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.
    531533        if ( empty( $bp->groups->current_group->forum_id ) )
    532534            return false;
     
    535537    }
    536538
    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.
    538540    if ( bp_is_directory() && !empty( $_GET['fs'] ) )
    539541        $search_terms = $_GET['fs'];
    540542
    541     // Get the pagination arguments from $_REQUEST
     543    // Get the pagination arguments from $_REQUEST.
    542544    $page     = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : 1;
    543545    $per_page = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : 20;
    544546
    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.
    546548    if ( bp_is_group_forum() )
    547549        $do_stickies = true;
     
    564566
    565567    // 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.
    567569    if ( bp_is_current_action( 'tag' ) && $search_terms = bp_action_variable( 0 ) ) {
    568570        $type = 'tags';
     
    572574
    573575    if ( $do_stickies ) {
    574         // Fetch the stickies
     576        // Fetch the stickies.
    575577        $stickies_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, 0, 0, $max, 'sticky', $search_terms );
    576578
    577         // If stickies are found, try merging them
     579        // If stickies are found, try merging them.
    578580        if ( $stickies_template->has_topics() ) {
    579581
    580             // If stickies are for current $page
     582            // If stickies are for current $page.
    581583            $page_start_num = ( ( $page - 1 ) * $per_page ) + 1;
    582584            $page_end_num   = $page * $per_page <= $stickies_template->total_topic_count ? $page * $per_page : $stickies_template->total_topic_count;
    583585
    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.
    585587            if ( $stickies_template->topic_count < $page_start_num ) {
    586588                $this_page_stickies = 0;
    587589            } 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.
    589591
    590592                // $this_page_stickies cannot be more than $per_page or less than 0
     
    595597            }
    596598
    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.
    598600            $this_page_topics = $stickies_template->total_topic_count >= ( $page * $per_page ) ? $per_page : $page_end_num - ( $page_start_num - 1 );
    599601
    600602            // 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.
    602604            if ( $this_page_stickies < $this_page_topics ) {
    603605                // How many non-stickies do we need?
     
    609611
    610612                // 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.
    612614                $non_sticky_offset = $non_sticky_total - $non_sticky_number;
    613615
    614                 // Fetch the non-stickies
     616                // Fetch the non-stickies.
    615617                $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 );
    616618
    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.
    618620                if ( $this_page_stickies ) {
    619                     // Correct the topic_count
     621                    // Correct the topic_count.
    620622                    $forum_template->topic_count += (int) $this_page_stickies;
    621623
    622                     // Figure out which stickies need to be included
     624                    // Figure out which stickies need to be included.
    623625                    $this_page_sticky_topics = array_slice( $stickies_template->topics, 0 - $this_page_stickies );
    624626
    625                     // Merge these topics into the forum template
     627                    // Merge these topics into the forum template.
    626628                    $forum_template->topics = array_merge( $this_page_sticky_topics, (array) $forum_template->topics );
    627629                }
    628630            } else {
    629                 // This page has no non-stickies
     631                // This page has no non-stickies.
    630632                $forum_template = $stickies_template;
    631633
    632                 // Adjust the topic count and trim the topics
     634                // Adjust the topic count and trim the topics.
    633635                $forum_template->topic_count = $this_page_stickies;
    634636                $forum_template->topics      = array_slice( $forum_template->topics, $page - 1 );
     
    636638
    637639            // 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.
    639641            $forum_template->pag_num     = $per_page;
    640642            $forum_template->pag_page    = $page;
     
    652654
    653655        } else {
    654             // Fetch the non-sticky topics if no stickies were found
     656            // Fetch the non-sticky topics if no stickies were found.
    655657            $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'all', $search_terms );
    656658        }
    657659    } 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.
    659661        $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'all', $search_terms );
    660662    }
     
    822824 * @see bp_get_the_topic_poster_avatar() for a description of arguments.
    823825 *
    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()}.
    825827 */
    826828function bp_the_topic_poster_avatar( $args = '' ) {
     
    830832     * Return the avatar of the user who posted the current topic in the loop.
    831833     *
    832      * @param array $args {
     834     * @param array|string $args {
    833835     *     Arguments for building the avatar.
    834      *     @type string $type Avatar type. 'thumb' or 'full'. Default:
    835      *           'thumb'.
    836      *     @type int $width Width of the avatar, in pixels. Default: the
    837      *           width corresponding to $type.
    838      *           See {@link bp_core_fetch_avatar()}.
    839      *     @type int $height Height of the avatar, in pixels. Default: the
    840      *           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]'.
    844846     * }
    845847     * @return string HTML of user avatar.
     
    10061008    function bp_get_the_topic_object_permalink() {
    10071009
    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.
    10091011        if ( bp_is_active( 'groups' ) ) {
    10101012            $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum' );
     
    10361038     *
    10371039     * @return string HTML link to the profile of the user who last posted
    1038      *         to the current topic.
     1040     *                to the current topic.
    10391041     */
    10401042    function bp_get_the_topic_last_poster_name() {
     
    10441046
    10451047        // 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.
    10471049        if ( empty( $domain ) || ( bp_get_members_directory_permalink() === $domain ) ) {
    10481050            return __( 'Deleted User', 'buddypress' );
     
    10641066 * @see bp_get_the_topic_object_avatar() for description of arguments.
    10651067 *
    1066  * @param array $args See {@bp_get_the_topic_object_avatar()}.
     1068 * @param array|string $args See {@bp_get_the_topic_object_avatar()}.
    10671069 */
    10681070function bp_the_topic_object_avatar( $args = '' ) {
     
    10751077     * avatar of the group associated with the forum topic, if it exists.
    10761078     *
    1077      * @param array $args {
     1079     * @param array|string $args {
    10781080     *     Arguments for building the avatar.
    1079      *     @type string $type Avatar type. 'thumb' or 'full'. Default:
    1080      *           'thumb'.
    1081      *     @type int $width Width of the avatar, in pixels. Default: the
    1082      *           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]'.
    10891091     * }
    10901092     * @return string Object avatar.
     
    11211123 * @see bp_get_the_topic_last_poster_avatar() for description of arguments.
    11221124 *
    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()}.
    11241126 */
    11251127function bp_the_topic_last_poster_avatar( $args = '' ) {
     
    11291131     * Return the avatar for the user who last posted to the current topic in the loop.
    11301132     *
    1131      * @param array $args {
     1133     * @param array|string $args {
    11321134     *     Arguments for building the avatar.
    1133      *     @type string $type Avatar type. 'thumb' or 'full'. Default:
    1134      *           'thumb'.
    1135      *     @type int $width Width of the avatar, in pixels. Default: the
    1136      *           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]'.
    11431145     * }
    11441146     * @return string User avatar.
     
    12721274     * Return whether the current topic in the loop is open.
    12731275     *
    1274      * @return unknown
     1276     * @return string
    12751277     */
    12761278    function bp_get_the_topic_is_topic_open() {
     
    13201322     * Return whether the current topic in the loop is sticky.
    13211323     *
    1322      * @return unknown
     1324     * @return bool
    13231325     */
    13241326    function bp_get_the_topic_is_sticky() {
     
    14281430        global $forum_template;
    14291431
    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.
    14311433        if ( bp_get_the_topic_object_slug() ) {
    14321434            $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum' );
    14331435
    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.
    14351437        } elseif ( bp_is_group_forum_topic() ) {
    14361438            $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_current_item() . '/forum' );
    14371439
    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.
    14391441        } elseif ( bp_is_single_item() ) {
    14401442            $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item() );
    14411443
    1442         // This is some kind of error situation, so use forum root
     1444        // This is some kind of error situation, so use forum root.
    14431445        } else {
    14441446            $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() );
     
    14831485/**
    14841486 * 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()}.
    14851489 */
    14861490function bp_the_topic_latest_post_excerpt( $args = '' ) {
     
    14901494     * Return an excerpt from the latest post of the current topic in the loop.
    14911495     *
    1492      * @param array $args {
     1496     * @param array|string $args {
    14931497     *     @type int $length The length of the excerpted text. Default: 225.
    14941498     * }
     
    15551559     *
    15561560     * @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.
    15581562     */
    15591563    function bp_get_the_topic_is_mine() {
     
    15681572 * @see bp_get_the_topic_admin_links() for a description of arguments.
    15691573 *
    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()}.
    15711575 */
    15721576function bp_the_topic_admin_links( $args = '' ) {
     
    15761580     * Return the admin links for the current topic in the loop.
    15771581     *
    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: '|'.
    15811584     * }
    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.
    15831586     */
    15841587    function bp_get_the_topic_admin_links( $args = '' ) {
     
    17851788     * @uses apply_filters() Filter bp_get_forum_topic_new_reply_link to
    17861789     *       modify.
     1790     *
    17871791     * @return string The URL for the New Reply link.
    17881792     */
     
    17911795
    17921796        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.
    17941798            $link = '';
    17951799        } else {
    1796             // Create a link to the last page for the topic
     1800            // Create a link to the last page for the topic.
    17971801            $link = add_query_arg( array(
    17981802                'topic_page' => $topic_template->pag->total_pages,
     
    19941998     *
    19951999     * @access public
    1996      * @var public
     2000     * @var int
    19972001     */
    19982002    public $pag_page;
     
    20022006     *
    20032007     * @access public
    2004      * @var public
     2008     * @var int
    20052009     */
    20062010    public $pag_num;
     
    20492053     * Constructor method.
    20502054     *
    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.
    20542058     * @param string $order Direction to order results.
    20552059     */
     
    20922096        }
    20932097
    2094         // Load topic tags
     2098        // Load topic tags.
    20952099        $this->topic_tags = bb_get_topic_tags( $this->topic_id );
    20962100
     
    21732177             */
    21742178            do_action('topic_loop_end');
    2175             // Do some cleaning up after the loop
     2179            // Do some cleaning up after the loop.
    21762180            $this->rewind_posts();
    21772181        }
     
    22072211 * Initiate the loop for a single topic's posts.
    22082212 *
    2209  * @param array $args {
     2213 * @param array|string $args {
    22102214 *     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 $max Max 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'.
    22152219 * }
    22162220 * @return bool True when posts are found corresponding to the args,
    2217  *         otherwise false.
     2221 *              otherwise false.
    22182222 */
    22192223function bp_has_forum_topic_posts( $args = '' ) {
     
    22412245        $topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order );
    22422246
    2243         // Current topic forum_id needs to match current_group forum_id
     2247        // Current topic forum_id needs to match current_group forum_id.
    22442248        if ( bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta( bp_get_current_group_id(), 'forum_id' ) )
    22452249            return false;
     
    23382342     *
    23392343     * @return string String to put in the 'class' attribute of the current
    2340      *         post.
     2344     *                post.
    23412345     */
    23422346    function bp_get_the_topic_post_css_class() {
     
    23722376 * @see bp_get_the_topic_post_poster_avatar() for a description of arguments.
    23732377 *
    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()}.
    23752379 */
    23762380function bp_the_topic_post_poster_avatar( $args = '' ) {
     
    23802384     * Return the avatar of the user who posted the current post in the loop.
    23812385     *
    2382      * @param array $args {
     2386     * @param array|string $args {
    23832387     *     Arguments for building the avatar.
    2384      *     @type string $type Avatar type. 'thumb' or 'full'. Default:
    2385      *           'thumb'.
    2386      *     @type int $width Width of the avatar, in pixels. Default: the
    2387      *           width corresponding to $type.
    2388      *           See {@link bp_core_fetch_avatar()}.
    2389      *     @type int $height Height of the avatar, in pixels. Default: the
    2390      *           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]'.
    23942398     * }
    23952399     * @return string HTML of user avatar.
     
    24552459     *
    24562460     * @return string Link to the profile of the user who posted the
    2457      *         current post.
     2461     *                current post.
    24582462     */
    24592463    function bp_get_the_topic_post_poster_link() {
     
    25062510     *
    25072511     * @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.
    25092513     */
    25102514    function bp_get_the_topic_post_is_mine() {
     
    25192523 * @see bp_get_the_post_admin_links() for a description of arguments.
    25202524 *
    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()}.
    25222526 */
    25232527function bp_the_topic_post_admin_links( $args = '' ) {
     
    25272531     * Return the admin links for the current post in the loop.
    25282532     *
    2529      * @param array $args {
     2533     * @param array|string $args {
    25302534     *     @type string $separator The character to use when separating
    2531      *           links. Default: '|'.
     2535     *                             links. Default: '|'.
    25322536     * }
    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.
    25342538     */
    25352539    function bp_get_the_topic_post_admin_links( $args = '' ) {
     
    26182622 *
    26192623 * The "count" is a string of the form "Viewing x of y posts".
    2620  *
    2621  * @return string
    26222624 */
    26232625function bp_the_topic_pagination_count() {
     
    26582660     *
    26592661     * @return bool True if this is the last page of posts for the current
    2660      *         topic, otherwise false.
     2662     *              topic, otherwise false.
    26612663     */
    26622664    function bp_get_the_topic_is_last_page() {
     
    26902692     * @since 1.9.0
    26912693     *
    2692      * @param string HTML search form for the forums directory.
     2694     * @param string $search_form_html HTML search form for the forums directory.
    26932695     */
    26942696    echo apply_filters( 'bp_directory_forums_search_form', $search_form_html );
     
    27092711     *
    27102712     * @param int $forum_id Optional. Defaults to the current forum, if
    2711      *        there is one.
     2713     *                      there is one.
    27122714     * @return string|bool False on failure, a URL on success.
    27132715     */
     
    27532755     *
    27542756     * @param int $forum_id Optional. Defaults to the current forum, if
    2755      *        there is one.
     2757     *                      there is one.
    27562758     * @return string|bool False on failure, a name on success.
    27572759     */
     
    27862788 * defaults.
    27872789 *
    2788  * @param array $args {
     2790 * @param array|string $args {
    27892791 *     An array of optional arguments.
    2790  *     @type int $smallest Size of the smallest link. Default: 10.
    2791  *     @type int $largest Size of the largest link. Default: 42.
    2792  *     @type string $sizing Unit for $largest and $smallest. Default: 'px'.
    2793  *     @type int $limit Max 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.
    27942796 * }
    27952797 */
     
    28092811
    28102812/**
    2811  * Output the current topic's tag list, comma-separated
     2813 * Output the current topic's tag list, comma-separated.
    28122814 *
    28132815 * @since 1.5.0
     
    28222824     *
    28232825     * @param string $format 'string' returns comma-separated string;
    2824      *        otherwise returns array.
     2826     *                       otherwise returns array.
    28252827     * @return mixed $tags
    28262828     */
Note: See TracChangeset for help on using the changeset viewer.