Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/05/2015 06:18:13 PM (5 years ago)
Author:
boonebgorges
Message:

Introduce bp_core_get_root_option() and use throughout BP.

Previously, we referenced the $bp->site_options array directly. This causes
problems in cases where these options may be referenced before the array is
initially populated. bp_core_get_root_option() will fetch the requested
value from the array if it's been populated, and will populate it if it has not.

Fixes #6045.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-filters.php

    r9472 r9698  
    8787     * That plugin changed the way its settings were stored at some point. Thus the dual check.
    8888     */
    89     if ( ! empty( $bp->site_options['sitewide_tags_blog'] ) ) {
    90         $st_options = maybe_unserialize( $bp->site_options['sitewide_tags_blog'] );
     89    $sitewide_tags_blog_settings = bp_core_get_root_option( 'sitewide_tags_blog' );
     90    if ( ! empty( $sitewide_tags_blog_settings ) ) {
     91        $st_options = maybe_unserialize( $sitewide_tags_blog_settings );
    9192        $tags_blog_id = isset( $st_options['tags_blog_id'] ) ? $st_options['tags_blog_id'] : 0;
    9293    } else {
    93         $tags_blog_id = isset( $bp->site_options['tags_blog_id'] ) ? $bp->site_options['tags_blog_id'] : 0;
     94        $tags_blog_id = bp_core_get_root_option( 'sitewide_tags_blog' );
     95        $tags_blog_id = intval( $tags_blog_id );
    9496    }
    9597
Note: See TracChangeset for help on using the changeset viewer.