<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[BuddyPress] [3455] trunk: Use bp_core_current_time() for all timestamps.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>3455</dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2010-11-20 10:46:27 +0000 (Sat, 20 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use bp_core_current_time() for all timestamps. Fixes #2750.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpforumsphp">trunk/bp-forums.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesclassesphp">trunk/bp-messages/bp-messages-classes.php</a></li>
<li><a href="#trunkbpxprofilebpxprofileclassesphp">trunk/bp-xprofile/bp-xprofile-classes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpforumsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums.php (3454 => 3455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums.php        2010-11-20 09:14:13 UTC (rev 3454)
+++ trunk/bp-forums.php        2010-11-20 10:46:27 UTC (rev 3455)
</span><span class="lines">@@ -229,8 +229,8 @@
</span><span class="cx">                 'topic_poster_name' => $bp->loggedin_user->fullname, // accept names
</span><span class="cx">                 'topic_last_poster' => $bp->loggedin_user->id, // accepts ids
</span><span class="cx">                 'topic_last_poster_name' => $bp->loggedin_user->fullname, // accept names
</span><del>-                'topic_start_time' => date( 'Y-m-d H:i:s' ),
-                'topic_time' => date( 'Y-m-d H:i:s' ),
</del><ins>+                'topic_start_time' => bp_core_current_time(),
+                'topic_time' => bp_core_current_time(),
</ins><span class="cx">                 'topic_open' => 1,
</span><span class="cx">                 'topic_tags' => false, // accepts array or comma delim
</span><span class="cx">                 'forum_id' => 0 // accepts ids or slugs
</span><span class="lines">@@ -452,7 +452,7 @@
</span><span class="cx">                 'post_id' => false,
</span><span class="cx">                 'topic_id' => false,
</span><span class="cx">                 'post_text' => '',
</span><del>-                'post_time' => date( 'Y-m-d H:i:s' ),
</del><ins>+                'post_time' => bp_core_current_time(),
</ins><span class="cx">                 'poster_id' => $bp->loggedin_user->id, // accepts ids or names
</span><span class="cx">                 'poster_ip' => $_SERVER['REMOTE_ADDR'],
</span><span class="cx">                 'post_status' => 0, // use bb_delete_post() instead
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (3454 => 3455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2010-11-20 09:14:13 UTC (rev 3454)
+++ trunk/bp-groups.php        2010-11-20 10:46:27 UTC (rev 3455)
</span><span class="lines">@@ -1029,13 +1029,13 @@
</span><span class="cx">                                 bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->groups->current_create_step . '/' );
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => gmdate( "Y-m-d H:i:s" ), 'status' => 'public' ) ) ) {
</del><ins>+                        if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {
</ins><span class="cx">                                 bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' );
</span><span class="cx">                                 bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->groups->current_create_step . '/' );
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         groups_update_groupmeta( $bp->groups->new_group_id, 'total_member_count', 1 );
</span><del>-                        groups_update_groupmeta( $bp->groups->new_group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
</del><ins>+                        groups_update_groupmeta( $bp->groups->new_group_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( 'group-settings' == $bp->groups->current_create_step ) {
</span><span class="lines">@@ -1324,7 +1324,7 @@
</span><span class="cx">         if ( !$group_id )
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><del>-        groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
</del><ins>+        groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx"> }
</span><span class="cx"> add_action( 'groups_joined_group', 'groups_update_last_activity' );
</span><span class="cx"> add_action( 'groups_leave_group', 'groups_update_last_activity' );
</span><span class="lines">@@ -1570,7 +1570,7 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        groups_update_groupmeta( $group->id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
</del><ins>+        groups_update_groupmeta( $group->id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">         do_action( 'groups_settings_updated', $group->id );
</span><span class="cx">
</span><span class="cx">         return true;
</span><span class="lines">@@ -1712,7 +1712,7 @@
</span><span class="cx">         $new_member->inviter_id = 0;
</span><span class="cx">         $new_member->is_admin = 0;
</span><span class="cx">         $new_member->user_title = '';
</span><del>-        $new_member->date_modified = gmdate( "Y-m-d H:i:s" );
</del><ins>+        $new_member->date_modified = bp_core_current_time();
</ins><span class="cx">         $new_member->is_confirmed = 1;
</span><span class="cx">
</span><span class="cx">         if ( !$new_member->save() )
</span><span class="lines">@@ -1733,7 +1733,7 @@
</span><span class="cx">
</span><span class="cx">         // Modify group meta
</span><span class="cx">         groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 );
</span><del>-        groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
</del><ins>+        groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">
</span><span class="cx">         do_action( 'groups_join_group', $group_id, $user_id );
</span><span class="cx">
</span><span class="lines">@@ -1908,7 +1908,7 @@
</span><span class="cx">         /* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */
</span><span class="cx">         require_once( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
</span><span class="cx">
</span><del>-        groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
</del><ins>+        groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">         do_action( 'bp_groups_posted_update', $content, $user_id, $group_id, $activity_id );
</span><span class="cx">
</span><span class="cx">         return $activity_id;
</span><span class="lines">@@ -2159,7 +2159,7 @@
</span><span class="cx">                 'user_id' => false,
</span><span class="cx">                 'group_id' => false,
</span><span class="cx">                 'inviter_id' => $bp->loggedin_user->id,
</span><del>-                'date_modified' => gmdate( "Y-m-d H:i:s" ),
</del><ins>+                'date_modified' => bp_core_current_time(),
</ins><span class="cx">                 'is_confirmed' => 0
</span><span class="cx">         );
</span><span class="cx">
</span><span class="lines">@@ -2215,7 +2215,7 @@
</span><span class="cx">
</span><span class="cx">         /* Modify group meta */
</span><span class="cx">         groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') + 1 );
</span><del>-        groups_update_groupmeta( $group_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
</del><ins>+        groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">
</span><span class="cx">         bp_core_delete_notifications_for_user_by_item_id( $user_id, $group_id, $bp->groups->id, 'group_invite' );
</span><span class="cx">
</span><span class="lines">@@ -2365,7 +2365,7 @@
</span><span class="cx">         $requesting_user->inviter_id = 0;
</span><span class="cx">         $requesting_user->is_admin = 0;
</span><span class="cx">         $requesting_user->user_title = '';
</span><del>-        $requesting_user->date_modified = gmdate( "Y-m-d H:i:s" );
</del><ins>+        $requesting_user->date_modified = bp_core_current_time();
</ins><span class="cx">         $requesting_user->is_confirmed = 0;
</span><span class="cx">         $requesting_user->comments = $_POST['group-request-membership-comments'];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-classes.php (3454 => 3455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-classes.php        2010-11-20 09:14:13 UTC (rev 3454)
+++ trunk/bp-messages/bp-messages-classes.php        2010-11-20 10:46:27 UTC (rev 3455)
</span><span class="lines">@@ -405,7 +405,7 @@
</span><span class="cx">                 // Now deactivate all notices apart from the new one.
</span><span class="cx">                 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) );
</span><span class="cx">
</span><del>-                update_user_meta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) );
</del><ins>+                update_user_meta( $bp->loggedin_user->id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">
</span><span class="cx">                 do_action( 'messages_notice_after_save', $this );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-classes.php (3454 => 3455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-classes.php        2010-11-20 09:14:13 UTC (rev 3454)
+++ trunk/bp-xprofile/bp-xprofile-classes.php        2010-11-20 10:46:27 UTC (rev 3455)
</span><span class="lines">@@ -786,7 +786,7 @@
</span><span class="cx">                 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id );
</span><span class="cx">                 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id );
</span><span class="cx">                 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id );
</span><del>-                $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this->id );
</del><ins>+                $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', bp_core_current_time(), $this->id );
</ins><span class="cx">
</span><span class="cx">                 do_action( 'xprofile_data_before_save', $this );
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>