Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/21/2015 12:13:52 AM (10 years ago)
Author:
tw2113
Message:

Add hook documentation to BP Forums component.

Fixes #5941.

File:
1 edited

Legend:

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

    r9351 r9383  
    2929    function bp_get_forums_slug() {
    3030        global $bp;
     31
     32        /**
     33         * Filters the forums component slug.
     34         *
     35         * @since BuddyPress (1.5.0)
     36         *
     37         * @param string $slug Forums component slug.
     38         */
    3139        return apply_filters( 'bp_get_forums_slug', $bp->forums->slug );
    3240    }
     
    5159    function bp_get_forums_root_slug() {
    5260        global $bp;
     61
     62        /**
     63         * Filters the forums component root slug.
     64         *
     65         * @since BuddyPress (1.5.0)
     66         *
     67         * @param string $root_slug Forums component root slug.
     68         */
    5369        return apply_filters( 'bp_get_forums_root_slug', $bp->forums->root_slug );
    5470    }
     
    7793     */
    7894    function bp_get_forums_directory_permalink() {
     95
     96        /**
     97         * Filters the permalink for the forum directory.
     98         *
     99         * @since BuddyPress (1.5.0)
     100         *
     101         * @param string $value Permalink for the forum directory.
     102         */
    79103        return apply_filters( 'bp_get_forums_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ) );
    80104    }
     
    235259        }
    236260
     261        /**
     262         * Filters the forums template topics.
     263         *
     264         * @since BuddyPress (1.1.0)
     265         *
     266         * @param array  $topics      Array of topics being set for display.
     267         * @param string $type        The sort order/kind. 'newest',
     268         *                            'popular', 'unreplied', 'tags'.
     269         * @param int    $forum_id    ID for the current forum.
     270         * @param int    $per_page    The number of the page being requested.
     271         * @param int    $max         The max number of posts to show.
     272         * @param string $no_stickies Requested sticky format.
     273         */
    237274        $this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies );
    238275
     
    282319        }
    283320
     321        /**
     322         * Filters the topic count for the forum being displayed.
     323         *
     324         * @since BuddyPress (1.1.0)
     325         *
     326         * @param int    $topic_count Topic count to be displayed.
     327         * @param array  $topics      Array of topics to be displayed.
     328         * @param string $type        The sort order/kind. 'newest',
     329         *                            'popular', 'unreplied', 'tags'.
     330         * @param int    $forum_id    ID for the current forum.
     331         * @param int    $per_page    The number of the page being requested.
     332         * @param int    $max         The max number of posts to show.
     333         * @param string $no_stickies Requested sticky format.
     334         */
    284335        $this->topic_count       = apply_filters_ref_array( 'bp_forums_template_topic_count',                                 array( $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
     336
     337        /**
     338         * Filters the total topic count for the forum being displayed.
     339         *
     340         * @since BuddyPress (1.1.0)
     341         *
     342         * @param int    $total_topic_count Total topic count found.
     343         * @param int    $topic_count       Topic count to be displayed.
     344         * @param array  $topics            Array of topics to be displayed.
     345         * @param string $type              The sort order/kind. 'newest',
     346         *                                  'popular', 'unreplied', 'tags'.
     347         * @param int    $forum_id          ID for the current forum.
     348         * @param int    $per_page          The number of the page being requested.
     349         * @param int    $max               The max number of posts to show.
     350         * @param string $no_stickies       Requested sticky format.
     351         */
    285352        $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 ) );
    286353
     
    353420            return true;
    354421        } elseif ( $this->current_topic + 1 == $this->topic_count ) {
     422
     423            /**
     424             * Fires right before the rewinding of user topics.
     425             *
     426             * @since BuddyPress (1.5.0)
     427             */
    355428            do_action('forum_loop_end');
    356429            // Do some cleaning up after the loop
     
    374447        $this->topic = (object)$this->topic;
    375448
    376         if ( $this->current_topic == 0 ) // loop has just started
    377             do_action('forum_loop_start');
     449        if ( $this->current_topic == 0 ) {
     450
     451            /**
     452             * Fires if the current topic item is the first in the topic loop.
     453             *
     454             * @since BuddyPress (1.5.0)
     455             */
     456            do_action( 'forum_loop_start' );
     457        }
    378458    }
    379459}
     
    582662    }
    583663
     664    /**
     665     * Filters whether or not there are topics to display.
     666     *
     667     * @since BuddyPress (1.1.0)
     668     *
     669     * @param bool   $value          Whether or not there are topics to display.
     670     * @param object $forum_template Global $forum_template object.
     671     */
    584672    return apply_filters( 'bp_has_topics', $forum_template->has_topics(), $forum_template );
    585673}
     
    623711        global $forum_template;
    624712
     713        /**
     714         * Filters the ID of the current topic in the loop.
     715         *
     716         * @since BuddyPress (1.0.0)
     717         *
     718         * @param int $topic_id ID for the current topic.
     719         */
    625720        return apply_filters( 'bp_get_the_topic_id', $forum_template->topic->topic_id );
    626721    }
     
    640735        global $forum_template;
    641736
     737        /**
     738         * Filters the title of the current topic in the loop.
     739         *
     740         * @since BuddyPress (1.0.0)
     741         *
     742         * @param string $topic_title Title for the current topic.
     743         */
    642744        return apply_filters( 'bp_get_the_topic_title', stripslashes( $forum_template->topic->topic_title ) );
    643745    }
     
    657759        global $forum_template;
    658760
     761        /**
     762         * Filters the slug of the current topic in the loop.
     763         *
     764         * @since BuddyPress (1.0.0)
     765         *
     766         * @param string $topic_slug Slug for the current topic.
     767         */
    659768        return apply_filters( 'bp_get_the_topic_slug', $forum_template->topic->topic_slug );
    660769    }
     
    675784
    676785        $post = bb_get_first_post( (int) $forum_template->topic->topic_id, false );
     786
     787        /**
     788         * Filters the text of the first post in the current topic in the loop.
     789         *
     790         * @since BuddyPress (1.1.0)
     791         *
     792         * @param string $post_text Text for the first post in the current topic.
     793         */
    677794        return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) );
    678795    }
     
    692809        global $forum_template;
    693810
     811        /**
     812         * Filters the ID of the user who posted the current topic in the loop.
     813         *
     814         * @since BuddyPress (1.0.0)
     815         *
     816         * @param int $topic_poster ID for the user.
     817         */
    694818        return apply_filters( 'bp_get_the_topic_poster_id', $forum_template->topic->topic_poster );
    695819    }
     
    736860        extract( $r, EXTR_SKIP );
    737861
     862        /**
     863         * Filters the avatar for the user who posted the current topic in the loop.
     864         *
     865         * @since BuddyPress (1.0.0)
     866         *
     867         * @param string $value HTML for the display of the user's avatar.
     868         */
    738869        return apply_filters( 'bp_get_the_topic_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
    739870    }
     
    758889            return __( 'Deleted User', 'buddypress' );
    759890
     891        /**
     892         * Filters the name of the user who posted the current topic in the loop.
     893         *
     894         * @since BuddyPress (1.0.0)
     895         *
     896         * @param string $name Name for the user who posted the current topic.
     897         */
    760898        return apply_filters( 'bp_get_the_topic_poster_name', $name );
    761899    }
     
    777915        global $forum_template;
    778916
     917        /**
     918         * Filters the ID of the object associated with the current topic in the loop.
     919         *
     920         * Objects are things like associated groups.
     921         *
     922         * @since BuddyPress (1.1.0)
     923         *
     924         * @param int $object_id ID for the object associated with the current topic.
     925         */
    779926        return apply_filters( 'bp_get_the_topic_object_id', $forum_template->topic->object_id );
    780927    }
     
    802949            $retval = '';
    803950
     951        /**
     952         * Filters the name of the object associated with the current topic in the loop.
     953         *
     954         * Objects are things like groups. So this filter would return the
     955         * name of the group associated with the forum topic, if it exists.
     956         *
     957         * @since BuddyPress (1.1.0)
     958         *
     959         * @param string $retval Name for the object associated with the current topic.
     960         */
    804961        return apply_filters( 'bp_get_the_topic_object_name', $retval );
    805962    }
     
    822979        global $forum_template;
    823980
     981        /**
     982         * Filters the slug of the object associated with the current topic in the loop.
     983         *
     984         * Objects are things like groups. So this filter would return the
     985         * slug of the group associated with the forum topic, if it exists.
     986         *
     987         * @since BuddyPress (1.1.0)
     988         *
     989         * @param string $object_slug Slug for the object associated with the current topic.
     990         */
    824991        return apply_filters( 'bp_get_the_topic_object_slug', $forum_template->topic->object_slug );
    825992    }
     
    8471014            $permalink = '';
    8481015
     1016        /**
     1017         * Filters the permalink of the object associated with the current topic in the loop.
     1018         *
     1019         * Objects are things like groups. So this filter would return the
     1020         * slug of the group associated with the forum topic, if it exists.
     1021         *
     1022         * @since BuddyPress (1.1.0)
     1023         *
     1024         * @param string $permalink Permalink for the object associated with the current topic.
     1025         */
    8491026        return apply_filters( 'bp_get_the_topic_object_permalink', $permalink );
    8501027    }
     
    8721049            return __( 'Deleted User', 'buddypress' );
    8731050
     1051        /**
     1052         * Filters the linked name of the user who last posted to the current topic in the loop.
     1053         *
     1054         * @since BuddyPress (1.0.0)
     1055         *
     1056         * @param string $value HTML link to the profile of the user who last posted.
     1057         */
    8741058        return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' );
    8751059    }
     
    9221106        extract( $r, EXTR_SKIP );
    9231107
     1108        /**
     1109         * Filters the avatar of the object associated with the current topic in the loop.
     1110         *
     1111         * @since BuddyPress (1.1.0)
     1112         *
     1113         * @param string $value HTML output for the object associated with the current topic.
     1114         */
    9241115        return apply_filters( 'bp_get_the_topic_object_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->object_id, 'type' => $type, 'object' => 'group', 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
    9251116    }
     
    9661157        extract( $r, EXTR_SKIP );
    9671158
     1159        /**
     1160         * Filters the avatar for the user who last posted to the current topic in the loop.
     1161         *
     1162         * @since BuddyPress (1.0.0)
     1163         *
     1164         * @param string $value HTML output for the avatar for the user who last posted.
     1165         */
    9681166        return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
    9691167    }
     
    9831181        global $forum_template;
    9841182
     1183        /**
     1184         * Filters the start time of the current topic in the loop.
     1185         *
     1186         * @since BuddyPress (1.0.0)
     1187         *
     1188         * @param string $topic_start_time Start time for the current topic.
     1189         */
    9851190        return apply_filters( 'bp_get_the_topic_start_time', $forum_template->topic->topic_start_time );
    9861191    }
     
    10001205        global $forum_template;
    10011206
     1207        /**
     1208         * Filters the topic time of the current topic in the loop.
     1209         *
     1210         * @since BuddyPress (1.0.0)
     1211         *
     1212         * @param string $topic_time Topic time for the current topic.
     1213         */
    10021214        return apply_filters( 'bp_get_the_topic_time', $forum_template->topic->topic_time );
    10031215    }
     
    10171229        global $forum_template;
    10181230
     1231        /**
     1232         * Filters the ID of the forum associated with the current topic in the loop.
     1233         *
     1234         * @since BuddyPress (1.0.0)
     1235         *
     1236         * @param int $forum_id ID of the forum associated with the current topic.
     1237         */
    10191238        return apply_filters( 'bp_get_the_topic_forum_id', $forum_template->topic->forum_id );
    10201239    }
     
    10341253        global $forum_template;
    10351254
     1255        /**
     1256         * Filters the status of the current topic in the loop.
     1257         *
     1258         * @since BuddyPress (1.0.0)
     1259         *
     1260         * @param string $topic_status Status of the current topic.
     1261         */
    10361262        return apply_filters( 'bp_get_the_topic_status', $forum_template->topic->topic_status );
    10371263    }
     
    10511277        global $forum_template;
    10521278
     1279        /**
     1280         * Filters whether or not the current topic in the loop is open.
     1281         *
     1282         * @since BuddyPress (1.0.0)
     1283         *
     1284         * @param string $topic_open Whether or not the current topic is open.
     1285         */
    10531286        return apply_filters( 'bp_get_the_topic_is_topic_open', $forum_template->topic->topic_open );
    10541287    }
     
    10681301        global $forum_template;
    10691302
     1303        /**
     1304         * Filters the ID of the last post in the current topic in the loop.
     1305         *
     1306         * @since BuddyPress (1.0.0)
     1307         *
     1308         * @param int $topic_last_post_id ID for the last post in the current topic.
     1309         */
    10701310        return apply_filters( 'bp_get_the_topic_last_post_id', $forum_template->topic->topic_last_post_id );
    10711311    }
     
    10851325        global $forum_template;
    10861326
     1327        /**
     1328         * Filters whether or not the current topic in the loop is sticky.
     1329         *
     1330         * @since BuddyPress (1.0.0)
     1331         *
     1332         * @param bool $topic_sticky Whether or not the current topic is sticky.
     1333         */
    10871334        return apply_filters( 'bp_get_the_topic_is_sticky', $forum_template->topic->topic_sticky );
    10881335    }
     
    11021349        global $forum_template;
    11031350
    1104         if ( $forum_template->topic->topic_posts == 1 )
     1351        if ( $forum_template->topic->topic_posts == 1 ) {
     1352
     1353            /**
     1354             * Filters a 'x posts' string with the number of posts in the current topic.
     1355             *
     1356             * @since BuddyPress (1.0.0)
     1357             *
     1358             * @param string $value 'X posts' string value for the current topic.
     1359             */
    11051360            return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d post', 'buddypress' ), $forum_template->topic->topic_posts ) );
    1106         else
     1361        } else {
     1362
     1363            /** This filter is documented in bp-forums/bp-forums-template.php */
    11071364            return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d posts', 'buddypress' ), $forum_template->topic->topic_posts ) );
     1365        }
    11081366    }
    11091367
     
    11221380        global $forum_template;
    11231381
     1382        /**
     1383         * Filters the total number of posts in the current topic in the loop.
     1384         *
     1385         * @since BuddyPress (1.2.4)
     1386         *
     1387         * @param int $topic_posts Total number of posts in the current topic.
     1388         */
    11241389        return apply_filters( 'bp_get_the_topic_total_posts', $forum_template->topic->topic_posts );
    11251390    }
     
    11391404        global $forum_template;
    11401405
     1406        /**
     1407         * Filters the tag count for the current topic in the loop.
     1408         *
     1409         * @since BuddyPress (1.0.0)
     1410         *
     1411         * @param int $tag_count Tag count for the current topic.
     1412         */
    11411413        return apply_filters( 'bp_get_the_topic_tag_count', $forum_template->topic->tag_count );
    11421414    }
     
    11731445        }
    11741446
     1447        /**
     1448         * Filters the permalink for the current topic in the loop.
     1449         *
     1450         * @since BuddyPress (1.0.0)
     1451         *
     1452         * @param string $value Permalink for the current topic in the loop.
     1453         */
    11751454        return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'topic/' . $forum_template->topic->topic_slug ) );
    11761455    }
     
    11921471        global $forum_template;
    11931472
     1473        /**
     1474         * Filters a 'time since' string describing when the current topic was created.
     1475         *
     1476         * @since BuddyPress (1.0.0)
     1477         *
     1478         * @param string $value 'Time since' value for the current topic.
     1479         */
    11941480        return apply_filters( 'bp_get_the_topic_time_since_created', bp_core_time_since( strtotime( $forum_template->topic->topic_start_time ) ) );
    11951481    }
     
    12221508        $post = bp_create_excerpt( $post->post_text, $length );
    12231509
     1510        /**
     1511         * Filters an excerpt from the latest post of the current topic in the loop.
     1512         *
     1513         * @since BuddyPress (1.0.0)
     1514         *
     1515         * @param string $post   Post exceprt for the current topic.
     1516         * @param string $length String length to trim excerpt down to.
     1517         */
    12241518        return apply_filters( 'bp_get_the_topic_latest_post_excerpt', $post, $length );
    12251519    }
     
    12411535        global $forum_template;
    12421536
     1537        /**
     1538         * Filters a 'time since' string describing when the last post in the current topic was created.
     1539         *
     1540         * @since BuddyPress (1.0.0)
     1541         *
     1542         * @param string $value The 'time since' string for the last post in the current topic.
     1543         */
    12431544        return apply_filters( 'bp_get_the_topic_time_since_last_post', bp_core_time_since( strtotime( $forum_template->topic->topic_time ) ) );
    12441545    }
     
    13381639            $class .= ' closed';
    13391640
     1641        /**
     1642         * Filters the CSS class for the current topic in the loop.
     1643         *
     1644         * This class may contain keywords like 'alt', 'sticky', or 'closed',
     1645         * based on context.
     1646         *
     1647         * @since BuddyPress (1.2.4)
     1648         *
     1649         * @param string $value Concatenated classes for the current topic in the loop.
     1650         */
    13401651        return apply_filters( 'bp_get_the_topic_css_class', trim( $class ) );
    13411652    }
     
    13551666        global $bp;
    13561667
     1668        /**
     1669         * Filters the permalink to the 'personal' topics tab.
     1670         *
     1671         * @since BuddyPress (1.1.0)
     1672         *
     1673         * @param string $value Permalink to the 'personal' topics tab.
     1674         */
    13571675        return apply_filters( 'bp_get_my_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/personal/' );
    13581676    }
     
    13721690        global $bp;
    13731691
     1692        /**
     1693         * Filters the permalink to the 'unreplied' topics tab.
     1694         *
     1695         * @since BuddyPress (1.1.0)
     1696         *
     1697         * @param string $value Permalink to the 'unreplied' topics tab.
     1698         */
    13741699        return apply_filters( 'bp_get_unreplied_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/unreplied/' );
    13751700    }
     
    13891714        global $bp;
    13901715
     1716        /**
     1717         * Filters the permalink to the 'popular' topics tab.
     1718         *
     1719         * @since BuddyPress (1.1.0)
     1720         *
     1721         * @param string $value Permalink to the 'popular' topics tab.
     1722         */
    13911723        return apply_filters( 'bp_get_popular_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/popular/' );
    13921724    }
     
    14061738        global $bp;
    14071739
     1740        /**
     1741         * Filters the link to the forums directory.
     1742         *
     1743         * @since BuddyPress (1.1.0)
     1744         *
     1745         * @param string $value Link to the forums directory.
     1746         */
    14081747        return apply_filters( 'bp_get_newest_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' );
    14091748    }
     
    14281767            return 'newest';
    14291768
     1769        /**
     1770         * Filters the currently viewed topic list type.
     1771         *
     1772         * Eg, 'newest', 'popular', etc.
     1773         *
     1774         * @since BuddyPress (1.1.0)
     1775         *
     1776         * @param string $value Currently viewed topic list type.
     1777         */
    14301778        return apply_filters( 'bp_get_forum_topic_type', bp_current_action() );
    14311779    }
     
    14621810        }
    14631811
    1464         // Tack on the #post-topic-reply anchor before returning
     1812        /**
     1813         * Filters the permalink for the New Reply button at the top of forum topics.
     1814         *
     1815         * @since BuddyPress (1.5.0)
     1816         *
     1817         * @param string $value Permalink for the New Reply button.
     1818         */
    14651819        return apply_filters( 'bp_get_forum_topic_new_reply_link', $link . '#post-topic-reply', $link );
    14661820    }
     
    14991853        global $forum_template;
    15001854
     1855        /**
     1856         * Filters the pagination links for the current topic list.
     1857         *
     1858         * @since BuddyPress (1.0.0)
     1859         *
     1860         * @param string $pag_links HTML pagination links.
     1861         */
    15011862        return apply_filters( 'bp_get_forum_pagination', $forum_template->pag_links );
    15021863    }
     
    15271888            $pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
    15281889
     1890        /**
     1891         * Filters the pagination count for the current topic list.
     1892         *
     1893         * @since BuddyPress (1.5.0)
     1894         *
     1895         * @param string $value    Pagination count for the current topic list.
     1896         * @param string $from_num Low end count in the view.
     1897         * @param string $to_num   High end count in the view.
     1898         * @param string $total    Total count of topics found.
     1899         */
    15291900        return apply_filters( 'bp_get_forum_pagination_count', sprintf( _n( 'Viewing 1 topic', 'Viewing %1$s - %2$s of %3$s topics', (int) $forum_template->total_topic_count, 'buddypress' ), $from_num, $to_num, $total, $pag_filter ), $from_num, $to_num, $total );
    15301901    }
     
    17992170            return true;
    18002171        } elseif ( $this->current_post + 1 == $this->post_count ) {
     2172
     2173            /**
     2174             * Fires right before the rewinding of user posts.
     2175             *
     2176             * @since BuddyPress (1.5.0)
     2177             */
    18012178            do_action('topic_loop_end');
    18022179            // Do some cleaning up after the loop
     
    18202197        $this->post = (object)$this->post;
    18212198
    1822         if ( $this->current_post == 0 ) // loop has just started
    1823             do_action('topic_loop_start');
     2199        if ( $this->current_post == 0 ) {
     2200
     2201            /**
     2202             * Fires if the current post item is the first in the topic loop.
     2203             *
     2204             * @since BuddyPress (1.5.0)
     2205             */
     2206            do_action( 'topic_loop_start' );
     2207        }
    18242208    }
    18252209}
     
    18672251    }
    18682252
     2253    /**
     2254     * Filters whether or not there are topics to display.
     2255     *
     2256     * @since BuddyPress (1.1.0)
     2257     *
     2258     * @param bool                     $value          Whether or not there are topics.
     2259     * @param BP_Forums_Template_Topic $topic_template Topic template global to use when rendering.
     2260     */
    18692261    return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), $topic_template );
    18702262}
     
    19042296        global $topic_template;
    19052297
     2298        /**
     2299         * Filters the ID of the current post in the loop.
     2300         *
     2301         * @since BuddyPress (1.0.0)
     2302         *
     2303         * @param int $post_id ID of the current post.
     2304         */
    19062305        return apply_filters( 'bp_get_the_topic_post_id', $topic_template->post->post_id );
    19072306    }
     
    19212320        global $topic_template;
    19222321
     2322        /**
     2323         * Filters the content of the current post in the loop.
     2324         *
     2325         * @since BuddyPress (1.0.0)
     2326         *
     2327         * @param string $post_text The content of the current post.
     2328         */
    19232329        return apply_filters( 'bp_get_the_topic_post_content', stripslashes( $topic_template->post->post_text ) );
    19242330    }
     
    19532359            $class .= ' open';
    19542360
     2361        /**
     2362         * Filters the CSS class for the current post in the loop.
     2363         *
     2364         * This class may contain keywords like 'alt', 'deleted', or 'open',
     2365         * based on context.
     2366         *
     2367         * @since BuddyPress (1.2.4)
     2368         *
     2369         * @param string $value Concatenated classes for the current post in the loop.
     2370         */
    19552371        return apply_filters( 'bp_get_the_topic_post_css_class', trim( $class ) );
    19562372    }
     
    19972413        extract( $r, EXTR_SKIP );
    19982414
     2415        /**
     2416         * Filters the avatar of the user who posted the current post in the loop.
     2417         *
     2418         * @since BuddyPress (1.0.0)
     2419         *
     2420         * @param string $value Avatar of the user who posted the current post.
     2421         */
    19992422        return apply_filters( 'bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
    20002423    }
     
    20172440            return __( 'Deleted User', 'buddypress' );
    20182441
     2442        /**
     2443         * Filters the name of the user who posted the current post in the loop.
     2444         *
     2445         * @since BuddyPress (1.0.0)
     2446         *
     2447         * @param string $value HTML link for the poster's name.
     2448         */
    20192449        return apply_filters( 'bp_get_the_topic_post_poster_name', '<a href="' . $link . '" title="' . $topic_template->post->poster_name . '">' . $topic_template->post->poster_name . '</a>' );
    20202450    }
     
    20352465        global $topic_template;
    20362466
     2467        /**
     2468         * Filters a link to the profile of the user who posted the current post.
     2469         *
     2470         * @since BuddyPress (1.2.1)
     2471         *
     2472         * @param string $value Link for the current poster's profile.
     2473         */
    20372474        return apply_filters( 'bp_the_topic_post_poster_link', bp_core_get_user_domain( $topic_template->post->poster_id ) );
    20382475    }
     
    20542491        global $topic_template;
    20552492
     2493        /**
     2494         * Filters the 'since' string describing when the current post in the loop was posted.
     2495         *
     2496         * @since BuddyPress (1.0.0)
     2497         *
     2498         * @param string $value The 'since' string.
     2499         */
    20562500        return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( strtotime( $topic_template->post->post_time ) ) );
    20572501    }
     
    21162560        $links[] .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template->post->post_id, 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
    21172561
     2562        /**
     2563         * Filters the admin links for the current post in the loop.
     2564         *
     2565         * @since BuddyPress (1.2.7)
     2566         *
     2567         * @param string $value HTML string containing the admin links for the current post.
     2568         */
    21182569        return apply_filters( 'bp_get_the_topic_post_admin_links', implode( $separator, $links ), $links, $r );
    21192570    }
     
    21322583    function bp_get_the_topic_post_edit_text() {
    21332584        $post = bp_forums_get_post( bp_action_variable( 4 ) );
     2585
     2586        /**
     2587         * Filters the text to edit when editing a post.
     2588         *
     2589         * @since BuddyPress (1.2.4)
     2590         *
     2591         * @param string $value The text to edit when editing a post.
     2592         */
    21342593        return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) );
    21352594    }
     
    21492608        global $topic_template;
    21502609
     2610
     2611        /**
     2612         * Filters the pagination links for the current topic page.
     2613         *
     2614         * @since BuddyPress (1.0.0)
     2615         *
     2616         * @param string $pag_links HTML pagination links.
     2617         */
    21512618        return apply_filters( 'bp_get_the_topic_pagination', $topic_template->pag_links );
    21522619    }
     
    21672634    $total = bp_core_number_format( $topic_template->total_post_count );
    21682635
     2636    /**
     2637     * Filters the pagination count for the current topic page.
     2638     *
     2639     * @since BuddyPress (1.0.0)
     2640     *
     2641     * @param string $value    Pagination count for the current topic page.
     2642     * @param string $from_num Low end count in the view.
     2643     * @param string $to_num   High end count in the view.
     2644     * @param string $total    Total count of topics found.
     2645     */
    21692646    echo apply_filters( 'bp_the_topic_pagination_count', sprintf( _n( 'Viewing 1 post', 'Viewing %1$s - %2$s of %3$s posts', (int) $topic_template->total_post_count, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
    21702647}
     
    21852662        global $topic_template;
    21862663
     2664        /**
     2665         * Filters whether or not a user is on the last page in the current topic.
     2666         *
     2667         * @since BuddyPress (1.2.0)
     2668         *
     2669         * @param bool $value Whether or not user is on last page.
     2670         */
    21872671        return apply_filters( 'bp_get_the_topic_is_last_page', $topic_template->pag_page == $topic_template->pag->total_pages );
    21882672    }
     
    22002684    </form>';
    22012685
     2686    /**
     2687     * Filters the forums directory search form.
     2688     *
     2689     * @since BuddyPress (1.9.0)
     2690     *
     2691     * @param string HTML search form for the forums directory.
     2692     */
    22022693    echo apply_filters( 'bp_directory_forums_search_form', $search_form_html );
    22032694}
     
    22382729        }
    22392730
     2731        /**
     2732         * Filters the permalink to a given forum.
     2733         *
     2734         * @since BuddyPress (1.0.0)
     2735         *
     2736         * @param string $value Peramlink to the given forum.
     2737         */
    22402738        return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) );
    22412739    }
     
    22672765        }
    22682766
    2269         if ( $forum = bp_forums_get_forum( $forum_id ) )
     2767        if ( $forum = bp_forums_get_forum( $forum_id ) ) {
     2768
     2769            /**
     2770             * Filters the name of a given forum.
     2771             *
     2772             * @since BuddyPress (1.5.0)
     2773             *
     2774             * @param string $forum_name Name of the given forum.
     2775             * @param string $forum_id   ID of the given forum.
     2776             */
    22702777            return apply_filters( 'bp_get_forum_name', $forum->forum_name, $forum->forum_id );
    2271         else
     2778        } else {
    22722779            return false;
     2780        }
    22732781    }
    22742782
     
    23342842            $tags = implode( ', ', $tags );
    23352843
     2844        /**
     2845         * Filters the current topic's tag list.
     2846         *
     2847         * @since BuddyPress (1.5.0)
     2848         *
     2849         * @param string|array $tags   List or array of tags for the current topic.
     2850         * @param string       $format Requested format for the tags.
     2851         */
    23362852        return apply_filters( 'bp_forum_topic_tag_list', $tags, $format );
    23372853    }
     
    23522868        $has_tags = true;
    23532869
     2870    /**
     2871     * Filters whether or not a forum topic has any tags.
     2872     *
     2873     * @since BuddyPress (1.5.0)
     2874     *
     2875     * @param bool $has_tags Whether or not there are any tags.
     2876     */
    23542877    return apply_filters( 'bp_forum_topic_has_tags', $has_tags );
    23552878}
     
    23692892        global $topic_template;
    23702893
     2894        /**
     2895         * Filters the url to use in a forum form 'action'.
     2896         *
     2897         * @since BuddyPress (1.0.0)
     2898         *
     2899         * @param string $value URL to use in the forum form 'action'.
     2900         */
    23712901        return apply_filters( 'bp_get_forum_action', bp_get_root_domain() . esc_attr( $_SERVER['REQUEST_URI'] ) );
    23722902    }
     
    23842914     */
    23852915    function bp_get_forum_topic_action() {
     2916
     2917        /**
     2918         * Filters the url to use in a forum topic form 'action'.
     2919         *
     2920         * @since BuddyPress (1.0.0)
     2921         *
     2922         * @param string $value URL to use in the forum topic form 'action'.
     2923         */
    23862924        return apply_filters( 'bp_get_forum_topic_action', $_SERVER['REQUEST_URI'] );
    23872925    }
     
    24012939     *
    24022940     * @param int $user_id See {@link bp_forums_total_topic_count_for_user}.
     2941     *
     2942     * @return int
    24032943     */
    24042944    function bp_get_forum_topic_count_for_user( $user_id = 0 ) {
     2945
     2946        /**
     2947         * Filters the total topic count for a given user.
     2948         *
     2949         * @since BuddyPress (1.2.0)
     2950         *
     2951         * @param int $value Total topic count for the given user.
     2952         */
    24052953        return apply_filters( 'bp_get_forum_topic_count_for_user', bp_forums_total_topic_count_for_user( $user_id ) );
    24062954    }
     
    24202968     *
    24212969     * @param int $user_id See {@link bp_forums_total_topic_count()}.
     2970     *
     2971     * @return int
    24222972     */
    24232973    function bp_get_forum_topic_count( $user_id = 0 ) {
     2974
     2975        /**
     2976         * Filters the total topic count for a given user.
     2977         *
     2978         * @since BuddyPress (1.2.0)
     2979         *
     2980         * @param int $value Total topic count for the given user.
     2981         */
    24242982        return apply_filters( 'bp_get_forum_topic_count', bp_forums_total_topic_count( $user_id ) );
    24252983    }
Note: See TracChangeset for help on using the changeset viewer.