Skip to:
Content

bbPress.org


Ignore:
Timestamp:
01/29/2012 08:23:20 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Global $post usage clean-up:

  • Use bbp_get_global_post_field() where appropriate, core WP functions otherwise
  • Replace local $post variables with $post to avoid stomping the global
  • Audit usage of bbp_get_global_post_field() and make sure we are providing the correct context
  • Fixes #1733.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-forums.php

    r3688 r3714  
    507507     * @since bbPress (r3080)
    508508     *
    509      * @global WP_Query $post
    510509     * @global int $post_ID
    511510     * @uses get_post_type()
     
    520519     */
    521520    function updated_messages( $messages ) {
    522         global $post, $post_ID;
     521        global $post_ID;
    523522
    524523        if ( get_post_type( $post_ID ) != $this->post_type )
     
    527526        // URL for the current forum
    528527        $forum_url = bbp_get_forum_permalink( $post_ID );
     528
     529        // Current forum's post_date
     530        $post_date = bbp_get_global_post_field( 'post_date', 'raw' );
    529531
    530532        // Messages array
     
    563565                    // translators: Publish box date format, see http://php.net/date
    564566                    date_i18n( __( 'M j, Y @ G:i' ),
    565                     strtotime( $post->post_date ) ),
     567                    strtotime( $post_date ) ),
    566568                    $forum_url ),
    567569
Note: See TracChangeset for help on using the changeset viewer.