Skip to:
Content

BuddyPress.org

Changeset 4933


Ignore:
Timestamp:
08/06/2011 12:39:28 PM (10 years ago)
Author:
boonebgorges
Message:

Avoid variable type errors when bp-pages is manually deleted from database. Fixes #3440

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r4927 r4933  
    9393    }
    9494
    95     foreach( (array)$page_ids as $component_name => $page_id ) {
    96         if ( empty( $component_name ) || empty( $page_id ) ) {
    97             unset( $page_ids[$component_name] );
     95    // Ensure that empty indexes are unset. Should only matter in edge cases
     96    if ( $page_ids && is_array( $page_ids ) ) {
     97        foreach( (array)$page_ids as $component_name => $page_id ) {
     98            if ( empty( $component_name ) || empty( $page_id ) ) {
     99                unset( $page_ids[$component_name] );
     100            }
    98101        }
    99102    }
     
    127130function bp_core_get_directory_pages() {
    128131    global $wpdb, $bp;
     132   
     133    // Set pages as standard class
     134    $pages = new stdClass;
    129135
    130136    // Get pages and IDs
    131137    if ( $page_ids = bp_core_get_directory_page_ids() ) {
    132 
    133         // Set pages as standard class
    134         $pages = new stdClass;
    135138
    136139        $posts_table_name = bp_is_multiblog_mode() ? $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'posts' : $wpdb->posts;
Note: See TracChangeset for help on using the changeset viewer.