Skip to:
Content

bbPress.org

Changeset 7175


Ignore:
Timestamp:
01/03/2021 07:19:06 AM (13 months ago)
Author:
johnjamesjacoby
Message:

Theme Compatibility: improve handling of shortcodes in some template functions.

This commit swaps out is_page() || is_single() for is_singular() which is easier to understand, and also raises the priority of that conditional check inside bbp_get_topics_pagination_base(), allowing it to work as intended inside of topic views and tags shortcode usages.

In trunk for 2.7.0. See #3358.

Location:
trunk/src/includes
Files:
4 edited

Legend:

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

    r7138 r7175  
    23132313            $base = bbp_get_user_profile_url( bbp_get_displayed_user_id() );
    23142314
    2315         // Page or single post
    2316         } elseif ( is_page() || is_single() ) {
     2315        // Any single post (for shortcodes)
     2316        } elseif ( is_singular() ) {
    23172317            $base = get_permalink();
    23182318
  • trunk/src/includes/search/template.php

    r7076 r7175  
    354354    if ( bbp_use_pretty_urls() ) {
    355355
    356         // Shortcode territory
    357         if ( is_page() || is_single() ) {
     356        // Any single post (for shortcodes)
     357        if ( is_singular() ) {
    358358            $base = get_permalink();
    359359
  • trunk/src/includes/topics/template.php

    r7148 r7175  
    29122912            $base = bbp_get_user_profile_url( bbp_get_displayed_user_id() );
    29132913
     2914        // Any single post (for shortcodes, ahead of shortcodeables below)
     2915        } elseif ( is_singular() ) {
     2916            $base = get_permalink();
     2917
    29142918        // View
    29152919        } elseif ( bbp_is_single_view() ) {
     
    29192923        } elseif ( bbp_is_topic_tag() ) {
    29202924            $base = bbp_get_topic_tag_link();
    2921 
    2922         // Page or single post
    2923         } elseif ( is_page() || is_single() ) {
    2924             $base = get_permalink();
    29252925
    29262926        // Forum archive
  • trunk/src/includes/users/template.php

    r7158 r7175  
    22382238
    22392239    // Looking at a single forum & forum is open
    2240     } elseif ( ( is_page() || is_single() ) && bbp_is_forum_open() ) {
     2240    } elseif ( is_singular() && bbp_is_forum_open() ) {
    22412241        $retval = bbp_current_user_can_publish_forums();
    22422242
     
    22672267
    22682268    // Looking at a single forum & forum is open
    2269     } elseif ( ( bbp_is_single_forum() || is_page() || is_single() ) && bbp_is_forum_open() ) {
     2269    } elseif ( ( bbp_is_single_forum() || is_singular() ) && bbp_is_forum_open() ) {
    22702270        $retval = bbp_current_user_can_publish_topics();
    22712271
     
    22952295        $retval = true;
    22962296
    2297     // Looking at a single topic, topic is open, and forum is open
    2298     } elseif ( ( bbp_is_single_topic() || is_page() || is_single() ) && bbp_is_topic_open() && bbp_is_forum_open() && bbp_is_topic_published() ) {
     2297    // Looking at single topic (and singulars), topic is open, and forum is open
     2298    } elseif ( ( bbp_is_single_topic() || is_singular() ) && bbp_is_topic_open() && bbp_is_forum_open() && bbp_is_topic_published() ) {
    22992299        $retval = bbp_current_user_can_publish_replies();
    23002300
Note: See TracChangeset for help on using the changeset viewer.