Skip to:
Content

BuddyPress.org

Changeset 6055


Ignore:
Timestamp:
05/31/2012 11:50:28 PM (13 years ago)
Author:
boonebgorges
Message:

Introduces a filter on global table names in BP_Component::setup_globals()

When a component registers its globals using BP_Component::setup_globals(),
most of the properties are run through a high-level filter. The one exception
is global_tables, meaning that developers have been limited in the way they
can customize data storage.

Among other things, this change will make it easier to have fine-grained
control over how multi-network BP setups work.

Fixes #4228
Props sbrajesh

File:
1 edited

Legend:

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

    r5999 r6055  
    147147        $this->notification_callback = apply_filters( 'bp_' . $this->id . '_notification_callback', $r['notification_callback'] );
    148148
    149         // Setup global table names
    150         if ( !empty( $r['global_tables'] ) )
    151             foreach ( $r['global_tables'] as $global_name => $table_name )
     149        // Set up global table names
     150        if ( !empty( $r['global_tables'] ) ) {
     151            // This filter allows for component-specific filtering of table names
     152            // To filter *all* tables, use the 'bp_core_get_table_prefix' filter instead
     153            $r['global_tables'] = apply_filters( 'bp_' . $this->id . '_global_tables', $r['global_tables'] );
     154
     155            foreach ( $r['global_tables'] as $global_name => $table_name ) {
    152156                $this->$global_name = $table_name;
     157            }
     158                }
    153159
    154160        /** BuddyPress ********************************************************/
Note: See TracChangeset for help on using the changeset viewer.