Changeset 8047 for trunk/bp-core/bp-core-classes.php
- Timestamp:
- 03/05/2014 06:11:16 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-classes.php
r8025 r8047 1340 1340 } 1341 1341 1342 // get cache for single user only 1343 if ( ! is_array( $user_id ) ) { 1344 $cache = wp_cache_get( $user_id, 'bp_last_activity' ); 1345 1346 if ( false !== $cache ) { 1347 return $cache; 1348 } 1349 } 1350 1342 1351 $bp = buddypress(); 1343 1352 … … 1377 1386 $table_name = buddypress()->members->table_name_last_activity; 1378 1387 1379 $existing = self::get_last_activity( $user_id ); 1380 1381 if ( ! empty( $existing ) ) { 1382 $data = array( 1383 'date_recorded' => $time, 1384 ); 1385 1386 $data_format = array( 1387 '%s', 1388 ); 1389 1390 $where = array( 1391 ); 1392 1393 $where_format = array( 1394 '%d', 1395 ); 1396 1388 $activity = self::get_last_activity( $user_id ); 1389 1390 if ( ! empty( $activity ) ) { 1397 1391 $updated = $wpdb->update( 1398 1392 $table_name, … … 1405 1399 // WHERE 1406 1400 array( 1407 'id' => $ existing[ $user_id ]['activity_id'],1401 'id' => $activity[ $user_id ]['activity_id'], 1408 1402 ), 1409 1403 … … 1418 1412 ) 1419 1413 ); 1414 1415 // add new date to existing activity entry for caching 1416 $activity[ $user_id ]['date_recorded'] = $time; 1417 1420 1418 } else { 1421 1419 $updated = $wpdb->insert( … … 1446 1444 ) 1447 1445 ); 1448 } 1446 1447 // setup activity array for caching 1448 // view the foreach loop in the get_last_activity() method for format 1449 $activity = array(); 1450 $activity[ $user_id ] = array( 1451 'user_id' => $user_id, 1452 'date_recorded' => $time, 1453 'activity_id' => $wpdb->insert_id, 1454 ); 1455 } 1456 1457 // set cache 1458 wp_cache_set( $user_id, $activity, 'bp_last_activity' ); 1449 1459 1450 1460 return $updated; … … 1482 1492 ) 1483 1493 ); 1494 1495 wp_cache_delete( $user_id, 'bp_last_activity' ); 1484 1496 1485 1497 return $deleted;
Note: See TracChangeset
for help on using the changeset viewer.