<!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' =&gt; $bp-&gt;loggedin_user-&gt;fullname, // accept names
</span><span class="cx">                 'topic_last_poster' =&gt; $bp-&gt;loggedin_user-&gt;id, // accepts ids
</span><span class="cx">                 'topic_last_poster_name' =&gt; $bp-&gt;loggedin_user-&gt;fullname, // accept names
</span><del>-                'topic_start_time' =&gt; date( 'Y-m-d H:i:s' ),
-                'topic_time' =&gt; date( 'Y-m-d H:i:s' ),
</del><ins>+                'topic_start_time' =&gt; bp_core_current_time(),
+                'topic_time' =&gt; bp_core_current_time(),
</ins><span class="cx">                 'topic_open' =&gt; 1,
</span><span class="cx">                 'topic_tags' =&gt; false, // accepts array or comma delim
</span><span class="cx">                 'forum_id' =&gt; 0 // accepts ids or slugs
</span><span class="lines">@@ -452,7 +452,7 @@
</span><span class="cx">                 'post_id' =&gt; false,
</span><span class="cx">                 'topic_id' =&gt; false,
</span><span class="cx">                 'post_text' =&gt; '',
</span><del>-                'post_time' =&gt; date( 'Y-m-d H:i:s' ),
</del><ins>+                'post_time' =&gt; bp_core_current_time(),
</ins><span class="cx">                 'poster_id' =&gt; $bp-&gt;loggedin_user-&gt;id, // accepts ids or names
</span><span class="cx">                 'poster_ip' =&gt; $_SERVER['REMOTE_ADDR'],
</span><span class="cx">                 'post_status' =&gt; 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-&gt;root_domain . '/' . $bp-&gt;groups-&gt;slug . '/create/step/' . $bp-&gt;groups-&gt;current_create_step . '/' );
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        if ( !$bp-&gt;groups-&gt;new_group_id = groups_create_group( array( 'group_id' =&gt; $bp-&gt;groups-&gt;new_group_id, 'name' =&gt; $_POST['group-name'], 'description' =&gt; $_POST['group-desc'], 'slug' =&gt; groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ), 'status' =&gt; 'public' ) ) ) {
</del><ins>+                        if ( !$bp-&gt;groups-&gt;new_group_id = groups_create_group( array( 'group_id' =&gt; $bp-&gt;groups-&gt;new_group_id, 'name' =&gt; $_POST['group-name'], 'description' =&gt; $_POST['group-desc'], 'slug' =&gt; groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' =&gt; bp_core_current_time(), 'status' =&gt; '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-&gt;root_domain . '/' . $bp-&gt;groups-&gt;slug . '/create/step/' . $bp-&gt;groups-&gt;current_create_step . '/' );
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         groups_update_groupmeta( $bp-&gt;groups-&gt;new_group_id, 'total_member_count', 1 );
</span><del>-                        groups_update_groupmeta( $bp-&gt;groups-&gt;new_group_id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+                        groups_update_groupmeta( $bp-&gt;groups-&gt;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-&gt;groups-&gt;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( &quot;Y-m-d H:i:s&quot; ) );
</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-&gt;id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+        groups_update_groupmeta( $group-&gt;id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">         do_action( 'groups_settings_updated', $group-&gt;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-&gt;inviter_id = 0;
</span><span class="cx">         $new_member-&gt;is_admin = 0;
</span><span class="cx">         $new_member-&gt;user_title = '';
</span><del>-        $new_member-&gt;date_modified = gmdate( &quot;Y-m-d H:i:s&quot; );
</del><ins>+        $new_member-&gt;date_modified = bp_core_current_time();
</ins><span class="cx">         $new_member-&gt;is_confirmed = 1;
</span><span class="cx"> 
</span><span class="cx">         if ( !$new_member-&gt;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( &quot;Y-m-d H:i:s&quot; ) );
</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( &quot;Y-m-d H:i:s&quot; ) );
</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' =&gt; false,
</span><span class="cx">                 'group_id' =&gt; false,
</span><span class="cx">                 'inviter_id' =&gt; $bp-&gt;loggedin_user-&gt;id,
</span><del>-                'date_modified' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</del><ins>+                'date_modified' =&gt; bp_core_current_time(),
</ins><span class="cx">                 'is_confirmed' =&gt; 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( &quot;Y-m-d H:i:s&quot; ) );
</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-&gt;groups-&gt;id, 'group_invite' );
</span><span class="cx"> 
</span><span class="lines">@@ -2365,7 +2365,7 @@
</span><span class="cx">         $requesting_user-&gt;inviter_id = 0;
</span><span class="cx">         $requesting_user-&gt;is_admin = 0;
</span><span class="cx">         $requesting_user-&gt;user_title = '';
</span><del>-        $requesting_user-&gt;date_modified = gmdate( &quot;Y-m-d H:i:s&quot; );
</del><ins>+        $requesting_user-&gt;date_modified = bp_core_current_time();
</ins><span class="cx">         $requesting_user-&gt;is_confirmed = 0;
</span><span class="cx">         $requesting_user-&gt;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-&gt;query( $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;messages-&gt;table_name_notices} SET is_active = 0 WHERE id != %d&quot;, $id ) );
</span><span class="cx"> 
</span><del>-                update_user_meta( $bp-&gt;loggedin_user-&gt;id, 'last_activity', date( 'Y-m-d H:i:s' ) );
</del><ins>+                update_user_meta( $bp-&gt;loggedin_user-&gt;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-&gt;user_id      = apply_filters( 'xprofile_data_user_id_before_save', $this-&gt;user_id, $this-&gt;id );
</span><span class="cx">                 $this-&gt;field_id     = apply_filters( 'xprofile_data_field_id_before_save', $this-&gt;field_id, $this-&gt;id );
</span><span class="cx">                 $this-&gt;value        = apply_filters( 'xprofile_data_value_before_save', $this-&gt;value, $this-&gt;id );
</span><del>-                $this-&gt;last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this-&gt;id );
</del><ins>+                $this-&gt;last_updated = apply_filters( 'xprofile_data_last_updated_before_save', bp_core_current_time(), $this-&gt;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>