BP_Component::register_global_tables( array $tables = array() )
Register global tables for the component, so that it may use WordPress’s database API.
Description
Parameters
- $tables
-
(Optional) Table names to register.
Default value: array()
Source
File: bp-core/classes/class-bp-component.php
public function register_global_tables( $tables = array() ) { /** * Filters the global tables for the component, so that it may use WordPress' database API. * * This is a dynamic hook that is based on the component string ID. * It allows for component-specific filtering of table names. To filter * *all* tables, use the 'bp_core_get_table_prefix' filter instead. * * @since BuddyPress 1.6.0 */ $tables = apply_filters( 'bp_' . $this->id . '_global_tables', $tables ); // Add to the BuddyPress global object. if ( !empty( $tables ) && is_array( $tables ) ) { foreach ( $tables as $global_name => $table_name ) { $this->$global_name = $table_name; } // Keep a record of the metadata tables in the component. $this->global_tables = $tables; } /** * Fires at the end of the register_global_tables method inside BP_Component. * * This is a dynamic hook that is based on the component string ID. * * @since BuddyPress 2.0.0 */ do_action( 'bp_' . $this->id . '_register_global_tables' ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.