Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/21/2011 07:47:46 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Add general post meta functions to bbp-general-functions.php. More consolidation to do here later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-general-functions.php

    r3171 r3181  
    1010// Redirect if accessed directly
    1111if ( !defined( 'ABSPATH' ) ) exit;
     12
     13/** Post Meta *****************************************************************/
     14
     15/**
     16 * Update a posts forum meta ID
     17 *
     18 * @since bbPress (r3181)
     19 *
     20 * @param int $post_id The post to update
     21 * @param int $forum_id The forum
     22 */
     23function bbp_update_forum_id( $post_id, $forum_id ) {
     24
     25    // Allow the forum ID to be updated 'just in time' before save
     26    $forum_id = apply_filters( 'bbp_update_forum_id', $forum_id, $post_id );
     27
     28    // Update the post meta forum ID
     29    update_post_meta( $post_id, '_bbp_forum_id', (int) $forum_id );
     30}
     31
     32/**
     33 * Update a posts topic meta ID
     34 *
     35 * @since bbPress (r3181)
     36 *
     37 * @param int $post_id The post to update
     38 * @param int $forum_id The forum
     39 */
     40function bbp_update_topic_id( $post_id, $topic_id ) {
     41
     42    // Allow the topic ID to be updated 'just in time' before save
     43    $topic_id = apply_filters( 'bbp_update_topic_id', $topic_id, $post_id );
     44
     45    // Update the post meta topic ID
     46    update_post_meta( $post_id, '_bbp_topic_id', (int) $topic_id );
     47}
     48
     49/**
     50 * Update a posts reply meta ID
     51 *
     52 * @since bbPress (r3181)
     53 *
     54 * @param int $post_id The post to update
     55 * @param int $forum_id The forum
     56 */
     57function bbp_update_reply_id( $post_id, $reply_id ) {
     58
     59    // Allow the reply ID to be updated 'just in time' before save
     60    $reply_id = apply_filters( 'bbp_update_reply_id', $reply_id, $post_id );
     61
     62    // Update the post meta reply ID
     63    update_post_meta( $post_id, '_bbp_reply_id',(int) $reply_id );
     64}
    1265
    1366/** Formatting ****************************************************************/
Note: See TracChangeset for help on using the changeset viewer.