Changeset 8251 for trunk/bp-activity/bp-activity-filters.php
- Timestamp:
- 04/08/2014 06:55:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-filters.php
r8219 r8251 430 430 $bp = buddypress(); 431 431 432 if ( ! empty( $bp->activity-> new_update_id ) && $bp->activity->new_update_id == bp_get_activity_id() ) {432 if ( ! empty( $bp->activity->last_recorded ) && $bp->activity->last_recorded == bp_get_activity_date_recorded() ) { 433 433 $classes .= ' new-update'; 434 434 } … … 439 439 440 440 /** 441 * Check if Activity Heartbeat feature i on to add a timestamp class. 442 * 443 * @since BuddyPress (2.0.0) 444 * 445 * @param string $classes 446 * @return string $classes 447 */ 448 function bp_activity_timestamp_class( $classes = '' ) { 449 450 if ( ! bp_activity_do_heartbeat() ) { 451 return $classes; 452 } 453 454 $activity_date = bp_get_activity_date_recorded(); 455 456 if ( empty( $activity_date ) ) { 457 return $classes; 458 } 459 460 $classes .= ' date-recorded-' . strtotime( $activity_date ); 461 462 return $classes; 463 } 464 add_filter( 'bp_get_activity_css_class', 'bp_activity_timestamp_class', 9, 1 ); 465 466 /** 441 467 * Use WordPress Heartbeat API to check for latest activity update. 442 468 * … … 444 470 * 445 471 * @uses bp_activity_get_last_updated() to get the recorded date of the last activity 446 472 * 447 473 * @param array $response 448 474 * @param array $data … … 452 478 $bp = buddypress(); 453 479 454 if ( empty( $data['bp_activity_last_ id'] ) ) {480 if ( empty( $data['bp_activity_last_recorded'] ) ) { 455 481 return $response; 456 482 } … … 460 486 $activity_latest_args = bp_parse_args( 461 487 bp_ajax_querystring( 'activity' ), 462 array( ' offset' => absint( $data['bp_activity_last_id'] ) + 1),488 array( 'since' => date( 'Y-m-d H:i:s', $data['bp_activity_last_recorded'] ) ), 463 489 'activity_latest_args' 464 490 ); 465 491 466 492 $newest_activities = array(); 467 $last_activity_ id= 0;493 $last_activity_recorded = 0; 468 494 469 495 // Temporarly add a just-posted class for new activity items … … 475 501 bp_the_activity(); 476 502 477 if ( $last_activity_id < bp_get_activity_id() ) { 478 $last_activity_id = bp_get_activity_id(); 503 $atime = strtotime( bp_get_activity_date_recorded() ); 504 if ( $last_activity_recorded < $atime ) { 505 $last_activity_recorded = $atime; 479 506 } 480 507 … … 483 510 } 484 511 485 $newest_activities['activities'] = ob_get_contents();486 $newest_activities['last_ id'] = $last_activity_id;512 $newest_activities['activities'] = ob_get_contents(); 513 $newest_activities['last_recorded'] = $last_activity_recorded; 487 514 ob_end_clean(); 488 515 … … 490 517 remove_filter( 'bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1 ); 491 518 492 if ( ! empty( $newest_activities['last_ id'] ) ) {519 if ( ! empty( $newest_activities['last_recorded'] ) ) { 493 520 $response['bp_activity_newest_activities'] = $newest_activities; 494 521 }
Note: See TracChangeset
for help on using the changeset viewer.