Skip to:
Content

BuddyPress.org

Changeset 9383


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

Add hook documentation to BP Forums component.

Fixes #5941.

Location:
trunk/src/bp-forums
Files:
5 edited

Legend:

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

    r9351 r9383  
    8787    }
    8888
     89    /**
     90     * Fires during the bootstrap setup for bbPress 1.x.
     91     *
     92     * @since BuddyPress (1.1.0)
     93     */
    8994    do_action( 'bb_got_roles' );
     95
     96    /**
     97     * Fires during the bootstrap setup for bbPress 1.x.
     98     *
     99     * @since BuddyPress (1.1.0)
     100     */
    90101    do_action( 'bb_init'      );
     102
     103    /**
     104     * Fires during the bootstrap setup for bbPress 1.x.
     105     *
     106     * @since BuddyPress (1.1.0)
     107     */
    91108    do_action( 'init_roles'   );
    92109
     
    125142    }
    126143
     144    /**
     145     * Fires inside an anonymous function that is run on bbPress shutdown.
     146     *
     147     * @since BuddyPress (1.1.0)
     148     */
    127149    register_shutdown_function( create_function( '', 'do_action("bb_shutdown");' ) );
    128150}
  • trunk/src/bp-forums/bp-forums-filters.php

    r9351 r9383  
    8484    $forums_allowedtags['blockquote'] = array();
    8585
     86    /**
     87     * Filters the allowed HTML tags for forum posts.
     88     *
     89     * @since BuddyPress (1.2.0)
     90     *
     91     * @param array $forums_allowedtags Array of allowed HTML tags.
     92     */
    8693    $forums_allowedtags = apply_filters( 'bp_forums_allowed_tags', $forums_allowedtags );
    8794    return wp_kses( $content, $forums_allowedtags );
     
    100107    global $bp;
    101108
     109    /**
     110     * Filters the link for a forum topic tags directory.
     111     *
     112     * @since BuddyPress (1.1.0)
     113     *
     114     * @param string $value Link for the forum topic tag directory.
     115     */
    102116    return apply_filters( 'bp_forums_filter_tag_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/tag/' . $tag . '/' );
    103117}
  • trunk/src/bp-forums/bp-forums-functions.php

    r9351 r9383  
    8080 */
    8181function bp_forums_get_forum( $forum_id ) {
     82
     83    /** This action is documented in bp-forums/bp-forums-screens */
    8284    do_action( 'bbpress_init' );
    8385    return bb_get_forum( $forum_id );
     
    101103 */
    102104function bp_forums_new_forum( $args = '' ) {
     105
     106    /** This action is documented in bp-forums/bp-forums-screens */
    103107    do_action( 'bbpress_init' );
    104108
     
    133137 */
    134138function bp_forums_update_forum( $args = '' ) {
     139
     140    /** This action is documented in bp-forums/bp-forums-screens */
    135141    do_action( 'bbpress_init' );
    136142
     
    158164
    159165    if ( !empty( $forum_id ) && is_int( $forum_id ) ) {
     166
     167        /** This action is documented in bp-forums/bp-forums-screens */
    160168        do_action( 'bbpress_init' );
    161169        bb_delete_forum( $forum_id );
     
    189197 */
    190198function bp_forums_get_forum_topics( $args = '' ) {
     199
     200    /** This action is documented in bp-forums/bp-forums-screens */
    191201    do_action( 'bbpress_init' );
    192202
     
    231241    }
    232242
     243    /**
     244     * Filters the found forum topics for provided arguments.
     245     *
     246     * @since BuddyPress (1.1.0)
     247     *
     248     * @param array $topics Array of found topics. Passed by reference.
     249     * @param array $r      Array of parsed arguments for query. Passed by reference.
     250     */
    233251    return apply_filters_ref_array( 'bp_forums_get_forum_topics', array( &$topics, &$r ) );
    234252}
     
    241259 */
    242260function bp_forums_get_topic_details( $topic_id ) {
     261
     262    /** This action is documented in bp-forums/bp-forums-screens */
    243263    do_action( 'bbpress_init' );
    244264
     
    257277 */
    258278function bp_forums_get_topic_id_from_slug( $topic_slug ) {
     279
     280    /** This action is documented in bp-forums/bp-forums-screens */
    259281    do_action( 'bbpress_init' );
    260282
     
    296318    global $bp;
    297319
     320    /** This action is documented in bp-forums/bp-forums-screens */
    298321    do_action( 'bbpress_init' );
    299322
     
    335358        return false;
    336359
     360    /**
     361     * Fires after a new forum topic has been created.
     362     *
     363     * @since BuddyPress (1.0.0)
     364     *
     365     * @param int $topic_id ID of the newly created topic post.
     366     */
    337367    do_action( 'bp_forums_new_topic', $topic_id );
    338368
     
    355385 */
    356386function bp_forums_update_topic( $args = '' ) {
     387
     388    /** This action is documented in bp-forums/bp-forums-screens */
    357389    do_action( 'bbpress_init' );
    358390
     
    386418
    387419function bp_forums_sticky_topic( $args = '' ) {
     420
     421    /** This action is documented in bp-forums/bp-forums-screens */
    388422    do_action( 'bbpress_init' );
    389423
     
    413447 */
    414448function bp_forums_openclose_topic( $args = '' ) {
     449
     450    /** This action is documented in bp-forums/bp-forums-screens */
    415451    do_action( 'bbpress_init' );
    416452
     
    438474 */
    439475function bp_forums_delete_topic( $args = '' ) {
     476
     477    /** This action is documented in bp-forums/bp-forums-screens */
    440478    do_action( 'bbpress_init' );
    441479
     
    456494    global $bbdb;
    457495
     496    /** This action is documented in bp-forums/bp-forums-screens */
    458497    do_action( 'bbpress_init' );
    459498
     
    472511    }
    473512
     513    /**
     514     * Filters the total topic count for the site.
     515     *
     516     * @since BuddyPress (1.5.0)
     517     *
     518     * @param int $count Total topic count.
     519     */
    474520    return apply_filters( 'bp_forums_total_topic_count', $count );
    475521}
     
    492538
    493539    if ( $text && $topic_id && $user_id ) {
     540
     541        /** This action is documented in bp-forums/bp-forums-screens */
    494542        do_action( 'bbpress_init' );
    495543
     
    513561    }
    514562
     563    /**
     564     * Filters whether a user has already left this particular reply on a given post.
     565     *
     566     * @since BuddyPress (1.6.0)
     567     *
     568     * @param bool   $reply_exists Whether or not a reply exists.
     569     * @param string $text         The text of the comment.
     570     * @param int    $topic_id     The topic ID.
     571     * @param int    $user_id      The user ID.
     572     */
    515573    return (bool) apply_filters( 'bp_forums_reply_exists', $reply_exists, $text, $topic_id, $user_id );
    516574}
     
    540598 */
    541599function bp_forums_total_topic_count_for_user( $user_id = 0, $type = 'active' ) {
     600
     601    /** This action is documented in bp-forums/bp-forums-screens */
    542602    do_action( 'bbpress_init' );
    543603
     
    579639 */
    580640function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active' ) {
     641
     642    /** This action is documented in bp-forums/bp-forums-screens */
    581643    do_action( 'bbpress_init' );
    582644
     
    610672    }
    611673
     674    /**
     675     * Filters the total number of topics replied to by a given user.
     676     *
     677     * @since BuddyPress (1.5.0)
     678     *
     679     * @param int $count   Total number of topics replied to by a given user.
     680     * @param int $user_id The user ID.
     681     */
    612682    return apply_filters( 'bp_forums_total_replied_count_for_user', $count, $user_id );
    613683}
     
    694764 */
    695765function bp_forums_get_topic_posts( $args = '' ) {
     766
     767    /** This action is documented in bp-forums/bp-forums-screens */
    696768    do_action( 'bbpress_init' );
    697769
     
    718790 */
    719791function bp_forums_get_post( $post_id ) {
     792
     793    /** This action is documented in bp-forums/bp-forums-screens */
    720794    do_action( 'bbpress_init' );
    721795    return bb_get_post( $post_id );
     
    733807 */
    734808function bp_forums_delete_post( $args = '' ) {
     809
     810    /** This action is documented in bp-forums/bp-forums-screens */
    735811    do_action( 'bbpress_init' );
    736812
     
    764840 */
    765841function bp_forums_insert_post( $args = '' ) {
     842
     843    /** This action is documented in bp-forums/bp-forums-screens */
    766844    do_action( 'bbpress_init' );
    767845
     
    803881    $post_id = bb_insert_post( array( 'post_id' => $post_id, 'topic_id' => $topic_id, 'post_text' => stripslashes( trim( $post_text ) ), 'post_time' => $post_time, 'poster_id' => $poster_id, 'poster_ip' => $poster_ip, 'post_status' => $post_status, 'post_position' => $post_position ) );
    804882
    805     if ( !empty( $post_id ) )
     883    if ( !empty( $post_id ) ) {
     884
     885        /**
     886         * Fires if there was a new post created.
     887         *
     888         * @since BuddyPress (1.0.0)
     889         *
     890         * @param int $post_id ID of the newly created forum post.
     891         */
    806892        do_action( 'bp_forums_new_post', $post_id );
     893    }
    807894
    808895    return $post_id;
     
    854941    }
    855942
     943    /**
     944     * Filters BP-specific details about a set of posts.
     945     *
     946     * @since BuddyPress (1.5.0)
     947     *
     948     * @param array $posts Array of posts holding BP-specific details.
     949     */
    856950    return apply_filters( 'bp_forums_get_post_extras', $posts );
    857951}
     
    867961    global $wpdb, $bbdb;
    868962
     963    /** This action is documented in bp-forums/bp-forums-screens */
    869964    do_action( 'bbpress_init' );
    870965
     
    9061001 */
    9071002function bp_forums_parent_forum_id() {
     1003
     1004    /**
     1005     * Filters the parent forum ID for the bbPress abstraction layer.
     1006     *
     1007     * @since BuddyPress (1.5.0)
     1008     *
     1009     * @param int BP_FORUMS_PARENT_FORUM_ID The Parent forum ID constant.
     1010     */
    9081011    return apply_filters( 'bp_forums_parent_forum_id', BP_FORUMS_PARENT_FORUM_ID );
    9091012}
     
    9211024 */
    9221025function bp_forums_enable_global_directory_stickies() {
     1026
     1027    /**
     1028     * Filters whether or not sticky topics should be broken out of regular topic order.
     1029     *
     1030     * @since BuddyPress (1.5.0)
     1031     *
     1032     * @param bool $value Whether or not to break out of topic order.
     1033     */
    9231034    return apply_filters( 'bp_forums_enable_global_directory_stickies', defined( 'BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES' ) && BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES );
    9241035}
     
    9651076 *
    9661077 * @package BuddyPress_Forums
    967  * @since BuddyPress (1.5)
     1078 * @since BuddyPress (1.5.0)
    9681079 */
    9691080function bp_embed_forum_cache( $cache, $id, $cachekey ) {
  • trunk/src/bp-forums/bp-forums-screens.php

    r9351 r9383  
    2929        bp_update_is_directory( true, 'forums' );
    3030
     31        /**
     32         * Fires early in the initialization of bbPress-based areas of BuddyPress.
     33         *
     34         * @since BuddyPress (1.1.0)
     35         */
    3136        do_action( 'bbpress_init' );
    3237
     
    7681        }
    7782
     83        /**
     84         * Fires right before the loading of the forums directory screen template file.
     85         *
     86         * @since BuddyPress (1.1.0)
     87         */
    7888        do_action( 'bp_forums_directory_forums_setup' );
    7989
     90        /**
     91         * Filters the template to load for the forums directory screen.
     92         *
     93         * @since BuddyPress (1.1.0)
     94         *
     95         * @param string $template Path to the forums template to load.
     96         */
    8097        bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
    8198    }
     
    87104 */
    88105function bp_member_forums_screen_topics() {
     106
     107    /**
     108     * Fires right before the loading of the forums topics started screen template file.
     109     *
     110     * @since BuddyPress (1.5.0)
     111     */
    89112    do_action( 'bp_member_forums_screen_topics' );
    90113
     114    /**
     115     * Filters the template to load for the forums topics started screen.
     116     *
     117     * @since BuddyPress (1.5.0)
     118     *
     119     * @param string $template Path to the forums topics started template to load.
     120     */
    91121    bp_core_load_template( apply_filters( 'bp_member_forums_screen_topics', 'members/single/home' ) );
    92122}
     
    96126 */
    97127function bp_member_forums_screen_replies() {
     128
     129    /**
     130     * Fires right before the loading of the forums replied to screen template file.
     131     *
     132     * @since BuddyPress (1.5.0)
     133     */
    98134    do_action( 'bp_member_forums_screen_replies' );
    99135
     136    /**
     137     * Filters the template to load for the forums replied to screen.
     138     *
     139     * @since BuddyPress (1.5.0)
     140     *
     141     * @param string $template Path to the forums replied to template to load.
     142     */
    100143    bp_core_load_template( apply_filters( 'bp_member_forums_screen_replies', 'members/single/home' ) );
    101144}
     
    107150 */
    108151function bp_member_forums_screen_favorites() {
     152
     153    /**
     154     * Fires right before the loading of the forums favorites screen template file.
     155     *
     156     * @since BuddyPress (1.5.0)
     157     */
    109158    do_action( 'bp_member_forums_screen_favorites' );
    110159
     160    /**
     161     * Filters the template to load for the forums favorites screen.
     162     *
     163     * @since BuddyPress (1.5.0)
     164     *
     165     * @param string $template Path to the forums favorites template to load.
     166     */
    111167    bp_core_load_template( apply_filters( 'bp_member_forums_screen_favorites', 'members/single/home' ) );
    112168}
     
    120176        return false;
    121177
     178    /**
     179     * Fires right before the loading of the forums single forum screen template file.
     180     *
     181     * @since BuddyPress (1.5.0)
     182     */
    122183    do_action( 'bp_forums_screen_single_forum' );
    123184
     185    /**
     186     * Filters the template to load for the forums single forum screen.
     187     *
     188     * @since BuddyPress (1.5.0)
     189     *
     190     * @param string $template Path to the forums single forum template to load.
     191     */
    124192    bp_core_load_template( apply_filters( 'bp_forums_screen_single_forum', 'forums/single/forum' ) );
    125193}
     
    134202        return false;
    135203
     204    /**
     205     * Fires right before the loading of the forums single topic screen template file.
     206     *
     207     * @since BuddyPress (1.5.0)
     208     */
    136209    do_action( 'bp_forums_screen_single_topic' );
    137210
     211    /**
     212     * Filters the template to load for the forums single topic screen.
     213     *
     214     * @since BuddyPress (1.5.0)
     215     *
     216     * @param string $template Path to the forums single topic template to load.
     217     */
    138218    bp_core_load_template( apply_filters( 'bp_forums_screen_single_topic', 'forums/single/topic' ) );
    139219}
  • 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.