Skip to:
Content

bbPress.org

Changeset 6931


Ignore:
Timestamp:
11/09/2019 06:36:26 PM (2 years ago)
Author:
johnjamesjacoby
Message:

Topics/Replies: improved support for replies without topics.

This commit removes an assumptive call to bbp_get_topic() and avoids a debug notice when a reply is orphaned.

See #3226.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/replies/template.php

    r6923 r6931  
    441441        if ( bbp_is_reply( $reply_id ) ) {
    442442            $topic_id = bbp_get_reply_topic_id( $reply_id );
     443            $topic    = bbp_get_topic( $topic_id );
    443444        } elseif ( bbp_is_topic( $reply_id ) ) {
    444445            $topic_id = bbp_get_topic_id( $reply_id );
     446            $topic    = bbp_get_topic( $topic_id );
    445447            $reply_id = $topic_id;
    446448        }
     
    461463
    462464        // Get vars needed to support pending topics with unpretty links
    463         $has_slug   = bbp_get_topic( $topic_id )->post_name;
     465        $has_slug   = ! empty( $topic ) ? $topic->post_name : '';
    464466        $pretty     = bbp_use_pretty_urls();
    465467        $published  = ! bbp_is_topic_pending( $topic_id );
Note: See TracChangeset for help on using the changeset viewer.