Changeset 9378
- Timestamp:
- 01/19/2015 08:53:46 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-classes.php
r9377 r9378 136 136 */ 137 137 public function populate() { 138 global $wpdb , $bp;138 global $wpdb; 139 139 140 140 $row = wp_cache_get( $this->id, 'bp_activity' ); 141 141 142 142 if ( false === $row ) { 143 $bp = buddypress(); 143 144 $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) ); 144 145 … … 302 303 */ 303 304 public static function get( $args = array() ) { 304 global $wpdb , $bp;305 global $wpdb; 305 306 306 307 // Backward compatibility with old method of passing arguments … … 326 327 } 327 328 328 $r = wp_parse_args( $args, array( 329 $bp = buddypress(); 330 $r = wp_parse_args( $args, array( 329 331 'page' => 1, // The current page 330 332 'per_page' => 25, // Activity items per page … … 1055 1057 */ 1056 1058 public static function delete( $args = array() ) { 1057 global $wpdb, $bp; 1059 global $wpdb; 1060 1061 $bp = buddypress(); 1058 1062 1059 1063 $defaults = array( … … 1156 1160 */ 1157 1161 public static function delete_activity_item_comments( $activity_ids = array(), $delete_meta = true ) { 1158 global $bp, $wpdb; 1159 1160 $delete_meta = (bool) $delete_meta; 1161 1162 global $wpdb; 1163 1164 $bp = buddypress(); 1165 1166 $delete_meta = (bool) $delete_meta; 1162 1167 $activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) ); 1163 1168 … … 1227 1232 * @since BuddyPress (1.2) 1228 1233 * 1229 * @global BuddyPress $bp The one true BuddyPress instance.1230 1234 * @global wpdb $wpdb WordPress database object. 1231 1235 * … … 1238 1242 */ 1239 1243 public static function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) { 1240 global $wpdb , $bp;1244 global $wpdb; 1241 1245 1242 1246 if ( empty( $top_level_parent_id ) ) { … … 1253 1257 // A true cache miss 1254 1258 } elseif ( empty( $comments ) ) { 1259 1260 $bp = buddypress(); 1255 1261 1256 1262 // Select the user's fullname with the query … … 1420 1426 * @since BuddyPress (1.2) 1421 1427 * 1422 * @global BuddyPress $bp The one true BuddyPress instance.1423 1428 * @global wpdb $wpdb WordPress database object. 1424 1429 * … … 1427 1432 */ 1428 1433 public static function get_child_comments( $parent_id ) { 1429 global $bp, $wpdb; 1434 global $wpdb; 1435 1436 $bp = buddypress(); 1430 1437 1431 1438 return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) ); … … 1443 1450 */ 1444 1451 public static function get_recorded_components( $skip_last_activity = true ) { 1445 global $wpdb, $bp; 1446 1447 if ( $skip_last_activity ) { 1452 global $wpdb; 1453 1454 $bp = buddypress(); 1455 1456 if ( true === $skip_last_activity ) { 1448 1457 $components = $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} WHERE action != '' AND action != 'last_activity' ORDER BY component ASC" ); 1449 1458 } else { … … 1597 1606 */ 1598 1607 public static function get_last_updated() { 1599 global $bp, $wpdb; 1608 global $wpdb; 1609 1610 $bp = buddypress(); 1600 1611 1601 1612 return $wpdb->get_var( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" ); … … 1629 1640 */ 1630 1641 public static function check_exists_by_content( $content ) { 1631 global $wpdb, $bp; 1642 global $wpdb; 1643 1644 $bp = buddypress(); 1632 1645 1633 1646 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) ); … … 1641 1654 */ 1642 1655 public static function hide_all_for_user( $user_id ) { 1643 global $wpdb, $bp; 1656 global $wpdb; 1657 1658 $bp = buddypress(); 1644 1659 1645 1660 return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
Note: See TracChangeset
for help on using the changeset viewer.