<!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] [2471] trunk:
Merged activity delete functions for better usability.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2471</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-28 18:01:42 +0000 (Thu, 28 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged activity delete functions for better usability. Fixed some issues with the group extension API and plugin compatibility in 1.2</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityclassesphp">trunk/bp-activity/bp-activity-classes.php</a></li>
<li><a href="#trunkbpactivitybpactivitytemplatetagsphp">trunk/bp-activity/bp-activity-templatetags.php</a></li>
<li><a href="#trunkbpactivityphp">trunk/bp-activity.php</a></li>
<li><a href="#trunkbpgroupsbpgroupstemplatetagsphp">trunk/bp-groups/bp-groups-templatetags.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpthemesbpdefault_incajaxphp">trunk/bp-themes/bp-default/_inc/ajax.php</a></li>
<li><a href="#trunkbpthemesbpdefaultactivitypostformphp">trunk/bp-themes/bp-default/activity/post-form.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 (2470 => 2471)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2010-01-27 14:11:11 UTC (rev 2470)
+++ trunk/bp-activity/bp-activity-classes.php        2010-01-28 18:01:42 UTC (rev 2471)
</span><span class="lines">@@ -70,153 +70,17 @@
</span><span class="cx">
</span><span class="cx">         /* Static Functions */
</span><span class="cx">
</span><del>-        function delete( $item_id, $component, $type, $user_id = false, $secondary_item_id = false ) {
-                global $wpdb, $bp;
-
-                if ( $secondary_item_id )
-                        $secondary_sql = $wpdb->prepare( "AND secondary_item_id = %s", $secondary_item_id );
-
-                if ( $type )
-                        $type_sql = $wpdb->prepare( "AND type = %s", $type );
-
-                if ( $user_id )
-                        $user_sql = $wpdb->prepare( "AND user_id = %d", $user_id );
-
-                /* Fetch the activity IDs so we can delete any comments for this activity item */
-                $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component = %s {$type_sql} {$user_sql}", $item_id, $component ) );
-
-                error_log( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component = %s {$type_sql} {$user_sql}", $item_id, $component ) );
-
-                if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component = %s {$type_sql} {$user_sql}", $item_id, $component ) ) )
-                        return false;
-
-                if ( $activity_ids ) {
-                        BP_Activity_Activity::delete_activity_item_comments( $activity_ids );
-                        BP_Activity_Activity::delete_activity_meta_entries( $activity_ids );
-
-                        return $activity_ids;
-                }
-
-                return true;
-        }
-
-        function delete_by_item_id( $item_id, $component, $type, $user_id = false, $secondary_item_id = false ) {
-                return BP_Activity_Activity::delete( $item_id, $component, $type, $user_id, $secondary_item_id );
-        }
-
-        function delete_by_activity_id( $activity_id ) {
-                global $bp, $wpdb;
-
-                if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE id = %d", $activity_id ) ) )
-                        return false;
-
-                /* Delete the comments for this activity ID */
-                BP_Activity_Activity::delete_activity_item_comments( $activity_id );
-                BP_Activity_Activity::delete_activity_meta_entries( $activity_id );
-
-                return true;
-        }
-
-        function delete_by_content( $user_id, $content, $component, $type ) {
-                global $bp, $wpdb;
-
-                /* Fetch the activity ID so we can delete any comments for this activity item */
-                $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component = %s AND type = %s", $user_id, $content, $component, $type ) );
-
-                if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component = %s AND type = %s", $user_id, $content, $component, $type ) ) )
-                        return false;
-
-                if ( $activity_ids ) {
-                        BP_Activity_Activity::delete_activity_item_comments( $activity_ids );
-                        BP_Activity_Activity::delete_activity_meta_entries( $activity_ids );
-
-                        return $activity_ids;
-                }
-
-                return true;
-        }
-
-        function delete_for_user_by_component( $user_id, $component ) {
-                global $bp, $wpdb;
-
-                /* Fetch the activity IDs so we can delete any comments for this activity item */
-                $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND component = %s", $user_id, $component ) );
-
-                if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND component = %s", $user_id, $component ) ) )
-                        return false;
-
-                if ( $activity_ids ) {
-                        BP_Activity_Activity::delete_activity_item_comments( $activity_ids );
-                        BP_Activity_Activity::delete_activity_meta_entries( $activity_ids );
-
-                        return $activity_ids;
-                }
-
-                return true;
-        }
-
-        function delete_for_user( $user_id ) {
-                global $wpdb, $bp;
-
-                /* Fetch the activity IDs so we can delete any comments for this activity item */
-                $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d", $user_id ) );
-
-                if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d", $user_id ) ) )
-                        return false;
-
-                if ( $activity_ids ) {
-                        BP_Activity_Activity::delete_activity_item_comments( $activity_ids );
-                        BP_Activity_Activity::delete_activity_meta_entries( $activity_ids );
-
-                        return $activity_ids;
-                }
-        }
-
-        function delete_activity_item_comments( $activity_ids ) {
-                global $bp, $wpdb;
-
-                if ( is_array($activity_ids) )
-                        $activity_ids = implode( ',', $activity_ids );
-
-                $activity_ids = $wpdb->escape( $activity_ids );
-
-                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ) );
-        }
-
-        function delete_activity_meta_entries( $activity_ids ) {
-                global $bp, $wpdb;
-
-                if ( is_array($activity_ids) )
-                        $activity_ids = implode( ',', $activity_ids );
-
-                $activity_ids = $wpdb->escape( $activity_ids );
-
-                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" ) );
-        }
-
</del><span class="cx">         function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false ) {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 /* Select conditions */
</span><span class="cx">                 $select_sql = "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
</span><span class="cx">
</span><del>-                if ( function_exists( 'xprofile_install' ) )
-                        $select_sql .= ", pd.value as user_fullname";
</del><ins>+                $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";
</ins><span class="cx">
</span><del>-                $from_sql = " FROM {$bp->activity->table_name} a, {$wpdb->users} u";
-
-                if ( function_exists( 'xprofile_install' ) )
-                        $from_sql .= ", {$bp->profile->table_name_data} pd";
-
</del><span class="cx">                 /* Where conditions */
</span><span class="cx">                 $where_conditions = array();
</span><del>-                $where_conditions['user_join'] = "a.user_id = u.ID";
</del><span class="cx">
</span><del>-                if ( function_exists( 'xprofile_install' ) ) {
-                        $where_conditions['xprofile_join'] = "a.user_id = pd.user_id";
-                        $where_conditions['xprofile_filter'] = "pd.field_id = 1";
-                }
-
</del><span class="cx">                 if ( $per_page && $page )
</span><span class="cx">                         $pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
</span><span class="cx">
</span><span class="lines">@@ -252,6 +116,30 @@
</span><span class="cx">
</span><span class="cx">                 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(a.id) {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}" ) );
</span><span class="cx">
</span><ins>+                /* Get the fullnames of users so we don't have to query in the loop */
+                if ( function_exists( 'xprofile_install' ) && $activities ) {
+                        foreach ( (array)$activities as $activity ) {
+                                if ( (int)$activity->user_id )
+                                        $activity_user_ids[] = $activity->user_id;
+                        }
+
+                        $activity_user_ids = implode( ',', (array)$activity_user_ids );
+                        if ( !empty( $activity_user_ids ) ) {
+                                if ( $names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) ) {
+                                        foreach ( (array)$names as $name )
+                                                $tmp_names[$name->user_id] = $name->user_fullname;
+
+                                        foreach ( (array)$activities as $i => $activity ) {
+                                                if ( !empty( $tmp_names[$activity->user_id] ) )
+                                                        $activities[$i]->user_fullname = $tmp_names[$activity->user_id];
+                                        }
+
+                                        unset( $names );
+                                        unset( $tmp_names );
+                                }
+                        }
+                }
+
</ins><span class="cx">                 if ( $activities && $display_comments )
</span><span class="cx">                         $activities = BP_Activity_Activity::append_comments( &$activities );
</span><span class="cx">
</span><span class="lines">@@ -294,7 +182,7 @@
</span><span class="cx">                 return array( 'activities' => $activities, 'total' => (int)$total_activities );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_id( $user_id, $component, $type, $item_id, $secondary_item_id ) {
</del><ins>+        function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content ) {
</ins><span class="cx">                 global $bp, $wpdb;
</span><span class="cx">
</span><span class="cx">                 $where_args = false;
</span><span class="lines">@@ -314,6 +202,12 @@
</span><span class="cx">                 if ( !empty( $secondary_item_id ) )
</span><span class="cx">                         $where_args[] = $wpdb->prepare( "secondary_item_id = %s", $secondary_item_id );
</span><span class="cx">
</span><ins>+                if ( !empty( $action ) )
+                        $where_args[] = $wpdb->prepare( "action = %s", bp_activity_add_timesince_placeholder( $action ) );
+
+                if ( !empty( $content ) )
+                        $where_args[] = $wpdb->prepare( "content = %s", $content );
+
</ins><span class="cx">                 if ( !empty( $where_args ) )
</span><span class="cx">                         $where_sql = 'WHERE ' . join( ' AND ', $where_args );
</span><span class="cx">                 else
</span><span class="lines">@@ -322,6 +216,103 @@
</span><span class="cx">                 return $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function delete( $args ) {
+                global $wpdb, $bp;
+
+                extract( $args );
+
+                $defaults = array(
+                        'id' => false,
+                        'action' => false,
+                        'content' => false,
+                        'component' => false,
+                        'type' => false,
+                        'primary_link' => false,
+                        'user_id' => false,
+                        'item_id' => false,
+                        'secondary_item_id' => false,
+                        'recorded_time' => false,
+                        'hide_sitewide' => false
+                );
+
+                $where_args = false;
+
+                if ( !empty( $id ) )
+                        $where_args[] = $wpdb->prepare( "id = %d", $id );
+
+                if ( !empty( $user_id ) )
+                        $where_args[] = $wpdb->prepare( "user_id = %d", $user_id );
+
+                if ( !empty( $action ) )
+                        $where_args[] = $wpdb->prepare( "action = %s", bp_activity_add_timesince_placeholder( $action ) );
+
+                if ( !empty( $content ) )
+                        $where_args[] = $wpdb->prepare( "content = %s", $content );
+
+                if ( !empty( $component ) )
+                        $where_args[] = $wpdb->prepare( "component = %s", $component );
+
+                if ( !empty( $type ) )
+                        $where_args[] = $wpdb->prepare( "type = %s", $type );
+
+                if ( !empty( $primary_link ) )
+                        $where_args[] = $wpdb->prepare( "primary_link = %s", $primary_link );
+
+                if ( !empty( $item_id ) )
+                        $where_args[] = $wpdb->prepare( "item_id = %s", $item_id );
+
+                if ( !empty( $secondary_item_id ) )
+                        $where_args[] = $wpdb->prepare( "secondary_item_id = %s", $secondary_item_id );
+
+                if ( !empty( $recorded_time ) )
+                        $where_args[] = $wpdb->prepare( "recorded_time = %s", $recorded_time );
+
+                if ( !empty( $hide_sitewide ) )
+                        $where_args[] = $wpdb->prepare( "recorded_time = %d", $hide_sitewide );
+
+                if ( !empty( $where_args ) )
+                        $where_sql = 'WHERE ' . join( ' AND ', $where_args );
+                else
+                        return false;
+
+                /* Fetch the activity IDs so we can delete any comments for this activity item */
+                $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ) );
+
+                if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} {$where_sql}" ) ) )
+                        return false;
+
+                if ( $activity_ids ) {
+                        BP_Activity_Activity::delete_activity_item_comments( $activity_ids );
+                        BP_Activity_Activity::delete_activity_meta_entries( $activity_ids );
+
+                        return $activity_ids;
+                }
+
+                return $activity_ids;
+        }
+
+        function delete_activity_item_comments( $activity_ids ) {
+                global $bp, $wpdb;
+
+                if ( is_array($activity_ids) )
+                        $activity_ids = implode( ',', $activity_ids );
+
+                $activity_ids = $wpdb->escape( $activity_ids );
+
+                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ) );
+        }
+
+        function delete_activity_meta_entries( $activity_ids ) {
+                global $bp, $wpdb;
+
+                if ( is_array($activity_ids) )
+                        $activity_ids = implode( ',', $activity_ids );
+
+                $activity_ids = $wpdb->escape( $activity_ids );
+
+                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" ) );
+        }
+
</ins><span class="cx">         function append_comments( $activities ) {
</span><span class="cx">                 global $bp, $wpdb;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpactivitybpactivitytemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-templatetags.php (2470 => 2471)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-templatetags.php        2010-01-27 14:11:11 UTC (rev 2470)
+++ trunk/bp-activity/bp-activity-templatetags.php        2010-01-28 18:01:42 UTC (rev 2471)
</span><span class="lines">@@ -297,7 +297,13 @@
</span><span class="cx"> }
</span><span class="cx">         function bp_get_activity_user_link() {
</span><span class="cx">                 global $activities_template;
</span><del>-                return apply_filters( 'bp_get_activity_user_link', bp_core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login ) );
</del><ins>+
+                if ( empty( $activities_template->activity->user_id ) )
+                        $link = $activities_template->activity->primary_link;
+                else
+                        $link = bp_core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login );
+
+                return apply_filters( 'bp_get_activity_user_link', $link );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> function bp_activity_avatar( $args = '' ) {
</span><span class="lines">@@ -445,13 +451,18 @@
</span><span class="cx">                 if ( !$parent_activity )
</span><span class="cx">                         return false;
</span><span class="cx">
</span><ins>+                if ( empty( $parent_activity->content ) )
+                        $content = $parent_activity->action;
+                else
+                        $content = $parent_activity->action . $parent_activity->content;
+
</ins><span class="cx">                 /* Remove the time since content */
</span><del>-                $parent_activity->content = str_replace( '<span class="time-since">%s</span>', '', $parent_activity->content );
</del><ins>+                $content = str_replace( '<span class="time-since">%s</span>', '', $content );
</ins><span class="cx">
</span><span class="cx">                 /* Remove images */
</span><del>-                $parent_activity->content = preg_replace( '/<img[^>]*>/Ui', '', $parent_activity->content );
</del><ins>+                $content = preg_replace( '/<img[^>]*>/Ui', '', $content );
</ins><span class="cx">
</span><del>-                return apply_filters( 'bp_get_activity_parent_content', $parent_activity->content );
</del><ins>+                return apply_filters( 'bp_get_activity_parent_content', $content );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> function bp_activity_is_favorite() {
</span></span></pre></div>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (2470 => 2471)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2010-01-27 14:11:11 UTC (rev 2470)
+++ trunk/bp-activity.php        2010-01-28 18:01:42 UTC (rev 2471)
</span><span class="lines">@@ -610,21 +610,20 @@
</span><span class="cx">                 'component' => false,
</span><span class="cx">                 'type' => false,
</span><span class="cx">                 'item_id' => false,
</span><del>-                'secondary_item_id' => false
</del><ins>+                'secondary_item_id' => false,
+                'action' => false,
+                'content' => false
</ins><span class="cx">         );
</span><span class="cx">
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx">
</span><del>-         return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $user_id, $component, $type, $item_id, $secondary_item_id ) );
</del><ins>+         return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content ) );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /***
</span><span class="cx"> * Deleting Activity
</span><span class="cx"> *
</span><del>- * There are multiple ways to delete activity items, depending on
- * the information you have at the time.
- *
</del><span class="cx"> * If you're looking to hook into one action that provides the ID(s) of
</span><span class="cx"> * the activity/activities deleted, then use:
</span><span class="cx"> *
</span><span class="lines">@@ -634,62 +633,58 @@
</span><span class="cx"> * array of activity IDs depending on the number deleted.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-function bp_activity_delete_by_item_id( $args = '' ) {
</del><ins>+function bp_activity_delete( $args = '' ) {
</ins><span class="cx">         global $bp;
</span><span class="cx">
</span><ins>+        /* Pass one or more the of following variables to delete by those variables */
</ins><span class="cx">         $defaults = array(
</span><del>-                'item_id' => false,
</del><ins>+                'id' => false,
+                'action' => false,
+                'content' => false,
</ins><span class="cx">                 'component' => false,
</span><del>-                'type' => false, // optional
-                'user_id' => false, // optional
-                'secondary_item_id' => false // optional
</del><ins>+                'type' => false,
+                'primary_link' => false,
+                'user_id' => false,
+                'item_id' => false,
+                'secondary_item_id' => false,
+                'recorded_time' => false,
+                'hide_sitewide' => false
</ins><span class="cx">         );
</span><span class="cx">
</span><del>-        $r = wp_parse_args( $args, $defaults );
-        extract( $r, EXTR_SKIP );
</del><ins>+        $args = wp_parse_args( $args, $defaults );
</ins><span class="cx">
</span><del>-        if ( !$activity_ids_deleted = BP_Activity_Activity::delete_by_item_id( $item_id, $component, $type, $user_id, $secondary_item_id ) )
</del><ins>+        if ( !$activity_ids_deleted = BP_Activity_Activity::delete( $args ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        do_action( 'bp_activity_delete_by_item_id', $item_id, $component, $type, $user_id, $secondary_item_id );
</del><ins>+        do_action( 'bp_activity_delete', $args );
</ins><span class="cx">         do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
</span><span class="cx">
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><ins>+        /* The following functions have been deprecated in place of bp_activity_delete() */
+        function bp_activity_delete_by_item_id( $args = '' ) {
+                global $bp;
</ins><span class="cx">
</span><del>-function bp_activity_delete_by_activity_id( $activity_id ) {
-        if ( !BP_Activity_Activity::delete_by_activity_id( $activity_id ) )
-                return false;
</del><ins>+                $defaults = array( 'item_id' => false, 'component' => false, 'type' => false, 'user_id' => false, 'secondary_item_id' => false );
+                $r = wp_parse_args( $args, $defaults );
+                extract( $r, EXTR_SKIP );
</ins><span class="cx">
</span><del>-        do_action( 'bp_activity_delete_by_activity_id', $activity_id );
-        do_action( 'bp_activity_deleted_activities', $activity_id );
</del><ins>+                return bp_activity_delete( array( 'item_id' => $item_id, 'component' => $component, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
+        }
</ins><span class="cx">
</span><del>-        return true;
-}
</del><ins>+        function bp_activity_delete_by_activity_id( $activity_id ) {
+                return bp_activity_delete( array( 'id' => $activity_id ) );
+        }
</ins><span class="cx">
</span><del>-function bp_activity_delete_by_content( $user_id, $content, $component, $type ) {
-        /* Insert the "time-since" placeholder to match the existing content in the DB */
-        $content = bp_activity_add_timesince_placeholder( $content );
</del><ins>+        function bp_activity_delete_by_content( $user_id, $content, $component, $type ) {
+                return bp_activity_delete( array( 'user_id' => $user_id, 'content' => $content, 'component' => $component, 'type' => $type ) );
+        }
</ins><span class="cx">
</span><del>-        if ( !$activity_ids_deleted = BP_Activity_Activity::delete_by_content( $user_id, $content, $component, $type ) )
-                return false;
</del><ins>+        function bp_activity_delete_for_user_by_component( $user_id, $component ) {
+                return bp_activity_delete( array( 'user_id' => $user_id, 'component' => $component ) );
+        }
+        /* End deprecation */
</ins><span class="cx">
</span><del>-        do_action( 'bp_activity_delete_by_content', $user_id, $content, $component, $type );
-        do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
-
-        return true;
-}
-
-function bp_activity_delete_for_user_by_component( $user_id, $component ) {
-        if ( !$activity_ids_deleted = BP_Activity_Activity::delete_for_user_by_component( $user_id, $component ) )
-                return false;
-
-        do_action( 'bp_activity_delete_for_user_by_component', $user_id, $component );
-        do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
-
-        return true;
-}
-
</del><span class="cx"> function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -996,7 +991,7 @@
</span><span class="cx">
</span><span class="cx"> function bp_activity_remove_data( $user_id ) {
</span><span class="cx">         // Clear the user's activity from the sitewide stream and clear their activity tables
</span><del>-        BP_Activity_Activity::delete_for_user( $user_id );
</del><ins>+        bp_activity_delete( array( 'user_id' => $user_id ) );
</ins><span class="cx">
</span><span class="cx">         // Remove any usermeta
</span><span class="cx">         delete_usermeta( $user_id, 'bp_latest_update' );
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-templatetags.php (2470 => 2471)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-templatetags.php        2010-01-27 14:11:11 UTC (rev 2470)
+++ trunk/bp-groups/bp-groups-templatetags.php        2010-01-28 18:01:42 UTC (rev 2471)
</span><span class="lines">@@ -1499,6 +1499,7 @@
</span><span class="cx">                 $bp->groups->current_create_step = array_shift( array_keys( $bp->groups->group_creation_steps ) );
</span><span class="cx">
</span><span class="cx">         $counter = 1;
</span><ins>+
</ins><span class="cx">         foreach ( $bp->groups->group_creation_steps as $slug => $step ) {
</span><span class="cx">                 $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (2470 => 2471)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2010-01-27 14:11:11 UTC (rev 2470)
+++ trunk/bp-groups.php        2010-01-28 18:01:42 UTC (rev 2471)
</span><span class="lines">@@ -106,8 +106,6 @@
</span><span class="cx"> add_action( 'plugins_loaded', 'groups_setup_root_component', 2 );
</span><span class="cx">
</span><span class="cx"> function groups_check_installed() {
</span><del>-        global $wpdb, $bp;
-
</del><span class="cx">         /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
</span><span class="cx">         if ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )
</span><span class="cx">                 groups_install();
</span><span class="lines">@@ -115,7 +113,7 @@
</span><span class="cx"> add_action( 'admin_menu', 'groups_check_installed' );
</span><span class="cx">
</span><span class="cx"> function groups_setup_nav() {
</span><del>-        global $bp, $current_blog, $group_obj;
</del><ins>+        global $bp;
</ins><span class="cx">
</span><span class="cx">         if ( $group_id = BP_Groups_Group::group_exists($bp->current_action) ) {
</span><span class="cx">
</span><span class="lines">@@ -138,9 +136,6 @@
</span><span class="cx">
</span><span class="cx">                 /* Should this group be visible to the logged in user? */
</span><span class="cx">                 $bp->groups->current_group->is_group_visible_to_member = ( 'public' == $bp->groups->current_group->status || $is_member ) ? true : false;
</span><del>-
-                /* Pre 1.1 backwards compatibility - use $bp->groups->current_group instead */
-                $group_obj = &$bp->groups->current_group;
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /* Add 'Groups' to the main navigation */
</span><span class="lines">@@ -666,9 +661,11 @@
</span><span class="cx"> function groups_screen_group_activity_permalink() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><del>-        if ( !$bp->is_single_item || $bp->current_component != $bp->groups->slug || $bp->current_action != $bp->activity->slug )
</del><ins>+        if ( $bp->current_component != $bp->groups->slug || $bp->current_action != $bp->activity->slug || empty( $bp->action_variables[0] ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><ins>+        $bp->is_single_item = true;
+
</ins><span class="cx">         bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp', 'groups_screen_group_activity_permalink', 3 );
</span><span class="lines">@@ -1243,8 +1240,12 @@
</span><span class="cx">         if ( !is_array( $bp->groups->group_creation_steps ) )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        foreach ( $bp->groups->group_creation_steps as $slug => $step )
</del><ins>+        foreach ( $bp->groups->group_creation_steps as $slug => $step ) {
+                while ( !empty( $temp[$step['position']] ) )
+                        $step['position']++;
+
</ins><span class="cx">                 $temp[$step['position']] = array( 'name' => $step['name'], 'slug' => $slug );
</span><ins>+        }
</ins><span class="cx">
</span><span class="cx">         /* Sort the steps by their position key */
</span><span class="cx">         ksort($temp);
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/ajax.php (2470 => 2471)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/ajax.php        2010-01-27 14:11:11 UTC (rev 2470)
+++ trunk/bp-themes/bp-default/_inc/ajax.php        2010-01-28 18:01:42 UTC (rev 2471)
</span><span class="lines">@@ -155,8 +155,8 @@
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) || !bp_activity_delete_by_activity_id( $_POST['id'] ) ) {
-                echo '-1<div class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>';
</del><ins>+        if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) || !bp_activity_delete( array( 'id' => $_POST['id'] ) ) ) {
+                echo '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>';
</ins><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultactivitypostformphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/activity/post-form.php (2470 => 2471)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/activity/post-form.php        2010-01-27 14:11:11 UTC (rev 2470)
+++ trunk/bp-themes/bp-default/activity/post-form.php        2010-01-28 18:01:42 UTC (rev 2471)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx">         </div>
</span><span class="cx">
</span><span class="cx">         <h5>
</span><del>-                <?php if ( bp_is_group_home() ) : ?>
</del><ins>+                <?php if ( bp_is_group() ) : ?>
</ins><span class="cx">                         <?php printf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_dtheme_firstname() ) ?>
</span><span class="cx">                 <?php else : ?>
</span><span class="cx">                         <?php printf( __( "What's new %s?", 'buddypress' ), bp_dtheme_firstname() ) ?>
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx">                                 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php _e( 'Post Update', 'buddypress' ) ?>" />
</span><span class="cx">                         </div>
</span><span class="cx">
</span><del>-                        <?php if ( !bp_is_my_profile() && !bp_is_group_home() ) : ?>
</del><ins>+                        <?php if ( !bp_is_my_profile() && !bp_is_group() ) : ?>
</ins><span class="cx">                                 <div id="whats-new-post-in-box">
</span><span class="cx">                                         <?php _e( 'Post in', 'buddypress' ) ?>:
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>