Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/12/2021 03:44:31 PM (3 years ago)
Author:
imath
Message:

Make sure a situation is attached to a BP Email before displaying it

Props dhavalkasvala

Fixes #8165

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-admin.php

    r13169 r13186  
    11361136
    11371137        // Grab email situations for the current post.
    1138         $situations = wp_list_pluck( get_the_terms( $post_id, bp_get_email_tax_type() ), 'description' );
    1139 
    1140         // Output each situation as a list item.
    1141         echo '<ul><li>';
    1142         echo implode( '</li><li>', $situations );
    1143         echo '</li></ul>';
     1138        $terms           = get_the_terms( $post_id, bp_get_email_tax_type() );
     1139        $taxonomy_object = get_taxonomy( bp_get_email_tax_type() );
     1140
     1141        if ( is_wp_error( $terms ) || ! $terms  ) {
     1142            printf( '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>', $taxonomy_object->labels->no_terms );
     1143        } else {
     1144            $situations = wp_list_pluck( $terms, 'description' );
     1145
     1146            // Output each situation as a list item.
     1147            echo '<ul><li>';
     1148            echo implode( '</li><li>', $situations );
     1149            echo '</li></ul>';
     1150        }
    11441151    }
    11451152
Note: See TracChangeset for help on using the changeset viewer.