<!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] [3142] branches/1.2: Fixes #2203 and #2497.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>3142</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2010-07-21 19:33:39 +0000 (Wed, 21 Jul 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #2203 and #2497. Introduces bp_core_current_time function as central handler for all time related functions. Removes unused bp_core_format_time in lieu of currently used bp_format_time.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpactivityphp">branches/1.2/bp-activity.php</a></li>
<li><a href="#branches12bpblogsphp">branches/1.2/bp-blogs.php</a></li>
<li><a href="#branches12bpcorebpcoreclassesphp">branches/1.2/bp-core/bp-core-classes.php</a></li>
<li><a href="#branches12bpcorebpcorenotificationsphp">branches/1.2/bp-core/bp-core-notifications.php</a></li>
<li><a href="#branches12bpcorebpcoresignupphp">branches/1.2/bp-core/bp-core-signup.php</a></li>
<li><a href="#branches12bpcorebpcoretemplatetagsphp">branches/1.2/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#branches12bpcorephp">branches/1.2/bp-core.php</a></li>
<li><a href="#branches12bpfriendsbpfriendsclassesphp">branches/1.2/bp-friends/bp-friends-classes.php</a></li>
<li><a href="#branches12bpfriendsphp">branches/1.2/bp-friends.php</a></li>
<li><a href="#branches12bpgroupsbpgroupsclassesphp">branches/1.2/bp-groups/bp-groups-classes.php</a></li>
<li><a href="#branches12bpgroupsphp">branches/1.2/bp-groups.php</a></li>
<li><a href="#branches12bpmessagesbpmessagesclassesphp">branches/1.2/bp-messages/bp-messages-classes.php</a></li>
<li><a href="#branches12bpmessagesphp">branches/1.2/bp-messages.php</a></li>
<li><a href="#branches12bpthemesbpdefault_incajaxphp">branches/1.2/bp-themes/bp-default/_inc/ajax.php</a></li>
<li><a href="#branches12bpxprofilephp">branches/1.2/bp-xprofile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpactivityphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-activity.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-activity.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-activity.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -626,20 +626,20 @@
</span><span class="cx">         global $bp, $wpdb;
</span><span class="cx"> 
</span><span class="cx">         $defaults = array(
</span><del>-                'id' =&gt; false, // Pass an existing activity ID to update an existing entry.
</del><ins>+                'id'                =&gt; false, // Pass an existing activity ID to update an existing entry.
</ins><span class="cx"> 
</span><del>-                'action' =&gt; '', // The activity action - e.g. &quot;Jon Doe posted an update&quot;
-                'content' =&gt; '', // Optional: The content of the activity item e.g. &quot;BuddyPress is awesome guys!&quot;
</del><ins>+                'action'            =&gt; '', // The activity action - e.g. &quot;Jon Doe posted an update&quot;
+                'content'           =&gt; '', // Optional: The content of the activity item e.g. &quot;BuddyPress is awesome guys!&quot;
</ins><span class="cx"> 
</span><del>-                'component' =&gt; false, // The name/ID of the component e.g. groups, profile, mycomponent
-                'type' =&gt; false, // The activity type e.g. activity_update, profile_updated
-                'primary_link' =&gt; '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
</del><ins>+                'component'         =&gt; false, // The name/ID of the component e.g. groups, profile, mycomponent
+                'type'              =&gt; false, // The activity type e.g. activity_update, profile_updated
+                'primary_link'      =&gt; '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
</ins><span class="cx"> 
</span><del>-                'user_id' =&gt; $bp-&gt;loggedin_user-&gt;id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
-                'item_id' =&gt; false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
</del><ins>+                'user_id'           =&gt; $bp-&gt;loggedin_user-&gt;id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
+                'item_id'           =&gt; false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
</ins><span class="cx">                 'secondary_item_id' =&gt; false, // Optional: A second ID used to further filter e.g. a comment_id
</span><del>-                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ), // The GMT time that this activity was recorded
-                'hide_sitewide' =&gt; false // Should this be hidden on the sitewide activity stream?
</del><ins>+                'recorded_time'     =&gt; bp_core_current_time(), // The GMT time that this activity was recorded
+                'hide_sitewide'     =&gt; false // Should this be hidden on the sitewide activity stream?
</ins><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $params = wp_parse_args( $args, $defaults );
</span></span></pre></div>
<a id="branches12bpblogsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-blogs.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-blogs.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-blogs.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -213,7 +213,7 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><del>-                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</del><ins>+                'recorded_time' =&gt; bp_core_current_time(),
</ins><span class="cx">                 'hide_sitewide' =&gt; false
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="lines">@@ -338,7 +338,7 @@
</span><span class="cx"> 
</span><span class="cx">         bp_blogs_update_blogmeta( $recorded_blog-&gt;blog_id, 'name', $name );
</span><span class="cx">         bp_blogs_update_blogmeta( $recorded_blog-&gt;blog_id, 'description', $description );
</span><del>-        bp_blogs_update_blogmeta( $recorded_blog-&gt;blog_id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+        bp_blogs_update_blogmeta( $recorded_blog-&gt;blog_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx"> 
</span><span class="cx">         /* Only record this activity if the blog is public */
</span><span class="cx">         if ( (int)$_POST['blog_public'] &amp;&amp; !$no_activity ) {
</span><span class="lines">@@ -425,7 +425,7 @@
</span><span class="cx">         } else
</span><span class="cx">                 bp_blogs_remove_post( $post_id, $blog_id );
</span><span class="cx"> 
</span><del>-        bp_blogs_update_blogmeta( $blog_id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+        bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx"> 
</span><span class="cx">         do_action( 'bp_blogs_new_blog_post', $post_id, $post, $user_id );
</span><span class="cx"> }
</span><span class="lines">@@ -493,7 +493,7 @@
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 // Update the blogs last active date
</span><del>-                bp_blogs_update_blogmeta( $blog_id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+                bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return $recorded_comment;
</span></span></pre></div>
<a id="branches12bpcorebpcoreclassesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-classes.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-classes.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-core/bp-core-classes.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -424,10 +424,10 @@
</span><span class="cx"> 
</span><span class="cx">                 if ( $this-&gt;id ) {
</span><span class="cx">                         // Update
</span><del>-                        $sql = $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;core-&gt;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&quot;, $this-&gt;item_id, $this-&gt;secondary_item_id, $this-&gt;user_id, $this-&gt;component_name, $this-&gt;component_action, $this-&gt;date_notified, $this-&gt;is_new, $this-&gt;id );
</del><ins>+                        $sql = $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;core-&gt;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&quot;, $this-&gt;item_id, $this-&gt;secondary_item_id, $this-&gt;user_id, $this-&gt;component_name, $this-&gt;component_action, $this-&gt;date_notified, $this-&gt;is_new, $this-&gt;id );
</ins><span class="cx">                 } else {
</span><span class="cx">                         // Save
</span><del>-                        $sql = $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;core-&gt;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 )&quot;, $this-&gt;item_id, $this-&gt;secondary_item_id, $this-&gt;user_id, $this-&gt;component_name, $this-&gt;component_action, $this-&gt;date_notified, $this-&gt;is_new );
</del><ins>+                        $sql = $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;core-&gt;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 )&quot;, $this-&gt;item_id, $this-&gt;secondary_item_id, $this-&gt;user_id, $this-&gt;component_name, $this-&gt;component_action, $this-&gt;date_notified, $this-&gt;is_new );
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( !$result = $wpdb-&gt;query( $sql ) )
</span></span></pre></div>
<a id="branches12bpcorebpcorenotificationsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-notifications.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-notifications.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-core/bp-core-notifications.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="cx">         if ( !$date_notified )
</span><del>-                $date_notified = time();
</del><ins>+                $date_notified = bp_core_current_time();
</ins><span class="cx"> 
</span><span class="cx">         $notification = new BP_Core_Notification;
</span><span class="cx">         $notification-&gt;item_id = $item_id;
</span></span></pre></div>
<a id="branches12bpcorebpcoresignupphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-signup.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-signup.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-core/bp-core-signup.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -494,7 +494,7 @@
</span><span class="cx">         wp_update_user( array( 'ID' =&gt; $user_id, 'user_url' =&gt; bp_core_get_user_domain( $user_id, sanitize_title( $user_login ), $user_login ), 'display_name' =&gt; bp_core_get_user_displayname( $user_id ) ) );
</span><span class="cx"> 
</span><span class="cx">         /* Add a last active entry */
</span><del>-        update_usermeta( $user_id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+        update_usermeta( $user_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx"> 
</span><span class="cx">         /* Set the password on multisite installs */
</span><span class="cx">         if ( bp_core_is_multisite() &amp;&amp; !empty( $user['meta']['password'] ) )
</span><span class="lines">@@ -537,7 +537,7 @@
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         /* Add a last active entry */
</span><del>-        update_usermeta( $user_id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+        update_usermeta( $user_id, 'last_activity', bp_core_current_time() );
</ins><span class="cx"> 
</span><span class="cx">         /* Add the user's fullname to Xprofile */
</span><span class="cx">         if ( function_exists( 'xprofile_set_field_data' ) ) {
</span></span></pre></div>
<a id="branches12bpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-templatetags.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-templatetags.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-core/bp-core-templatetags.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -840,12 +840,25 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_format_time( $time, $just_date = false ) {
</span><del>-        $date = date( get_option('date_format'), $time );
</del><ins>+        if ( !$time )
+                return false;
</ins><span class="cx"> 
</span><del>-        if ( !$just_date ) {
-                $date .= ' ' . __( 'at', 'buddypress' ) . date( ' ' . get_option('time_format'), $time );
-        }
</del><ins>+        // Get GMT offset from root blog
+        $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' );
</ins><span class="cx"> 
</span><ins>+        // Calculate offset time
+        $time_offest = $time + ( $root_blog_offset * 3600 );
+
+        // Current date (January 1, 2010)
+        $date = date( 'F j, Y ', $time_offest );
+
+        // Current time (9:50pm)
+        $time = date( ' g:ia', $time_offest );
+
+        // Should we show the time also?
+        if ( !$just_date )
+                $date .= __( 'at', 'buddypress' ) . date( ' g:iA', $time_offest );
+
</ins><span class="cx">         return apply_filters( 'bp_format_time', $date );
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpcorephp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-core.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -1289,19 +1289,18 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * bp_core_format_time()
</del><ins>+ * bp_core_current_time()
+ *
+ * Get the current GMT time to save into the DB
+ *
+ * @package BuddyPress Core
+ * @since 1.2.6
</ins><span class="cx">  */
</span><del>-function bp_core_format_time( $time, $just_date = false ) {
-        if ( !$time )
-                return false;
</del><ins>+function bp_core_current_time() {
+        // Get current time in MYSQL format
+        $current_time = current_time( 'mysql', true );
</ins><span class="cx"> 
</span><del>-        $date = date( &quot;F j, Y &quot;, $time );
-
-        if ( !$just_date ) {
-                $date .= __('at', 'buddypress') . date( ' g:iA', $time );
-        }
-
-        return $date;
</del><ins>+        return apply_filters( 'bp_core_current_time', $current_time );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1399,16 +1398,16 @@
</span><span class="cx">  * @return str The time since.
</span><span class="cx">  */
</span><span class="cx"> function bp_core_time_since( $older_date, $newer_date = false ) {
</span><ins>+
</ins><span class="cx">         // array of time period chunks
</span><del>-
</del><span class="cx">         $chunks = array(
</span><del>-        array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ),
-        array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ),
-        array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ),
-        array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ),
-        array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ),
-        array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ),
-        array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) )
</del><ins>+                array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ),
+                array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ),
+                array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ),
+                array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ),
+                array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ),
+                array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ),
+                array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) )
</ins><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         if ( !is_numeric( $older_date ) ) {
</span><span class="lines">@@ -1420,7 +1419,7 @@
</span><span class="cx"> 
</span><span class="cx">         /* $newer_date will equal false if we want to know the time elapsed between a date and the current time */
</span><span class="cx">         /* $newer_date will have a value if we want to work out time elapsed between two known dates */
</span><del>-        $newer_date = ( !$newer_date ) ? gmmktime( gmdate( 'H' ), gmdate( 'i' ), gmdate( 's' ), gmdate( 'n' ), gmdate( 'j' ), gmdate( 'Y' ) ) : $newer_date;
</del><ins>+        $newer_date = ( !$newer_date ) ? strtotime( bp_core_current_time() ) : $newer_date;
</ins><span class="cx"> 
</span><span class="cx">         /* Difference in seconds */
</span><span class="cx">         $since = $newer_date - $older_date;
</span><span class="lines">@@ -1488,8 +1487,11 @@
</span><span class="cx">         if ( !is_numeric( $activity ) )
</span><span class="cx">                 $activity = strtotime( $activity );
</span><span class="cx"> 
</span><del>-        if ( '' == $activity || strtotime( gmdate( &quot;Y-m-d H:i:s&quot; ) ) &gt;= strtotime( '+5 minutes', $activity ) )
-                update_usermeta( $bp-&gt;loggedin_user-&gt;id, 'last_activity', gmdate( &quot;Y-m-d H:i:s&quot; ) );
</del><ins>+        // Get current time
+        $current_time = bp_core_current_time();
+
+        if ( '' == $activity || strtotime( $current_time ) &gt;= strtotime( '+5 minutes', $activity ) )
+                update_usermeta( $bp-&gt;loggedin_user-&gt;id, 'last_activity', $current_time );
</ins><span class="cx"> }
</span><span class="cx"> add_action( 'wp_head', 'bp_core_record_activity' );
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpfriendsbpfriendsclassesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-friends/bp-friends-classes.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-friends/bp-friends-classes.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-friends/bp-friends-classes.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -60,10 +60,10 @@
</span><span class="cx"> 
</span><span class="cx">                 if ( $this-&gt;id ) {
</span><span class="cx">                         // Update
</span><del>-                        $result = $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;friends-&gt;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&quot;, $this-&gt;initiator_user_id, $this-&gt;friend_user_id, $this-&gt;is_confirmed, $this-&gt;is_limited, $this-&gt;date_created, $this-&gt;id ) );
</del><ins>+                        $result = $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;friends-&gt;table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s ) WHERE id = %d&quot;, $this-&gt;initiator_user_id, $this-&gt;friend_user_id, $this-&gt;is_confirmed, $this-&gt;is_limited, $this-&gt;date_created, $this-&gt;id ) );
</ins><span class="cx">                 } else {
</span><span class="cx">                         // Save
</span><del>-                        $result = $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;friends-&gt;table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d) )&quot;, $this-&gt;initiator_user_id, $this-&gt;friend_user_id, $this-&gt;is_confirmed, $this-&gt;is_limited, $this-&gt;date_created ) );
</del><ins>+                        $result = $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;friends-&gt;table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, %s )&quot;, $this-&gt;initiator_user_id, $this-&gt;friend_user_id, $this-&gt;is_confirmed, $this-&gt;is_limited, $this-&gt;date_created ) );
</ins><span class="cx">                         $this-&gt;id = $wpdb-&gt;insert_id;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx">         function accept($friendship_id) {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><del>-                 return $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;friends-&gt;table_name} SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d&quot;, time(), $friendship_id, $bp-&gt;loggedin_user-&gt;id ) );
</del><ins>+                 return $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;friends-&gt;table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d&quot;, bp_core_current_time(), $friendship_id, $bp-&gt;loggedin_user-&gt;id ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function reject($friendship_id) {
</span></span></pre></div>
<a id="branches12bpfriendsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-friends.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-friends.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-friends.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -280,7 +280,7 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><del>-                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</del><ins>+                'recorded_time' =&gt; bp_core_current_time(),
</ins><span class="cx">                 'hide_sitewide' =&gt; false
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="lines">@@ -361,7 +361,7 @@
</span><span class="cx">         $friendship-&gt;friend_user_id = $friend_userid;
</span><span class="cx">         $friendship-&gt;is_confirmed = 0;
</span><span class="cx">         $friendship-&gt;is_limited = 0;
</span><del>-        $friendship-&gt;date_created = time();
</del><ins>+        $friendship-&gt;date_created = bp_core_current_time();
</ins><span class="cx"> 
</span><span class="cx">         if ( $force_accept )
</span><span class="cx">                 $friendship-&gt;is_confirmed = 1;
</span></span></pre></div>
<a id="branches12bpgroupsbpgroupsclassesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-groups/bp-groups-classes.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-groups/bp-groups-classes.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-groups/bp-groups-classes.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -770,12 +770,12 @@
</span><span class="cx">         function accept_invite() {
</span><span class="cx">                 $this-&gt;inviter_id = 0;
</span><span class="cx">                 $this-&gt;is_confirmed = 1;
</span><del>-                $this-&gt;date_modified = gmdate( &quot;Y-m-d H:i:s&quot; );
</del><ins>+                $this-&gt;date_modified = bp_core_current_time();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function accept_request() {
</span><span class="cx">                 $this-&gt;is_confirmed = 1;
</span><del>-                $this-&gt;date_modified = gmdate( &quot;Y-m-d H:i:s&quot; );
</del><ins>+                $this-&gt;date_modified = bp_core_current_time();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /* Static Functions */
</span></span></pre></div>
<a id="branches12bpgroupsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-groups.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-groups.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-groups.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -1342,7 +1342,7 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><del>-                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</del><ins>+                'recorded_time' =&gt; bp_core_current_time(),
</ins><span class="cx">                 'hide_sitewide' =&gt; $hide_sitewide
</span><span class="cx">         );
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpmessagesbpmessagesclassesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-messages/bp-messages-classes.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-messages/bp-messages-classes.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-messages/bp-messages-classes.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -243,7 +243,7 @@
</span><span class="cx">         function bp_messages_message( $id = null ) {
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><del>-                $this-&gt;date_sent = time();
</del><ins>+                $this-&gt;date_sent = bp_core_current_time();
</ins><span class="cx">                 $this-&gt;sender_id = $bp-&gt;loggedin_user-&gt;id;
</span><span class="cx"> 
</span><span class="cx">                 if ( $id ) {
</span><span class="lines">@@ -288,7 +288,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // First insert the message into the messages table
</span><del>-                if ( !$wpdb-&gt;query( $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;messages-&gt;table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, FROM_UNIXTIME(%d) )&quot;, $this-&gt;thread_id, $this-&gt;sender_id, $this-&gt;subject, $this-&gt;message, $this-&gt;date_sent ) ) )
</del><ins>+                if ( !$wpdb-&gt;query( $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;messages-&gt;table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, %s )&quot;, $this-&gt;thread_id, $this-&gt;sender_id, $this-&gt;subject, $this-&gt;message, $this-&gt;date_sent ) ) )
</ins><span class="cx">                         return false;
</span><span class="cx"> 
</span><span class="cx">                 if ( $new_thread ) {
</span><span class="lines">@@ -387,7 +387,7 @@
</span><span class="cx">                 do_action( 'messages_notice_before_save', $this );
</span><span class="cx"> 
</span><span class="cx">                 if ( !$this-&gt;id ) {
</span><del>-                        $sql = $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;messages-&gt;table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)&quot;, $this-&gt;subject, $this-&gt;message, $this-&gt;date_sent, $this-&gt;is_active );
</del><ins>+                        $sql = $wpdb-&gt;prepare( &quot;INSERT INTO {$bp-&gt;messages-&gt;table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, %s, %d)&quot;, $this-&gt;subject, $this-&gt;message, $this-&gt;date_sent, $this-&gt;is_active );
</ins><span class="cx">                 } else {
</span><span class="cx">                         $sql = $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;messages-&gt;table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d&quot;, $this-&gt;subject, $this-&gt;message, $this-&gt;is_active, $this-&gt;id );
</span><span class="cx">                 }
</span></span></pre></div>
<a id="branches12bpmessagesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-messages.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-messages.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-messages.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -402,7 +402,7 @@
</span><span class="cx">                 'recipients' =&gt; false, // Can be an array of usernames, user_ids or mixed.
</span><span class="cx">                 'subject' =&gt; false,
</span><span class="cx">                 'content' =&gt; false,
</span><del>-                'date_sent' =&gt; time()
</del><ins>+                'date_sent' =&gt; bp_core_current_time()
</ins><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><span class="lines">@@ -492,7 +492,7 @@
</span><span class="cx">                 $notice = new BP_Messages_Notice;
</span><span class="cx">                 $notice-&gt;subject = $subject;
</span><span class="cx">                 $notice-&gt;message = $message;
</span><del>-                $notice-&gt;date_sent = time();
</del><ins>+                $notice-&gt;date_sent = bp_core_current_time();
</ins><span class="cx">                 $notice-&gt;is_active = 1;
</span><span class="cx">                 $notice-&gt;save(); // send it.
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-themes/bp-default/_inc/ajax.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-themes/bp-default/_inc/ajax.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-themes/bp-default/_inc/ajax.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -187,7 +187,7 @@
</span><span class="cx">                                 &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;div class=&quot;acomment-meta&quot;&gt;
</span><del>-                                        &lt;?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?&gt; &amp;middot; &lt;?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( gmdate( &quot;Y-m-d H:i:s&quot; ) ) ) ?&gt; &amp;middot;
</del><ins>+                                        &lt;?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?&gt; &amp;middot; &lt;?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?&gt; &amp;middot;
</ins><span class="cx">                                         &lt;a class=&quot;acomment-reply&quot; href=&quot;#acomment-&lt;?php bp_activity_id() ?&gt;&quot; id=&quot;acomment-reply-&lt;?php echo attribute_escape( $_POST['form_id'] ) ?&gt;&quot;&gt;&lt;?php _e( 'Reply', 'buddypress' ) ?&gt;&lt;/a&gt;
</span><span class="cx">                                          &amp;middot; &lt;a href=&quot;&lt;?php echo wp_nonce_url( $bp-&gt;root_domain . '/' . $bp-&gt;activity-&gt;slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?&gt;&quot; class=&quot;delete acomment-delete confirm&quot;&gt;&lt;?php _e( 'Delete', 'buddypress' ) ?&gt;&lt;/a&gt;
</span><span class="cx">                                 &lt;/div&gt;
</span><span class="lines">@@ -465,7 +465,7 @@
</span><span class="cx">                                 &lt;?php do_action( 'bp_before_message_meta' ) ?&gt;
</span><span class="cx">                                 &lt;?php echo bp_loggedin_user_avatar( 'type=thumb&amp;width=30&amp;height=30' ); ?&gt;
</span><span class="cx"> 
</span><del>-                                &lt;strong&gt;&lt;a href=&quot;&lt;?php echo $bp-&gt;loggedin_user-&gt;domain ?&gt;&quot;&gt;&lt;?php echo $bp-&gt;loggedin_user-&gt;fullname ?&gt;&lt;/a&gt; &lt;span class=&quot;activity&quot;&gt;&lt;?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( time() ) ) ?&gt;&lt;/span&gt;&lt;/strong&gt;
</del><ins>+                                &lt;strong&gt;&lt;a href=&quot;&lt;?php echo $bp-&gt;loggedin_user-&gt;domain ?&gt;&quot;&gt;&lt;?php echo $bp-&gt;loggedin_user-&gt;fullname ?&gt;&lt;/a&gt; &lt;span class=&quot;activity&quot;&gt;&lt;?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?&gt;&lt;/span&gt;&lt;/strong&gt;
</ins><span class="cx"> 
</span><span class="cx">                                 &lt;?php do_action( 'bp_after_message_meta' ) ?&gt;
</span><span class="cx">                         &lt;/div&gt;
</span></span></pre></div>
<a id="branches12bpxprofilephp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-xprofile.php (3141 => 3142)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-xprofile.php        2010-07-21 19:06:12 UTC (rev 3141)
+++ branches/1.2/bp-xprofile.php        2010-07-21 19:33:39 UTC (rev 3142)
</span><span class="lines">@@ -484,7 +484,7 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><del>-                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</del><ins>+                'recorded_time' =&gt; bp_core_current_time(),
</ins><span class="cx">                 'hide_sitewide' =&gt; false
</span><span class="cx">         );
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>