Changeset 10788
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-notifications/bp-notifications-functions.php
r10725 r10788 702 702 add_filter( 'query', 'bp_filter_metaid_column_name' ); 703 703 foreach ( $keys as $key ) { 704 $retval = delete_metadata( 'notification s', $notification_id, $key, $meta_value, $delete_all );704 $retval = delete_metadata( 'notification', $notification_id, $key, $meta_value, $delete_all ); 705 705 } 706 706 remove_filter( 'query', 'bp_filter_metaid_column_name' ); … … 727 727 function bp_notifications_get_meta( $notification_id = 0, $meta_key = '', $single = true ) { 728 728 add_filter( 'query', 'bp_filter_metaid_column_name' ); 729 $retval = get_metadata( 'notification s', $notification_id, $meta_key, $single );729 $retval = get_metadata( 'notification', $notification_id, $meta_key, $single ); 730 730 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 731 731 … … 762 762 function bp_notifications_update_meta( $notification_id, $meta_key, $meta_value, $prev_value = '' ) { 763 763 add_filter( 'query', 'bp_filter_metaid_column_name' ); 764 $retval = update_metadata( 'notification s', $notification_id, $meta_key, $meta_value, $prev_value );764 $retval = update_metadata( 'notification', $notification_id, $meta_key, $meta_value, $prev_value ); 765 765 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 766 766 … … 783 783 function bp_notifications_add_meta( $notification_id, $meta_key, $meta_value, $unique = false ) { 784 784 add_filter( 'query', 'bp_filter_metaid_column_name' ); 785 $retval = add_metadata( 'notification s', $notification_id, $meta_key, $meta_value, $unique );785 $retval = add_metadata( 'notification', $notification_id, $meta_key, $meta_value, $unique ); 786 786 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 787 787 -
trunk/src/bp-notifications/classes/class-bp-notifications-component.php
r10675 r10788 83 83 ); 84 84 85 // Metadata tables for notifications component. 86 $meta_tables = array( 87 'notification' => $bp->table_prefix . 'bp_notifications_meta', 88 ); 89 85 90 // All globals for the notifications component. 86 91 // Note that global_tables is included in this array. … … 90 95 'search_string' => __( 'Search Notifications...', 'buddypress' ), 91 96 'global_tables' => $global_tables, 97 'meta_tables' => $meta_tables 92 98 ); 93 99 -
trunk/tests/phpunit/testcases/notifications/functions.php
r10437 r10788 122 122 123 123 $this->assertFalse( wp_cache_get( 'all_for_user_' . $u, 'bp_notifications' ) ); 124 } 125 126 /** 127 * @group bp_notifications_update_meta_cache 128 */ 129 public function test_bp_notifications_update_meta_cache() { 130 $u = $this->factory->user->create(); 131 132 $n1 = $this->factory->notification->create( array( 133 'component_name' => 'messages', 134 'user_id' => $u 135 ) ); 136 137 $n2 = $this->factory->notification->create( array( 138 'component_name' => 'groups', 139 'user_id' => $u 140 ) ); 141 142 // Add cache for each notification. 143 bp_notifications_update_meta( $n1, 'meta', 'data' ); 144 bp_notifications_update_meta( $n1, 'data', 'meta' ); 145 bp_notifications_update_meta( $n2, 'meta', 'human' ); 146 147 // Prime cache. 148 bp_notifications_get_meta( $n1, 'meta' ); 149 150 // Ensure an empty cache for second notification. 151 wp_cache_delete( $n2, 'notification_meta' ); 152 153 // Update notification meta cache. 154 bp_notifications_update_meta_cache( array( $n1, $n2 ) ); 155 156 $expected = array( 157 $n1 => array( 158 'meta' => array( 159 'data', 160 ), 161 'data' => array( 162 'meta', 163 ), 164 ), 165 $n2 => array( 166 'meta' => array( 167 'human', 168 ), 169 ), 170 ); 171 172 $found = array( 173 $n1 => wp_cache_get( $n1, 'notification_meta' ), 174 $n2 => wp_cache_get( $n2, 'notification_meta' ), 175 ); 176 177 $this->assertEquals( $expected, $found ); 124 178 } 125 179
Note: See TracChangeset
for help on using the changeset viewer.