Changeset 3142
- Timestamp:
- 07/21/2010 07:33:39 PM (14 years ago)
- Location:
- branches/1.2
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-activity.php
r3111 r3142 627 627 628 628 $defaults = array( 629 'id' => false, // Pass an existing activity ID to update an existing entry.630 631 'action' => '', // The activity action - e.g. "Jon Doe posted an update"632 'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"633 634 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent635 'type' => false, // The activity type e.g. activity_update, profile_updated636 'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)637 638 'user_id' => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.639 'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id629 'id' => false, // Pass an existing activity ID to update an existing entry. 630 631 'action' => '', // The activity action - e.g. "Jon Doe posted an update" 632 'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!" 633 634 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent 635 'type' => false, // The activity type e.g. activity_update, profile_updated 636 'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink) 637 638 'user_id' => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user. 639 'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id 640 640 'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id 641 'recorded_time' => gmdate( "Y-m-d H:i:s"), // The GMT time that this activity was recorded642 'hide_sitewide' => false // Should this be hidden on the sitewide activity stream?641 'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded 642 'hide_sitewide' => false // Should this be hidden on the sitewide activity stream? 643 643 ); 644 644 -
branches/1.2/bp-blogs.php
r3132 r3142 214 214 'item_id' => false, 215 215 'secondary_item_id' => false, 216 'recorded_time' => gmdate( "Y-m-d H:i:s"),216 'recorded_time' => bp_core_current_time(), 217 217 'hide_sitewide' => false 218 218 ); … … 339 339 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'name', $name ); 340 340 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'description', $description ); 341 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', gmdate( "Y-m-d H:i:s") );341 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', bp_core_current_time() ); 342 342 343 343 /* Only record this activity if the blog is public */ … … 426 426 bp_blogs_remove_post( $post_id, $blog_id ); 427 427 428 bp_blogs_update_blogmeta( $blog_id, 'last_activity', gmdate( "Y-m-d H:i:s") );428 bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() ); 429 429 430 430 do_action( 'bp_blogs_new_blog_post', $post_id, $post, $user_id ); … … 494 494 495 495 // Update the blogs last active date 496 bp_blogs_update_blogmeta( $blog_id, 'last_activity', gmdate( "Y-m-d H:i:s") );496 bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() ); 497 497 } 498 498 -
branches/1.2/bp-core.php
r3133 r3142 1290 1290 1291 1291 /** 1292 * bp_core_format_time() 1293 */ 1294 function bp_core_format_time( $time, $just_date = false ) { 1295 if ( !$time ) 1296 return false; 1297 1298 $date = date( "F j, Y ", $time ); 1299 1300 if ( !$just_date ) { 1301 $date .= __('at', 'buddypress') . date( ' g:iA', $time ); 1302 } 1303 1304 return $date; 1292 * bp_core_current_time() 1293 * 1294 * Get the current GMT time to save into the DB 1295 * 1296 * @package BuddyPress Core 1297 * @since 1.2.6 1298 */ 1299 function bp_core_current_time() { 1300 // Get current time in MYSQL format 1301 $current_time = current_time( 'mysql', true ); 1302 1303 return apply_filters( 'bp_core_current_time', $current_time ); 1305 1304 } 1306 1305 … … 1400 1399 */ 1401 1400 function bp_core_time_since( $older_date, $newer_date = false ) { 1401 1402 1402 // array of time period chunks 1403 1404 1403 $chunks = array( 1405 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ),1406 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ),1407 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ),1408 array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ),1409 array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ),1410 array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ),1411 array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) )1404 array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ), 1405 array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ), 1406 array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ), 1407 array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ), 1408 array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ), 1409 array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ), 1410 array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) ) 1412 1411 ); 1413 1412 … … 1421 1420 /* $newer_date will equal false if we want to know the time elapsed between a date and the current time */ 1422 1421 /* $newer_date will have a value if we want to work out time elapsed between two known dates */ 1423 $newer_date = ( !$newer_date ) ? gmmktime( gmdate( 'H' ), gmdate( 'i' ), gmdate( 's' ), gmdate( 'n' ), gmdate( 'j' ), gmdate( 'Y') ) : $newer_date;1422 $newer_date = ( !$newer_date ) ? strtotime( bp_core_current_time() ) : $newer_date; 1424 1423 1425 1424 /* Difference in seconds */ … … 1489 1488 $activity = strtotime( $activity ); 1490 1489 1491 if ( '' == $activity || strtotime( gmdate( "Y-m-d H:i:s" ) ) >= strtotime( '+5 minutes', $activity ) ) 1492 update_usermeta( $bp->loggedin_user->id, 'last_activity', gmdate( "Y-m-d H:i:s" ) ); 1490 // Get current time 1491 $current_time = bp_core_current_time(); 1492 1493 if ( '' == $activity || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) ) 1494 update_usermeta( $bp->loggedin_user->id, 'last_activity', $current_time ); 1493 1495 } 1494 1496 add_action( 'wp_head', 'bp_core_record_activity' ); -
branches/1.2/bp-core/bp-core-classes.php
r2924 r3142 425 425 if ( $this->id ) { 426 426 // Update 427 $sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );427 $sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = %s, is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id ); 428 428 } else { 429 429 // Save 430 $sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );430 $sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, %s, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new ); 431 431 } 432 432 -
branches/1.2/bp-core/bp-core-notifications.php
r2576 r3142 5 5 6 6 if ( !$date_notified ) 7 $date_notified = time();7 $date_notified = bp_core_current_time(); 8 8 9 9 $notification = new BP_Core_Notification; -
branches/1.2/bp-core/bp-core-signup.php
r3038 r3142 495 495 496 496 /* Add a last active entry */ 497 update_usermeta( $user_id, 'last_activity', gmdate( "Y-m-d H:i:s") );497 update_usermeta( $user_id, 'last_activity', bp_core_current_time() ); 498 498 499 499 /* Set the password on multisite installs */ … … 538 538 539 539 /* Add a last active entry */ 540 update_usermeta( $user_id, 'last_activity', gmdate( "Y-m-d H:i:s") );540 update_usermeta( $user_id, 'last_activity', bp_core_current_time() ); 541 541 542 542 /* Add the user's fullname to Xprofile */ -
branches/1.2/bp-core/bp-core-templatetags.php
r3111 r3142 841 841 842 842 function bp_format_time( $time, $just_date = false ) { 843 $date = date( get_option('date_format'), $time ); 844 845 if ( !$just_date ) { 846 $date .= ' ' . __( 'at', 'buddypress' ) . date( ' ' . get_option('time_format'), $time ); 847 } 843 if ( !$time ) 844 return false; 845 846 // Get GMT offset from root blog 847 $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' ); 848 849 // Calculate offset time 850 $time_offest = $time + ( $root_blog_offset * 3600 ); 851 852 // Current date (January 1, 2010) 853 $date = date( 'F j, Y ', $time_offest ); 854 855 // Current time (9:50pm) 856 $time = date( ' g:ia', $time_offest ); 857 858 // Should we show the time also? 859 if ( !$just_date ) 860 $date .= __( 'at', 'buddypress' ) . date( ' g:iA', $time_offest ); 848 861 849 862 return apply_filters( 'bp_format_time', $date ); -
branches/1.2/bp-friends.php
r3111 r3142 281 281 'item_id' => false, 282 282 'secondary_item_id' => false, 283 'recorded_time' => gmdate( "Y-m-d H:i:s"),283 'recorded_time' => bp_core_current_time(), 284 284 'hide_sitewide' => false 285 285 ); … … 362 362 $friendship->is_confirmed = 0; 363 363 $friendship->is_limited = 0; 364 $friendship->date_created = time();364 $friendship->date_created = bp_core_current_time(); 365 365 366 366 if ( $force_accept ) -
branches/1.2/bp-friends/bp-friends-classes.php
r3044 r3142 61 61 if ( $this->id ) { 62 62 // Update 63 $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = FROM_UNIXTIME(%d)) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );63 $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) ); 64 64 } else { 65 65 // Save 66 $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d))", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );66 $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, %s )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) ); 67 67 $this->id = $wpdb->insert_id; 68 68 } … … 203 203 global $wpdb, $bp; 204 204 205 return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d",time(), $friendship_id, $bp->loggedin_user->id ) );205 return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, $bp->loggedin_user->id ) ); 206 206 } 207 207 -
branches/1.2/bp-groups.php
r3129 r3142 1343 1343 'item_id' => false, 1344 1344 'secondary_item_id' => false, 1345 'recorded_time' => gmdate( "Y-m-d H:i:s"),1345 'recorded_time' => bp_core_current_time(), 1346 1346 'hide_sitewide' => $hide_sitewide 1347 1347 ); -
branches/1.2/bp-groups/bp-groups-classes.php
r3113 r3142 771 771 $this->inviter_id = 0; 772 772 $this->is_confirmed = 1; 773 $this->date_modified = gmdate( "Y-m-d H:i:s");773 $this->date_modified = bp_core_current_time(); 774 774 } 775 775 776 776 function accept_request() { 777 777 $this->is_confirmed = 1; 778 $this->date_modified = gmdate( "Y-m-d H:i:s");778 $this->date_modified = bp_core_current_time(); 779 779 } 780 780 -
branches/1.2/bp-messages.php
r3140 r3142 403 403 'subject' => false, 404 404 'content' => false, 405 'date_sent' => time()405 'date_sent' => bp_core_current_time() 406 406 ); 407 407 … … 493 493 $notice->subject = $subject; 494 494 $notice->message = $message; 495 $notice->date_sent = time();495 $notice->date_sent = bp_core_current_time(); 496 496 $notice->is_active = 1; 497 497 $notice->save(); // send it. -
branches/1.2/bp-messages/bp-messages-classes.php
r2576 r3142 244 244 global $bp; 245 245 246 $this->date_sent = time();246 $this->date_sent = bp_core_current_time(); 247 247 $this->sender_id = $bp->loggedin_user->id; 248 248 … … 289 289 290 290 // First insert the message into the messages table 291 if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, FROM_UNIXTIME(%d))", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) )291 if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, %s )", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) ) 292 292 return false; 293 293 … … 388 388 389 389 if ( !$this->id ) { 390 $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );390 $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, %s, %d)", $this->subject, $this->message, $this->date_sent, $this->is_active ); 391 391 } else { 392 392 $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id ); -
branches/1.2/bp-themes/bp-default/_inc/ajax.php
r2733 r3142 188 188 189 189 <div class="acomment-meta"> 190 <?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> · <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( gmdate( "Y-m-d H:i:s") ) ) ?> ·190 <?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> · <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> · 191 191 <a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo attribute_escape( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a> 192 192 · <a href="<?php echo wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm"><?php _e( 'Delete', 'buddypress' ) ?></a> … … 466 466 <?php echo bp_loggedin_user_avatar( 'type=thumb&width=30&height=30' ); ?> 467 467 468 <strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( time() ) ) ?></span></strong>468 <strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?></span></strong> 469 469 470 470 <?php do_action( 'bp_after_message_meta' ) ?> -
branches/1.2/bp-xprofile.php
r3058 r3142 485 485 'item_id' => false, 486 486 'secondary_item_id' => false, 487 'recorded_time' => gmdate( "Y-m-d H:i:s"),487 'recorded_time' => bp_core_current_time(), 488 488 'hide_sitewide' => false 489 489 );
Note: See TracChangeset
for help on using the changeset viewer.