Making WordPress.org

Changeset 4121


Ignore:
Timestamp:
09/23/2016 07:20:20 PM (10 years ago)
Author:
Otto42
Message:

Override pubDate in RSS feeds for forums bbPress views. This will force these topic-like feeds to use the pubDate corresponding to the publish date of the first post, and not that of the last-active-time of the thread. If this causes issues in feed readers, then we'll roll back.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php

    r4115 r4121  
    108108                                $this->query = $query_vars;
    109109                                add_filter( 'bbp_get_view_query_args', array( $this, 'get_view_query_args_for_feed' ), 10, 2 );
     110
     111                                // Override bbPress topic pubDate handling to show topic time and not last active time
     112                                add_filter( 'get_post_metadata', array( $this, 'topic_pubdate_correction_for_feed' ), 10, 4 );
    110113                        }
    111114                }
    112115                return $query_vars;
     116        }
     117
     118        public function topic_pubdate_correction_for_feed( $value, $object_id, $meta_key, $single ) {
     119                // We only care about _bbp_last_active_time in this particular context
     120                if ( $meta_key == '_bbp_last_active_time' ) {
     121                        $value = get_post_time( 'Y-m-d H:i:s', true, $object_id );
     122                }
     123                return $value;
    113124        }
    114125
Note: See TracChangeset for help on using the changeset viewer.