Making WordPress.org


Ignore:
Timestamp:
02/21/2023 05:48:06 AM (4 years ago)
Author:
dd32
Message:

Support Forums: Setup the Directory_Compat classes in the context of the topic when processing email subscriptions for pending/delayed topics.

See #6786.

File:
1 edited

Legend:

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

    r12347 r12410  
    1919        abstract protected function name();
    2020        abstract protected function parse_query();
     21        abstract protected function for_slug( $slug );
    2122        abstract protected function do_view_sidebar();
    2223        abstract protected function do_topic_sidebar();
    … …  
    6869
    6970                }
     71        }
     72
     73        /**
     74         * Maybe load the data for this compat directory class.
     75         *
     76         * @param int $topic_id The topic ID that we should initialize in the context of.
     77         */
     78        public function init_for_topic( $topic_id ) {
     79                $forum_id = bbp_get_topic_forum_id( $topic_id );
     80                if ( $forum_id != $this->forum_id() ) {
     81                        return;
     82                }
     83
     84                $terms = get_the_terms( $topic_id, $this->taxonomy() );
     85                if ( ! $terms ) {
     86                        return;
     87                }
     88
     89                $this->for_slug( $terms[0]->slug );
    7090        }
    7191
    … …  
    828848                // Note: Not using $this->title() here so as to filter other terms of this taxonomy correctly.
    829849
    830                 $term->name = $this->get_object( $term->slug )->post_title ?? $term->name;
     850                if ( ! is_admin() ) {
     851                        $term->name = $this->get_object( $term->slug )->post_title ?? $term->name;
     852                }
    831853
    832854                return $term;
Note: See TracChangeset for help on using the changeset viewer.