<!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] [1750] trunk: Further activity action revisions.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1750</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-01 02:12:35 +0000 (Tue, 01 Sep 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Further activity action revisions.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivityphp">trunk/bp-activity.php</a></li>
<li><a href="#trunkbpblogsphp">trunk/bp-blogs.php</a></li>
<li><a href="#trunkbpfriendsphp">trunk/bp-friends.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpstatusphp">trunk/bp-status.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (1749 => 1750)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2009-09-01 01:45:37 UTC (rev 1749)
+++ trunk/bp-activity.php        2009-09-01 02:12:35 UTC (rev 1750)
</span><span class="lines">@@ -323,7 +323,7 @@
</span><span class="cx"> function bp_activity_delete_for_user_by_component( $user_id, $component_name ) {
</span><span class="cx">         if ( !BP_Activity_Activity::delete_for_user_by_component( $user_id, $component_name ) )
</span><span class="cx">                 return false;
</span><del>-                
</del><ins>+
</ins><span class="cx">         do_action( 'bp_activity_delete_for_user_by_component', $user_id, $component_name );
</span><span class="cx">         
</span><span class="cx">         return true;
</span></span></pre></div>
<a id="trunkbpblogsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs.php (1749 => 1750)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs.php        2009-09-01 01:45:37 UTC (rev 1749)
+++ trunk/bp-blogs.php        2009-09-01 02:12:35 UTC (rev 1750)
</span><span class="lines">@@ -117,11 +117,6 @@
</span><span class="cx">         $bp->blogs->format_notification_function = 'bp_blogs_format_notifications';
</span><span class="cx">         $bp->blogs->slug = BP_BLOGS_SLUG;
</span><span class="cx">         
</span><del>-        /* Register the activity stream actions for this component */
-        bp_blogs_register_activity_action( 'new_blog', __( 'New blog created', 'buddypress' ) );
-        bp_blogs_register_activity_action( 'new_blog_post', __( 'New blog post published', 'buddypress' ) );
-        bp_blogs_register_activity_action( 'new_blog_comment', __( 'New blog post comment posted', 'buddypress' ) );
-
</del><span class="cx">         /* Register this in the active components array */
</span><span class="cx">         $bp->active_components[$bp->blogs->slug] = $bp->blogs->id;
</span><span class="cx"> }
</span><span class="lines">@@ -224,6 +219,20 @@
</span><span class="cx"> * notifications for the user and for this specific component.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+function bp_blogs_register_activity_actions() {
+        global $bp;
+        
+        if ( !function_exists( 'bp_activity_set_action' ) )
+                return false;
+
+        bp_activity_set_action( $bp->blogs->id, 'new_blog', __( 'New blog created', 'buddypress' ) );
+        bp_activity_set_action( $bp->blogs->id, 'new_blog_post', __( 'New blog post published', 'buddypress' ) );
+        bp_activity_set_action( $bp->blogs->id, 'new_blog_comment', __( 'New blog post comment posted', 'buddypress' ) );
+
+        do_action( 'bp_blogs_register_activity_actions' );
+}
+add_action( 'plugins_loaded', 'bp_blogs_register_activity_actions' );
+
</ins><span class="cx"> function bp_blogs_record_activity( $args = '' ) {
</span><span class="cx">         global $bp;
</span><span class="cx">         
</span><span class="lines">@@ -260,15 +269,6 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function bp_blogs_register_activity_action( $key, $value ) {
-        global $bp;
-        
-        if ( !function_exists( 'bp_activity_set_action' ) )
-                return false;
-        
-        return apply_filters( 'bp_blogs_register_activity_action', bp_activity_set_action( $bp->blogs->id, $key, $value ), $key, $value );
-}
-
</del><span class="cx"> /********************************************************************************
</span><span class="cx"> * Business Functions
</span><span class="cx"> *
</span><span class="lines">@@ -328,7 +328,7 @@
</span><span class="cx">                 'user_id' => $recorded_blog->user_id,
</span><span class="cx">                 'content' => sprintf( __( '%s created the blog %s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_blog_option( $recorded_blog->blog_id, 'siteurl' ) . '">' . attribute_escape( $name ) . '</a>' ),
</span><span class="cx">                 'primary_link' => get_blog_option( $recorded_blog->blog_id, 'siteurl' ),
</span><del>-                'component_action' => $bp->activity->actions->blogs['new_blog'],
</del><ins>+                'component_action' => 'new_blog',
</ins><span class="cx">                 'item_id' => $recorded_blog_id
</span><span class="cx">         ) );
</span><span class="cx">
</span><span class="lines">@@ -376,7 +376,7 @@
</span><span class="cx">                                 'user_id' => (int)$post->post_author,
</span><span class="cx">                                 'content' => sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' ),
</span><span class="cx">                                 'primary_link' => $post_permalink,
</span><del>-                                'component_action' => $bp->activity->actions->blogs['new_blog_post'],
</del><ins>+                                'component_action' => 'new_blog_post',
</ins><span class="cx">                                 'item_id' => $recorded_post->id,
</span><span class="cx">                                 'recorded_time' => $recorded_post->date_created
</span><span class="cx">                         ) );
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx">                         'user_id' => (int)$post->post_author,
</span><span class="cx">                         'content' => sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' ),
</span><span class="cx">                         'primary_link' => $post_permalink,
</span><del>-                        'component_action' => $bp->activity->actions->blogs['new_blog_post'],
</del><ins>+                        'component_action' => 'new_blog_post',
</ins><span class="cx">                         'item_id' => $existing_post->id,
</span><span class="cx">                         'recorded_time' => $existing_post->date_created
</span><span class="cx">                 ) );
</span><span class="lines">@@ -457,7 +457,7 @@
</span><span class="cx">                 'user_id' => $recorded_comment->user_id,
</span><span class="cx">                 'content' => $content,
</span><span class="cx">                 'primary_link' => $comment_link,
</span><del>-                'component_action' => $bp->activity->actions->blogs['new_blog_comment'],
</del><ins>+                'component_action' => 'new_blog_comment',
</ins><span class="cx">                 'item_id' => $recorded_comment->blog_id,
</span><span class="cx">                 'recorded_time' => $recorded_comment->date_created
</span><span class="cx">         ) );
</span><span class="lines">@@ -481,7 +481,7 @@
</span><span class="cx">                 'user_id' => $recorded_comment->user_id,
</span><span class="cx">                 'content' => $content,
</span><span class="cx">                 'primary_link' => $comment_link,
</span><del>-                'component_action' => $bp->activity->actions->blogs['new_blog_comment'],
</del><ins>+                'component_action' => 'new_blog_comment',
</ins><span class="cx">                 'item_id' => $recorded_comment->blog_id,
</span><span class="cx">                 'recorded_time' => $recorded_comment->date_created
</span><span class="cx">         ) );
</span></span></pre></div>
<a id="trunkbpfriendsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends.php (1749 => 1750)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends.php        2009-09-01 01:45:37 UTC (rev 1749)
+++ trunk/bp-friends.php        2009-09-01 02:12:35 UTC (rev 1750)
</span><span class="lines">@@ -46,10 +46,7 @@
</span><span class="cx">         $bp->friends->format_activity_function = 'friends_format_activity';
</span><span class="cx">         $bp->friends->format_notification_function = 'friends_format_notifications';
</span><span class="cx">         $bp->friends->slug = BP_FRIENDS_SLUG;
</span><del>-
-        /* Register the activity stream actions for this component */
-        friends_register_activity_action( 'friendship_created', __( 'New friendship created', 'buddypress' ) );
-
</del><ins>+        
</ins><span class="cx">         /* Register this in the active components array */
</span><span class="cx">         $bp->active_components[$bp->friends->slug] = $bp->friends->id;
</span><span class="cx"> }
</span><span class="lines">@@ -325,14 +322,17 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function friends_register_activity_action( $key, $value ) {
</del><ins>+function friends_register_activity_actions() {
</ins><span class="cx">         global $bp;
</span><span class="cx">         
</span><span class="cx">         if ( !function_exists( 'bp_activity_set_action' ) )
</span><span class="cx">                 return false;
</span><del>-        
-        return apply_filters( 'friends_register_activity_action', bp_activity_set_action( $bp->friends->id, $key, $value ), $key, $value );
</del><ins>+
+        bp_activity_set_action( $bp->friends->id, 'friends_register_activity_action', __( 'New friendship created', 'buddypress' ) );
+
+        do_action( 'friends_register_activity_actions' );
</ins><span class="cx"> }
</span><ins>+add_action( 'plugins_loaded', 'friends_register_activity_actions' );
</ins><span class="cx">
</span><span class="cx"> function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
</span><span class="cx">         global $bp;
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (1749 => 1750)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2009-09-01 01:45:37 UTC (rev 1749)
+++ trunk/bp-groups.php        2009-09-01 02:12:35 UTC (rev 1750)
</span><span class="lines">@@ -147,13 +147,6 @@
</span><span class="cx">         ) );
</span><span class="cx">         
</span><span class="cx">         $bp->groups->valid_status = apply_filters( 'groups_valid_status', array( 'public', 'private', 'hidden' ) );
</span><del>-
-        /* Register the activity stream actions for this component */
-        groups_register_activity_action( 'created_group', __( 'Created a group', 'buddypress' ) );
-        groups_register_activity_action( 'joined_group', __( 'Joined a group', 'buddypress' ) );
-        groups_register_activity_action( 'new_wire_post', __( 'New group wire post', 'buddypress' ) );
-        groups_register_activity_action( 'new_forum_topic', __( 'New group forum topic', 'buddypress' ) );
-        groups_register_activity_action( 'new_forum_post', __( 'New group forum post', 'buddypress' ) );
</del><span class="cx"> }
</span><span class="cx"> add_action( 'plugins_loaded', 'groups_setup_globals', 5 );        
</span><span class="cx"> add_action( 'admin_menu', 'groups_setup_globals', 2 );
</span><span class="lines">@@ -1373,6 +1366,22 @@
</span><span class="cx"> * notifications for the user and for this specific component.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+function groups_register_activity_actions() {
+        global $bp;
+        
+        if ( !function_exists( 'bp_activity_set_action' ) )
+                return false;
+
+        bp_activity_set_action( $bp->groups->id, 'created_group', __( 'Created a group', 'buddypress' ) );
+        bp_activity_set_action( $bp->groups->id, 'joined_group', __( 'Joined a group', 'buddypress' ) );
+        bp_activity_set_action( $bp->groups->id, 'new_wire_post', __( 'New group wire post', 'buddypress' ) );
+        bp_activity_set_action( $bp->groups->id, 'new_forum_topic', __( 'New group forum topic', 'buddypress' ) );
+        bp_activity_set_action( $bp->groups->id, 'new_forum_post', __( 'New group forum post', 'buddypress' ) );
+
+        do_action( 'groups_register_activity_actions' );
+}
+add_action( 'plugins_loaded', 'groups_register_activity_actions' );
+
</ins><span class="cx"> function groups_record_activity( $args = '' ) {
</span><span class="cx">         global $bp;
</span><span class="cx">         
</span><span class="lines">@@ -1401,15 +1410,6 @@
</span><span class="cx">         return bp_activity_add( array( 'user_id' => $user_id, 'content' => $content, 'primary_link' => $primary_link, 'component_name' => $component_name, 'component_action' => $component_action, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function groups_register_activity_action( $key, $value ) {
-        global $bp;
-        
-        if ( !function_exists( 'bp_activity_set_action' ) )
-                return false;
-        
-        return apply_filters( 'groups_register_activity_action', bp_activity_set_action( $bp->groups->id, $key, $value ), $key, $value );
-}
-
</del><span class="cx"> function groups_update_last_activity( $group_id ) {
</span><span class="cx">         groups_update_groupmeta( $group_id, 'last_activity', time() );
</span><span class="cx"> }
</span><span class="lines">@@ -1676,7 +1676,7 @@
</span><span class="cx">
</span><span class="cx">         /* Delete the activity stream item */
</span><span class="cx">         if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
</span><del>-                bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['created_group'] ) );
</del><ins>+                bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group' ) );
</ins><span class="cx">         }        
</span><span class="cx">
</span><span class="cx">         // Remove all outstanding invites for this group
</span><span class="lines">@@ -1991,7 +1991,7 @@
</span><span class="cx">         if ( bp_wire_delete_post( $wire_post_id, 'groups', $table_name ) ) {
</span><span class="cx">                 /* Delete the activity stream item */
</span><span class="cx">                 if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
</span><del>-                        bp_activity_delete_by_item_id( array( 'item_id' => $wire_post_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['new_wire_post'] ) );
</del><ins>+                        bp_activity_delete_by_item_id( array( 'item_id' => $wire_post_id, 'component_name' => 'groups', 'component_action' => 'new_wire_post' ) );
</ins><span class="cx">                 }
</span><span class="cx">                         
</span><span class="cx">                 do_action( 'groups_deleted_wire_post', $wire_post_id );
</span><span class="lines">@@ -2079,7 +2079,7 @@
</span><span class="cx">         
</span><span class="cx">         if ( $topic = bp_forums_update_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_id' => $topic_id ) ) ) {
</span><span class="cx">                 /* Update the activity stream item */
</span><del>-                bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['new_forum_topic'] ) );
</del><ins>+                bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => 'new_forum_topic' ) );
</ins><span class="cx">                 
</span><span class="cx">                 $activity_content = sprintf( __( '%s started the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug .'">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
</span><span class="cx">                 $activity_content .= '<blockquote>' . bp_create_excerpt( attribute_escape( $topic_text ) ) . '</blockquote>';
</span><span class="lines">@@ -2109,7 +2109,7 @@
</span><span class="cx">         if ( bp_forums_delete_topic( array( 'topic_id' => $topic_id ) ) ) {
</span><span class="cx">                 /* Delete the activity stream item */
</span><span class="cx">                 if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
</span><del>-                        bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => $bp->activity->actions->groups['new_forum_topic'] ) );
</del><ins>+                        bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => 'new_forum_topic' ) );
</ins><span class="cx">                         bp_activity_delete_by_item_id( array( 'item_id' => $topic_id, 'component_name' => 'groups', 'component_action' => 'new_forum_post' ) );
</span><span class="cx">                 }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpstatusphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-status.php (1749 => 1750)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-status.php        2009-09-01 01:45:37 UTC (rev 1749)
+++ trunk/bp-status.php        2009-09-01 02:12:35 UTC (rev 1750)
</span><span class="lines">@@ -12,9 +12,6 @@
</span><span class="cx">         $bp->status->id = 'status';
</span><span class="cx">         $bp->status->slug = BP_STATUS_SLUG;
</span><span class="cx">         
</span><del>-        /* Register the activity stream actions for this component */
-        bp_status_register_activity_action( 'new_status', __( 'New status update', 'buddypress' ) );
-
</del><span class="cx">         /* Register this in the active components array */
</span><span class="cx">         $bp->active_components[$bp->status->slug] = $bp->status->id;
</span><span class="cx"> }
</span><span class="lines">@@ -29,6 +26,19 @@
</span><span class="cx"> * notifications for the user and for this specific component.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+function bp_status_register_activity_actions() {
+        global $bp;
+        
+        if ( !function_exists( 'bp_activity_set_action' ) )
+                return false;
+
+        /* Register the activity stream actions for this component */
+        bp_activity_set_action( $bp->status->id, 'new_status', __( 'New status update', 'buddypress' ) );
+
+        do_action( 'bp_status_register_activity_actions' );
+}
+add_action( 'plugins_loaded', 'bp_status_register_activity_actions' );
+
</ins><span class="cx"> function bp_status_record_activity( $user_id, $content, $primary_link, $component_action = 'new_status' ) {
</span><span class="cx">         if ( !function_exists( 'bp_activity_add' ) )
</span><span class="cx">                 return false;
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (1749 => 1750)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2009-09-01 01:45:37 UTC (rev 1749)
+++ trunk/bp-xprofile.php        2009-09-01 02:12:35 UTC (rev 1750)
</span><span class="lines">@@ -140,9 +140,6 @@
</span><span class="cx">         $bp->profile->format_notification_function = 'xprofile_format_notifications';
</span><span class="cx">         $bp->profile->slug = BP_XPROFILE_SLUG;
</span><span class="cx">
</span><del>-        /* Register the activity stream actions for this component */
-        xprofile_register_activity_action( 'new_wire_post', __( 'New profile wire post', 'buddypress' ) );
-
</del><span class="cx">         /* Register this in the active components array */
</span><span class="cx">         $bp->active_components[$bp->profile->slug] = $bp->profile->id;
</span><span class="cx">         
</span><span class="lines">@@ -579,6 +576,19 @@
</span><span class="cx"> * notifications for the user and for this specific component.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+function xprofile_register_activity_actions() {
+        global $bp;
+        
+        if ( !function_exists( 'bp_activity_set_action' ) )
+                return false;
+
+        /* Register the activity stream actions for this component */
+        bp_activity_set_action( $bp->profile->id, 'new_wire_post', __( 'New profile wire post', 'buddypress' ) );
+
+        do_action( 'xprofile_register_activity_actions' );
+}
+add_action( 'plugins_loaded', 'xprofile_register_activity_actions' );
+
</ins><span class="cx"> /**
</span><span class="cx"> * xprofile_record_activity()
</span><span class="cx"> *
</span></span></pre>
</div>
</div>
</body>
</html>