Making WordPress.org

Changeset 1459


Ignore:
Timestamp:
03/27/2015 09:59:39 PM (11 years ago)
Author:
coffee2code
Message:

Profiles Activity Handler: Also change the meta table name via 'bp_activity_meta_tables' filter and future-proof table name overriding.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/profiles.wordpress.org/public_html/wp-content/plugins/wporg-profiles-activity-handler/wporg-profiles-activity-handler.php

    r870 r1459  
    3636                 */
    3737                public function __construct() {
    38                         add_filter( 'bp_activity_global_tables', array( $this, 'change_table_names' ) );
     38                        add_filter( 'bp_activity_global_tables', array( $this, 'change_global_table_names' ) );
     39                        add_filter( 'bp_activity_meta_tables',   array( $this, 'change_meta_table_names' ) );
    3940                        add_filter( 'bp_active_components',      array( $this, 'activate_activity_component' ) );
    4041                        add_action( 'plugins_loaded',            array( $this, 'plugins_loaded' ) );
     
    6061                 * @return array
    6162                 */
    62                 public function change_table_names( $tables ) {
     63                public function change_global_table_names( $tables ) {
    6364                        global $bp;
    6465
    65                         return array(
    66                                 'table_name'      => $bp->table_prefix . 'wporg_activity',
    67                                 'table_name_meta' => $bp->table_prefix . 'wporg_activity_meta',
    68                         );
     66                        $tables['table_name']      = $bp->table_prefix . 'wporg_activity';
     67                        $tables['table_name_meta'] = $bp->table_prefix . 'wporg_activity_meta';
     68
     69                        return $tables;
     70                }
     71
     72                /**
     73                 * Changes the meta table name to use custom wporg activity meta tables rather
     74                 * than the ones for BuddyPress.org.
     75                 *
     76                 * @param  array $tables The default meta table.
     77                 * @return array
     78                 */
     79                public function change_meta_table_names( $tables ) {
     80                        global $bp;
     81
     82                        $tables['activity'] = $bp->table_prefix . 'wporg_activity_meta';
     83
     84                        return $tables;
    6985                }
    7086
Note: See TracChangeset for help on using the changeset viewer.