Skip to:
Content

BuddyPress.org

Changeset 13690


Ignore:
Timestamp:
01/05/2024 03:50:01 AM (13 months ago)
Author:
imath
Message:

Make sure a BP directory used as home can be previewed in customizer

Introduce the bp_is_site_home() function to check requested URL is the same than site's home one even into the customizer.

Props vapvarun

Fixes #9056 (branch 12.0)

Location:
branches/12.0/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/12.0/src/bp-activity/classes/class-bp-activity-component.php

    r13522 r13690  
    482482        }
    483483
    484         if ( home_url( '/' ) === bp_get_requested_url() && bp_is_directory_homepage( $this->id ) ) {
     484        if ( bp_is_site_home() && bp_is_directory_homepage( $this->id ) ) {
    485485            $query->set( $this->rewrite_ids['directory'], 1 );
    486486        }
  • branches/12.0/src/bp-core/bp-core-template.php

    r13493 r13690  
    19241924     */
    19251925    return (bool) apply_filters( 'bp_is_blog_page', $is_blog_page );
     1926}
     1927
     1928/**
     1929 * Checks whether the requested URL is site home's one.
     1930 *
     1931 * @since 12.1.0
     1932 *
     1933 * @return boolean True if the requested URL is site home's one. False otherwise.
     1934 */
     1935function bp_is_site_home() {
     1936    $requested_url = bp_get_requested_url();
     1937    $home_url      = home_url( '/' );
     1938
     1939    if ( is_customize_preview() ) {
     1940        $requested_url = wp_parse_url( $requested_url, PHP_URL_PATH );
     1941        $home_url      = wp_parse_url( $home_url, PHP_URL_PATH );
     1942    }
     1943
     1944    return $home_url === $requested_url;
    19261945}
    19271946
  • branches/12.0/src/bp-groups/classes/class-bp-groups-component.php

    r13525 r13690  
    10651065        }
    10661066
    1067         if ( home_url( '/' ) === bp_get_requested_url() && bp_is_directory_homepage( $this->id ) ) {
     1067        if ( bp_is_site_home() && bp_is_directory_homepage( $this->id ) ) {
    10681068            $query->set( $this->rewrite_ids['directory'], 1 );
    10691069        }
  • branches/12.0/src/bp-members/classes/class-bp-members-component.php

    r13621 r13690  
    797797        }
    798798
    799         if ( home_url( '/' ) === bp_get_requested_url() && bp_is_directory_homepage( $this->id ) ) {
     799        if ( bp_is_site_home() && bp_is_directory_homepage( $this->id ) ) {
    800800            $query->set( $this->rewrite_ids['directory'], 1 );
    801801        }
Note: See TracChangeset for help on using the changeset viewer.