Skip to:
Content

BuddyPress.org


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

Initial documentation cleanup for the BP Forums Component.

See #6397.

File:
1 edited

Legend:

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

    r10096 r10183  
    2121function bp_forums_is_bbpress_active() {
    2222
    23     // Single site
     23    // Single site.
    2424    if ( is_plugin_active( 'bbpress/bbpress.php' ) )
    2525        return true;
    2626
    27     // Network active
     27    // Network active.
    2828    if ( is_plugin_active_for_network( 'bbpress/bbpress.php' ) )
    2929        return true;
    3030
    31     // Nope
     31    // Nope.
    3232    return false;
    3333}
     
    5757 * Does the forums component have a directory page registered?
    5858 *
    59  * Checks $bp pages global and looks for directory page
     59 * Checks $bp pages global and looks for directory page.
    6060 *
    6161 * @since 1.5.0
     
    8181function bp_forums_get_forum( $forum_id ) {
    8282
    83     /** This action is documented in bp-forums/bp-forums-screens */
     83    /** This action is documented in bp-forums/bp-forums-screens.php */
    8484    do_action( 'bbpress_init' );
    8585    return bb_get_forum( $forum_id );
     
    9191 * Wrapper for {@link bb_new_forum()}.
    9292 *
    93  * @param array $args {
     93 * @param array|string $args {
    9494 *     Forum setup arguments.
    95  *     @type string $forum_name Name of the forum.
    96  *     @type string $forum_desc Description of the forum.
    97  *     @type int $forum_parent_id ID of the forum parent. Default: value of
    98  *           {@link bp_forums_parent_forums_id()}.
    99  *     @type bool $forum_order Order.
    100  *     @type int $forum_is_category Whether the forum is a category. Default: 0.
     95 *     @type string $forum_name        Name of the forum.
     96 *     @type string $forum_desc        Description of the forum.
     97 *     @type int    $forum_parent_id  ID of the forum parent. Default: value of
     98 *                                     {@link bp_forums_parent_forums_id()}.
     99 *     @type bool   $forum_order      Order.
     100 *     @type int    $forum_is_category Whether the forum is a category. Default: 0.
    101101 * }
    102102 * @return int ID of the newly created forum.
     
    104104function bp_forums_new_forum( $args = '' ) {
    105105
    106     /** This action is documented in bp-forums/bp-forums-screens */
     106    /** This action is documented in bp-forums/bp-forums-screens.php */
    107107    do_action( 'bbpress_init' );
    108108
     
    124124 * Wrapper for {@link bb_update_forum(}.
    125125 *
    126  * @param array $args {
     126 * @param array|string $args {
    127127 *     Forum setup arguments.
    128  *     @type int $forum_id ID of the forum to be updated.
    129  *     @type string $forum_name Name of the forum.
    130  *     @type string $forum_desc Description of the forum.
    131  *     @type int $forum_parent_id ID of the forum parent. Default: value of
    132  *           {@link bp_forums_parent_forums_id()}.
    133  *     @type bool $forum_order Order.
    134  *     @type int $forum_is_category Whether the forum is a category. Default: 0.
     128 *     @type int    $forum_id          ID of the forum to be updated.
     129 *     @type string $forum_name        Name of the forum.
     130 *     @type string $forum_desc        Description of the forum.
     131 *     @type int    $forum_parent_id  ID of the forum parent. Default: value of
     132 *                                     {@link bp_forums_parent_forums_id()}.
     133 *     @type bool   $forum_order      Order.
     134 *     @type int    $forum_is_category Whether the forum is a category. Default: 0.
    135135 * }
    136136 * @return bool True on success, false on failure.
     
    138138function bp_forums_update_forum( $args = '' ) {
    139139
    140     /** This action is documented in bp-forums/bp-forums-screens */
     140    /** This action is documented in bp-forums/bp-forums-screens.php */
    141141    do_action( 'bbpress_init' );
    142142
     
    165165    if ( !empty( $forum_id ) && is_int( $forum_id ) ) {
    166166
    167         /** This action is documented in bp-forums/bp-forums-screens */
     167        /** This action is documented in bp-forums/bp-forums-screens.php */
    168168        do_action( 'bbpress_init' );
    169169        bb_delete_forum( $forum_id );
     
    177177 * Fetch a set of forum topics.
    178178 *
    179  * @param array $args {
    180  *     @type string @type Order or filter type. Default: 'newest'.
    181  *     @type int $forum_id Optional. Pass a forum ID to limit results to topics
    182  *           associated with that forum.
    183  *     @type int $user_id Optional. Pass a user ID to limit results to topics
    184  *           belonging to that user.
    185  *     @type int $page Optional. Number of the results page to return.
    186  *           Default: 1.
    187  *     @type int $per_page Optional. Number of results to return per page.
    188  *           Default: 15.
    189  *     @type int $offset Optional. Numeric offset for results.
    190  *     @type int $number
    191  *     @type array $exclude Optional. Topic IDs to exclude.
     179 * @param array|string $args {
     180 *     @type string $type          Order or filter type. Default: 'newest'.
     181 *     @type int    $forum_id      Optional. Pass a forum ID to limit results to topics
     182 *                                 associated with that forum.
     183 *     @type int    $user_id      Optional. Pass a user ID to limit results to topics
     184 *                                 belonging to that user.
     185 *     @type int    $page          Optional. Number of the results page to return.
     186 *                                 Default: 1.
     187 *     @type int    $per_page      Optional. Number of results to return per page.
     188 *                                 Default: 15.
     189 *     @type int    $offset        Optional. Numeric offset for results.
     190 *     @type int    $number        Amount to query for.
     191 *     @type array  $exclude      Optional. Topic IDs to exclude.
    192192 *     @type string $show_stickies Whether to show sticky topics.
    193  *     @type mixed $filter If $type = 'tag', filter is the tag name. Otherwise,
    194  *           $filter is terms to search on.
     193 *     @type mixed  $filter        If $type = 'tag', filter is the tag name. Otherwise,
     194 *                                 $filter is terms to search on.
    195195 * }
    196196 * @return array Found topics.
     
    198198function bp_forums_get_forum_topics( $args = '' ) {
    199199
    200     /** This action is documented in bp-forums/bp-forums-screens */
     200    /** This action is documented in bp-forums/bp-forums-screens.php */
    201201    do_action( 'bbpress_init' );
    202202
     
    211211        'exclude'       => false,
    212212        'show_stickies' => 'all',
    213         'filter'        => false // if $type = tag then filter is the tag name, otherwise it's terms to search on.
     213        'filter'        => false // If $type = tag then filter is the tag name, otherwise it's terms to search on.
    214214    ) );
    215215    extract( $r, EXTR_SKIP );
     
    260260function bp_forums_get_topic_details( $topic_id ) {
    261261
    262     /** This action is documented in bp-forums/bp-forums-screens */
     262    /** This action is documented in bp-forums/bp-forums-screens.php */
    263263    do_action( 'bbpress_init' );
    264264
     
    278278function bp_forums_get_topic_id_from_slug( $topic_slug ) {
    279279
    280     /** This action is documented in bp-forums/bp-forums-screens */
     280    /** This action is documented in bp-forums/bp-forums-screens.php */
    281281    do_action( 'bbpress_init' );
    282282
     
    290290 * Create a new forum topic.
    291291 *
    292  * @param array $args {
    293  *     @type string $topic_title Title of the new topic.
    294  *     @type string $topic_slug Slug of the new topic.
    295  *     @type string $topic_text Text of the new topic.
    296  *     @type int $topic_poster ID of the user posting the topic. Default: ID of
    297  *           the logged-in user.
    298  *     @type string $topic_poster_name Display name of the user posting the
    299  *           topic. Default: 'fullname' of the logged-in user.
    300  *     @type id $topic_last_poster ID of the user who last posted to the topic.
    301  *           Default: ID of the logged-in user.
    302  *     @type string $topic_last_poster_name Display name of the user who last
    303  *           posted to the topic. Default: 'fullname' of the logged-in user.
    304  *     @type string $topic_start_time Date/time when the topic was created.
    305  *           Default: the current time, as reported by bp_core_current_time().
    306  *     @type string $topic_time Date/time when the topic was created.
    307  *           Default: the current time, as reported by bp_core_current_time().
    308  *     @type int $topic_open Whether the topic is open. Default: 1 (open).
    309  *     @type array|string|bool $topic_tags Array or comma-separated list of
    310  *           topic tags. False to leave empty. Default: false.
    311  *     @type int $forum_id ID of the forum to which the topic belongs.
    312  *           Default: 0.
     292 * @param array|string $args {
     293 *     @type string            $topic_title            Title of the new topic.
     294 *     @type string            $topic_slug            Slug of the new topic.
     295 *     @type string            $topic_text            Text of the new topic.
     296 *     @type int               $topic_poster          ID of the user posting the topic. Default: ID of
     297 *                                                     the logged-in user.
     298 *     @type string            $topic_poster_name      Display name of the user posting the
     299 *                                                     topic. Default: 'fullname' of the logged-in user.
     300 *     @type int               $topic_last_poster      ID of the user who last posted to the topic.
     301 *                                                     Default: ID of the logged-in user.
     302 *     @type string            $topic_last_poster_name Display name of the user who last
     303 *                                                     posted to the topic. Default: 'fullname' of the logged-in user.
     304 *     @type string            $topic_start_time      Date/time when the topic was created.
     305 *                                                     Default: the current time, as reported by bp_core_current_time().
     306 *     @type string            $topic_time            Date/time when the topic was created.
     307 *                                                     Default: the current time, as reported by bp_core_current_time().
     308 *     @type int               $topic_open            Whether the topic is open. Default: 1 (open).
     309 *     @type array|string|bool $topic_tags             Array or comma-separated list of
     310 *                                                     topic tags. False to leave empty. Default: false.
     311 *     @type int               $forum_id              ID of the forum to which the topic belongs.
     312 *                                                     Default: 0.
    313313 * }
    314314 * @return object Details about the new topic, as returned by
    315  *         {@link bp_forums_get_topic_details()}.
     315 *                {@link bp_forums_get_topic_details()}.
    316316 */
    317317function bp_forums_new_topic( $args = '' ) {
    318318    $bp = buddypress();
    319319
    320     /** This action is documented in bp-forums/bp-forums-screens */
     320    /** This action is documented in bp-forums/bp-forums-screens.php */
    321321    do_action( 'bbpress_init' );
    322322
     
    325325        'topic_slug'             => '',
    326326        'topic_text'             => '',
    327         'topic_poster'           => bp_loggedin_user_id(),       // accepts ids
    328         'topic_poster_name'      => $bp->loggedin_user->fullname, // accept names
    329         'topic_last_poster'      => bp_loggedin_user_id(),       // accepts ids
    330         'topic_last_poster_name' => $bp->loggedin_user->fullname, // accept names
     327        'topic_poster'           => bp_loggedin_user_id(),       // Accepts ids.
     328        'topic_poster_name'      => $bp->loggedin_user->fullname, // Accept names.
     329        'topic_last_poster'      => bp_loggedin_user_id(),       // Accepts ids.
     330        'topic_last_poster_name' => $bp->loggedin_user->fullname, // Accept names.
    331331        'topic_start_time'       => bp_core_current_time(),
    332332        'topic_time'             => bp_core_current_time(),
    333333        'topic_open'             => 1,
    334         'topic_tags'             => false, // accepts array or comma delimited
    335         'forum_id'               => 0      // accepts ids or slugs
     334        'topic_tags'             => false, // Accepts array or comma delimited.
     335        'forum_id'               => 0      // Accepts ids or slugs.
    336336    ) );
    337337    extract( $r, EXTR_SKIP );
     
    373373 * Update a topic's details.
    374374 *
    375  * @param array $args {
     375 * @param array|string $args {
    376376 *     Array of arguments.
    377  *     @type int $topic_id ID of the topic being updated.
    378  *     @type string $topic_title Updated title of the topic.
    379  *     @type string $topic_title Updated text of the topic.
    380  *     @type array|string|bool $topic_tags Array or comma-separated list of
    381  *           topic tags. False to leave empty. Default: false.
     377 *     @type int               $topic_id    ID of the topic being updated.
     378 *     @type string            $topic_title Updated title of the topic.
     379 *     @type string            $topic_text  Updated text of the topic.
     380 *     @type array|string|bool $topic_tags  Array or comma-separated list of
     381 *                                          topic tags. False to leave empty.
     382 *                                          Default false.
    382383 * }
    383384 * @return object Details about the new topic, as returned by
    384  *         {@link bp_forums_get_topic_details()}.
     385 *                {@link bp_forums_get_topic_details()}.
    385386 */
    386387function bp_forums_update_topic( $args = '' ) {
    387388
    388     /** This action is documented in bp-forums/bp-forums-screens */
     389    /** This action is documented in bp-forums/bp-forums-screens.php */
    389390    do_action( 'bbpress_init' );
    390391
     
    397398    extract( $r, EXTR_SKIP );
    398399
    399     // Check if the user is a spammer
     400    // Check if the user is a spammer.
    400401    if ( bp_is_user_inactive( bp_loggedin_user_id() ) )
    401402        return false;
    402403
    403     // bb_insert_topic() will append tags, but not remove them. So we remove all existing tags.
     404    // The bb_insert_topic() function will append tags, but not remove them. So we remove all existing tags.
    404405    bb_remove_topic_tags( $topic_id );
    405406
     
    410411        return false;
    411412
    412     // Update the first post
     413    // Update the first post.
    413414    if ( !$post = bp_forums_insert_post( array( 'post_id' => $post->post_id, 'topic_id' => $topic_id, 'post_text' => $topic_text, 'post_time' => $post->post_time, 'poster_id' => $post->poster_id, 'poster_ip' => $post->poster_ip, 'post_status' => $post->post_status, 'post_position' => $post->post_position ) ) )
    414415        return false;
     
    419420function bp_forums_sticky_topic( $args = '' ) {
    420421
    421     /** This action is documented in bp-forums/bp-forums-screens */
     422    /** This action is documented in bp-forums/bp-forums-screens.php */
    422423    do_action( 'bbpress_init' );
    423424
    424425    $r = wp_parse_args( $args, array(
    425426        'topic_id' => false,
    426         'mode'     => 'stick' // stick/unstick
     427        'mode'     => 'stick' // Stick/unstick.
    427428    ) );
    428429    extract( $r, EXTR_SKIP );
     
    439440 * Set a topic's open/closed status.
    440441 *
    441  * @param array $args {
    442  *     @type int $topic_id ID of the topic whose status is being changed.
    443  *     @type string $mode New status of the topic. 'open' or 'close'.
    444  *           Default: 'close'.
     442 * @param array|string $args {
     443 *     @type int    $topic_id ID of the topic whose status is being changed.
     444 *     @type string $mode     New status of the topic. 'open' or 'close'.
     445 *                            Default: 'close'.
    445446 * }
    446447 * @return bool True on success, false on failure.
     
    448449function bp_forums_openclose_topic( $args = '' ) {
    449450
    450     /** This action is documented in bp-forums/bp-forums-screens */
     451    /** This action is documented in bp-forums/bp-forums-screens.php */
    451452    do_action( 'bbpress_init' );
    452453
    453454    $r = wp_parse_args( $args, array(
    454455        'topic_id' => false,
    455         'mode'     => 'close' // stick/unstick
     456        'mode'     => 'close' // Stick/unstick.
    456457    ) );
    457458    extract( $r, EXTR_SKIP );
     
    468469 * Delete a topic.
    469470 *
    470  * @param array $args {
     471 * @param array|string $args {
    471472 *     @type int $topic_id ID of the topic being deleted.
    472473 * }
     
    475476function bp_forums_delete_topic( $args = '' ) {
    476477
    477     /** This action is documented in bp-forums/bp-forums-screens */
     478    /** This action is documented in bp-forums/bp-forums-screens.php */
    478479    do_action( 'bbpress_init' );
    479480
     
    494495    global $bbdb;
    495496
    496     /** This action is documented in bp-forums/bp-forums-screens */
     497    /** This action is documented in bp-forums/bp-forums-screens.php */
    497498    do_action( 'bbpress_init' );
    498499
     
    528529 * @since 1.6.0
    529530 *
    530  * @param string $text The text of the comment.
    531  * @param int $topic_id The topic id.
    532  * @param int $user_id The user id.
     531 * @param string $text     The text of the comment.
     532 * @param int    $topic_id The topic id.
     533 * @param int    $user_id The user id.
    533534 * @return bool True if a duplicate reply exists, otherwise false.
    534535 */
     
    539540    if ( $text && $topic_id && $user_id ) {
    540541
    541         /** This action is documented in bp-forums/bp-forums-screens */
     542        /** This action is documented in bp-forums/bp-forums-screens.php */
    542543        do_action( 'bbpress_init' );
    543544
     
    547548        );
    548549
    549         // Set the reply_exists_text so we can check it in the filter below
     550        // Set the reply_exists_text so we can check it in the filter below.
    550551        buddypress()->forums->reply_exists_text = $text;
    551552
    552         // BB_Query's post_text parameter does a MATCH, while we need exact matches
     553        // BB_Query's post_text parameter does a MATCH, while we need exact matches.
    553554        add_filter( 'get_posts_where', '_bp_forums_reply_exists_posts_where' );
    554555        $query = new BB_Query( 'post', $args );
    555556        remove_filter( 'get_posts_where', '_bp_forums_reply_exists_posts_where' );
    556557
    557         // Cleanup
     558        // Cleanup.
    558559        unset( buddypress()->forums->reply_exists_text );
    559560
     
    574575}
    575576    /**
    576      * Private one-time-use function used in conjunction with bp_forums_reply_exists()
     577     * Private one-time-use function used in conjunction with bp_forums_reply_exists().
    577578     *
    578579     * @access private
     
    591592 * Get a total "Topics Started" count for a given user.
    592593 *
    593  * @param int $user_id ID of the user being queried. Falls back on displayed
    594  *        user, then loggedin.
    595  * @param string $type The current filter/sort type. 'active', 'popular',
    596  *        'unreplied'.
     594 * @param int    $user_id ID of the user being queried. Falls back on displayed
     595 *                        user, then loggedin.
     596 * @param string $type    The current filter/sort type. 'active', 'popular',
     597 *                        'unreplied'.
    597598 * @return int $count The topic count.
    598599 */
    599600function bp_forums_total_topic_count_for_user( $user_id = 0, $type = 'active' ) {
    600601
    601     /** This action is documented in bp-forums/bp-forums-screens */
     602    /** This action is documented in bp-forums/bp-forums-screens.php */
    602603    do_action( 'bbpress_init' );
    603604
     
    634635 * @since 1.5.0
    635636 *
    636  * @param int $user_id ID of the user whose replied topics are being counted.
    637  *        Defaults to displayed user, then to logged-in user.
     637 * @param int    $user_id ID of the user whose replied topics are being counted.
     638 *                        Defaults to displayed user, then to logged-in user.
     639 * @param string $type    Forum thread type.
    638640 * @return int $count Topic count.
    639641 */
    640642function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active' ) {
    641643
    642     /** This action is documented in bp-forums/bp-forums-screens */
     644    /** This action is documented in bp-forums/bp-forums-screens.php */
    643645    do_action( 'bbpress_init' );
    644646
     
    652654        $query = new BB_Query( 'post', array( 'post_author_id' => $user_id, 'page' => 1, 'per_page' => -1, 'count' => true ) );
    653655
    654         // Count the unique topics. No better way to do this in the bbPress query API
     656        // Count the unique topics. No better way to do this in the bbPress query API.
    655657        $topics = array();
    656658        foreach( $query->results as $result ) {
     
    659661        }
    660662
    661         // Even more unfortunate. If this is filtered by 'unreplied', we have to requery
     663        // Even more unfortunate. If this is filtered by 'unreplied', we have to requery.
    662664        if ( 'unreplied' == $type ) {
    663665            $topic_ids = implode( ',', $topics );
     
    702704    $bp = buddypress();
    703705
    704     // Get the topic ids
     706    // Get the topic ids.
    705707    foreach ( (array) $topics as $topic ) $topic_ids[] = $topic->topic_id;
    706708    $topic_ids = implode( ',', wp_parse_id_list( $topic_ids ) );
    707709
    708     // Fetch the topic's last poster details
     710    // Fetch the topic's last poster details.
    709711    $poster_details = $wpdb->get_results( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" );
    710712    for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
     
    719721    }
    720722
    721     // Fetch fullname for the topic's last poster
     723    // Fetch fullname for the topic's last poster.
    722724    if ( bp_is_active( 'xprofile' ) ) {
    723725        $poster_names = $wpdb->get_results( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" );
     
    731733
    732734    // Loop through to make sure that each topic has the proper values set. This covers the
    733     // case of deleted users
     735    // case of deleted users.
    734736    foreach ( (array) $topics as $key => $topic ) {
    735737        if ( !isset( $topic->topic_last_poster_email ) )
     
    754756 * Get the posts belonging to a topic.
    755757 *
    756  * @param array $args {
    757  *     @type int $topic_id ID of the topic for which posts are being fetched.
    758  *     @type int $page Optional. Page of results to return. Default: 1.
    759  *     @type int $page Optional. Number of results to return per page.
    760  *           Default: 15.
    761  *     @type string $order 'ASC' or 'DESC'. Default: 'ASC'.
     758 * @param array|string $args {
     759 *     @type int    $topic_id ID of the topic for which posts are being fetched.
     760 *     @type int    $page    Optional. Page of results to return. Default: 1.
     761 *     @type int    $page    Optional. Number of results to return per page.
     762 *                            Default: 15.
     763 *     @type string $order    'ASC' or 'DESC'. Default: 'ASC'.
    762764 * }
    763765 * @return array List of posts.
     
    765767function bp_forums_get_topic_posts( $args = '' ) {
    766768
    767     /** This action is documented in bp-forums/bp-forums-screens */
     769    /** This action is documented in bp-forums/bp-forums-screens.php */
    768770    do_action( 'bbpress_init' );
    769771
     
    791793function bp_forums_get_post( $post_id ) {
    792794
    793     /** This action is documented in bp-forums/bp-forums-screens */
     795    /** This action is documented in bp-forums/bp-forums-screens.php */
    794796    do_action( 'bbpress_init' );
    795797    return bb_get_post( $post_id );
     
    801803 * Wrapper for {@link bb_delete_post()}.
    802804 *
    803  * @param array $args {
     805 * @param array|string $args {
    804806 *     @type int $post_id ID of the post being deleted.
    805807 * }
     
    808810function bp_forums_delete_post( $args = '' ) {
    809811
    810     /** This action is documented in bp-forums/bp-forums-screens */
     812    /** This action is documented in bp-forums/bp-forums-screens.php */
    811813    do_action( 'bbpress_init' );
    812814
     
    823825 * Create a new post.
    824826 *
    825  * @param array $args {
    826  *     @type int $post_id Optional. ID of an existing post, if you want to
    827  *           update rather than create. Default: false.
    828  *     @type int $topic_id ID of the topic to which the post belongs.
    829  *     @type string $post_text Contents of the post.
    830  *     @type string $post_time Optional. Time when the post was recorded.
    831  *           Default: current time, as reported by {@link bp_core_current_time()}.
    832  *     @type int $poster_id Optional. ID of the user creating the post.
    833  *           Default: ID of the logged-in user.
    834  *     @type string $poster_ip Optional. IP address of the user creating the
    835  *           post. Default: the IP address found in $_SERVER['REMOTE_ADDR'].
    836  *     @type int $post_status Post status. Default: 0.
    837  *     @type int $post_position Optional. Default: false (auto).
     827 * @param array|string $args {
     828 *     @type int    $post_id      Optional. ID of an existing post, if you want to
     829 *                                 update rather than create. Default: false.
     830 *     @type int    $topic_id      ID of the topic to which the post belongs.
     831 *     @type string $post_text     Contents of the post.
     832 *     @type string $post_time     Optional. Time when the post was recorded.
     833 *                                 Default: current time, as reported by {@link bp_core_current_time()}.
     834 *     @type int    $poster_id    Optional. ID of the user creating the post.
     835 *                                 Default: ID of the logged-in user.
     836 *     @type string $poster_ip     Optional. IP address of the user creating the
     837 *                                 post. Default: the IP address found in $_SERVER['REMOTE_ADDR'].
     838 *     @type int    $post_status  Post status. Default: 0.
     839 *     @type int    $post_position Optional. Default: false (auto).
    838840 * }
    839841 * @return int|bool ID of the new post on success, false on failure.
     
    841843function bp_forums_insert_post( $args = '' ) {
    842844
    843     /** This action is documented in bp-forums/bp-forums-screens */
     845    /** This action is documented in bp-forums/bp-forums-screens.php */
    844846    do_action( 'bbpress_init' );
    845847
     
    849851        'post_text'     => '',
    850852        'post_time'     => bp_core_current_time(),
    851         'poster_id'     => bp_loggedin_user_id(), // accepts ids or names
     853        'poster_id'     => bp_loggedin_user_id(), // Accepts ids or names.
    852854        'poster_ip'     => $_SERVER['REMOTE_ADDR'],
    853         'post_status'   => 0, // use bb_delete_post() instead
     855        'post_status'   => 0, // Use bb_delete_post() instead.
    854856        'post_position' => false
    855857    );
     
    914916    $bp = buddypress();
    915917
    916     // Get the user ids
     918    // Get the user ids.
    917919    foreach ( (array) $posts as $post ) $user_ids[] = $post->poster_id;
    918920    $user_ids = implode( ',', wp_parse_id_list( $user_ids ) );
    919921
    920     // Fetch the poster's user_email, user_nicename and user_login
     922    // Fetch the poster's user_email, user_nicename and user_login.
    921923    $poster_details = $wpdb->get_results( "SELECT u.ID as user_id, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u WHERE u.ID IN ( {$user_ids} )" );
    922924
     
    958960 * @param int $forum_id ID of the forum.
    959961 * @return object Object with properties $topics (topic count) and $posts
    960  *         (post count).
     962 *                (post count).
    961963 */
    962964function bp_forums_get_forum_topicpost_count( $forum_id ) {
    963965    global $wpdb, $bbdb;
    964966
    965     /** This action is documented in bp-forums/bp-forums-screens */
    966     do_action( 'bbpress_init' );
    967 
    968     // Need to find a bbPress function that does this
     967    /** This action is documented in bp-forums/bp-forums-screens.php */
     968    do_action( 'bbpress_init' );
     969
     970    // Need to find a bbPress function that does this.
    969971    return $wpdb->get_results( $wpdb->prepare( "SELECT topics, posts from {$bbdb->forums} WHERE forum_id = %d", $forum_id ) );
    970972}
     
    10231025 *
    10241026 * @return bool True if stickies should be displayed at the top of the global
    1025  *         directory, otherwise false.
     1027 *              directory, otherwise false.
    10261028 */
    10271029function bp_forums_enable_global_directory_stickies() {
     
    10451047 */
    10461048
    1047 // List actions to clear super cached pages on, if super cache is installed
     1049// List actions to clear super cached pages on, if super cache is installed.
    10481050add_action( 'bp_forums_new_forum', 'bp_core_clear_cache' );
    10491051add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' );
     
    10771079 * Wrapper function for {@link bb_get_postmeta()}.
    10781080 *
    1079  * @package BuddyPress_Forums
    10801081 * @since 1.5.0
     1082 *
     1083 * @param object $cache    Cache object.
     1084 * @param int    $id       ID of the forum being cached.
     1085 * @param string $cachekey Key to use with forum embed cache.
    10811086 */
    10821087function bp_embed_forum_cache( $cache, $id, $cachekey ) {
     
    10901095 *
    10911096 * @since 1.5.0
     1097 *
     1098 * @param object $cache    Cache object.
     1099 * @param string $cachekey Key to use with forum embed cache.
     1100 * @param int    $id       ID of the forum being cached.
    10921101 */
    10931102function bp_embed_forum_save_cache( $cache, $cachekey, $id ) {
Note: See TracChangeset for help on using the changeset viewer.