<!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] [2331] trunk: Restoring update support to activity items.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2331</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-18 11:50:33 +0000 (Mon, 18 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Restoring update support to activity items.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityclassesphp">trunk/bp-activity/bp-activity-classes.php</a></li>
<li><a href="#trunkbpactivityphp">trunk/bp-activity.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-classes.php (2330 => 2331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2010-01-18 11:48:13 UTC (rev 2330)
+++ trunk/bp-activity/bp-activity-classes.php        2010-01-18 11:50:33 UTC (rev 2331)
</span><span class="lines">@@ -47,20 +47,6 @@
</span><span class="cx">                 if ( !$this-&gt;component_name || !$this-&gt;component_action )
</span><span class="cx">                         return false;
</span><span class="cx"> 
</span><del>-                /***
-                 * Before v1.1 of BuddyPress, activity content was calculated at a later point. This is no longer the
-                 * case, to to be backwards compatible we need to fetch content here to continue.
-                 */
-                if ( empty( $this-&gt;content ) || !$this-&gt;content ) {
-                        if ( function_exists( $bp-&gt;{$this-&gt;component_name}-&gt;format_activity_function ) ) {
-                                if ( !$fetched_content = call_user_func( $bp-&gt;{$this-&gt;component_name}-&gt;format_activity_function, $this-&gt;item_id, $this-&gt;user_id, $this-&gt;component_action, $this-&gt;secondary_item_id, $this-&gt;for_secondary_user ) )
-                                        return false;
-
-                                $this-&gt;content = $fetched_content['content'];
-                                $this-&gt;primary_link = $fetched_content['primary_link'];
-                        }
-                }
-
</del><span class="cx">                 if ( !$this-&gt;primary_link )
</span><span class="cx">                         $this-&gt;primary_link = $bp-&gt;loggedin_user-&gt;domain;
</span><span class="cx"> 
</span><span class="lines">@@ -96,6 +82,8 @@
</span><span class="cx">                 /* Fetch the activity IDs so we can delete any comments for this activity item */
</span><span class="cx">                 $activity_ids = $wpdb-&gt;get_col( $wpdb-&gt;prepare( &quot;SELECT id FROM {$bp-&gt;activity-&gt;table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}&quot;, $item_id, $component_name ) );
</span><span class="cx"> 
</span><ins>+                error_log( $wpdb-&gt;prepare( &quot;DELETE FROM {$bp-&gt;activity-&gt;table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}&quot;, $item_id, $component_name ) );
+
</ins><span class="cx">                 if ( !$wpdb-&gt;query( $wpdb-&gt;prepare( &quot;DELETE FROM {$bp-&gt;activity-&gt;table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}&quot;, $item_id, $component_name ) ) )
</span><span class="cx">                         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (2330 => 2331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2010-01-18 11:48:13 UTC (rev 2330)
+++ trunk/bp-activity.php        2010-01-18 11:50:33 UTC (rev 2331)
</span><span class="lines">@@ -429,6 +429,8 @@
</span><span class="cx">         global $bp, $wpdb;
</span><span class="cx"> 
</span><span class="cx">         $defaults = array(
</span><ins>+                'id' =&gt; false, // Pass an existing activity ID to update an existing entry.
+
</ins><span class="cx">                 'content' =&gt; false, // The content of the activity item
</span><span class="cx">                 'primary_link' =&gt; false, // The primary URL for this item in RSS feeds
</span><span class="cx">                 'component_name' =&gt; false, // The name/ID of the component e.g. groups, profile, mycomponent
</span><span class="lines">@@ -448,8 +450,7 @@
</span><span class="cx">         if ( $content )
</span><span class="cx">                 $content = bp_activity_add_timesince_placeholder( $content );
</span><span class="cx"> 
</span><del>-        /* Pass certain values so we can update an activity item if it already exists */
-        $activity = new BP_Activity_Activity();
</del><ins>+        $activity = new BP_Activity_Activity( $id );
</ins><span class="cx"> 
</span><span class="cx">         $activity-&gt;user_id = $user_id;
</span><span class="cx">         $activity-&gt;content = $content;
</span></span></pre>
</div>
</div>

</body>
</html>