<!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" />
<title>[BuddyPress][5437] trunk: Switch the &quot;filter by&quot; drop down on the Activity admin screen to get its values from the registered activity list.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/5437">5437</a></dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2011-12-04 17:20:57 +0000 (Sun, 04 Dec 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Switch the &quot;filter by&quot; drop down on the Activity admin screen to get its values from the registered activity list. Adds missing core activity types to that list. See <a href="http://buddypress.trac.wordpress.org/ticket/3660">#3660</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityadminphp">trunk/bp-activity/bp-activity-admin.php</a></li>
<li><a href="#trunkbpactivitybpactivityfunctionsphp">trunk/bp-activity/bp-activity-functions.php</a></li>
<li><a href="#trunkbpcoredeprecated16php">trunk/bp-core/deprecated/1.6.php</a></li>
<li><a href="#trunkbpfriendsbpfriendsactivityphp">trunk/bp-friends/bp-friends-activity.php</a></li>
<li><a href="#trunkbpxprofilebpxprofileactivityphp">trunk/bp-xprofile/bp-xprofile-activity.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityadminphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-admin.php (5436 => 5437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-admin.php        2011-12-03 16:31:06 UTC (rev 5436)
+++ trunk/bp-activity/bp-activity-admin.php        2011-12-04 17:20:57 UTC (rev 5437)
</span><span class="lines">@@ -950,52 +950,46 @@
</span><span class="cx">         /**
</span><span class="cx">          * Markup for the &quot;filter&quot; part of the form (i.e. which activity type to display)
</span><span class="cx">          *
</span><ins>+         * @global object $bp BuddyPress global settings
</ins><span class="cx">          * @param string $which 'top' or 'bottom'
</span><span class="cx">          * @since 1.6
</span><span class="cx">          */
</span><span class="cx">         function extra_tablenav( $which ) {
</span><ins>+                global $bp;
+
</ins><span class="cx">                 if ( 'bottom' == $which )
</span><span class="cx">                         return;
</span><span class="cx"> 
</span><ins>+                $actions  = array();
</ins><span class="cx">                 $selected = !empty( $_REQUEST['activity_type'] ) ? $_REQUEST['activity_type'] : '';
</span><del>-                ?&gt;
</del><span class="cx"> 
</span><del>-                &lt;div class=&quot;alignleft actions&quot;&gt;
-                        &lt;select name=&quot;activity_type&quot;&gt;
-                                &lt;option value=&quot;&quot; &lt;?php selected( !$selected ); ?&gt;&gt;&lt;?php _e( 'Show all activity types', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                &lt;option value=&quot;activity_update&quot;  &lt;?php selected( 'activity_update',  $selected ); ?&gt;&gt;&lt;?php _e( 'Status Updates', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                &lt;option value=&quot;activity_comment&quot; &lt;?php selected( 'activity_comment', $selected ); ?&gt;&gt;&lt;?php _e( 'Status Update Comments', 'buddypress' ); ?&gt;&lt;/option&gt;
</del><ins>+                // Walk through the registered actions, and build an array of actions/values.
+                foreach ( $bp-&gt;activity-&gt;actions as $action ) {
+                        $action = array_values( (array) $action );
</ins><span class="cx"> 
</span><del>-                                &lt;?php if ( bp_is_active( 'blogs' ) ) : ?&gt;
-                                        &lt;option value=&quot;new_blog_post&quot;    &lt;?php selected( 'new_blog_post',    $selected ); ?&gt;&gt;&lt;?php _e( 'Posts', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                        &lt;option value=&quot;new_blog_comment&quot; &lt;?php selected( 'new_blog_comment', $selected ); ?&gt;&gt;&lt;?php _e( 'Comments', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                &lt;?php endif; ?&gt;
</del><ins>+                        for ( $i = 0, $i_count = count( $action ); $i &lt; $i_count; $i++ )
+                                $actions[ $action[$i]['key'] ] = $action[$i]['value'];
+                }
</ins><span class="cx"> 
</span><del>-                                &lt;?php if ( bp_is_active( 'forums' ) ) : ?&gt;
-                                        &lt;option value=&quot;new_forum_topic&quot; &lt;?php selected( 'new_forum_topic', $selected ); ?&gt;&gt;&lt;?php _e( 'Forum Topics', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                        &lt;option value=&quot;new_forum_post&quot;  &lt;?php selected( 'new_forum_post',  $selected ); ?&gt;&gt;&lt;?php _e( 'Forum Replies', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                &lt;?php endif; ?&gt;
</del><ins>+                // This was a mis-named activity type from before BP 1.6
+                unset( $actions['friends_register_activity_action'] );
</ins><span class="cx"> 
</span><del>-                                &lt;?php if ( bp_is_active( 'groups' ) ) : ?&gt;
-                                        &lt;option value=&quot;created_group&quot; &lt;?php selected( 'created_group', $selected ); ?&gt;&gt;&lt;?php _e( 'New Groups', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                        &lt;option value=&quot;joined_group&quot;  &lt;?php selected( 'joined_group',  $selected ); ?&gt;&gt;&lt;?php _e( 'Group Memberships', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                &lt;?php endif; ?&gt;
</del><ins>+                // Sort array by the human-readable value
+                natsort( $actions );
+        ?&gt;
</ins><span class="cx"> 
</span><del>-                                &lt;?php if ( bp_is_active( 'friends' ) ) : ?&gt;
-                                        &lt;option value=&quot;friendship_accepted&quot; &lt;?php selected( 'friendship_accepted', $selected ); ?&gt;&gt;&lt;?php _e( 'Friendships Accepted', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                        &lt;option value=&quot;friendship_created&quot;  &lt;?php selected( 'friendship_created',  $selected ); ?&gt;&gt;&lt;?php _e( 'New Friendships', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                &lt;?php endif; ?&gt;
</del><ins>+                &lt;div class=&quot;alignleft actions&quot;&gt;
+                        &lt;select name=&quot;activity_type&quot;&gt;
+                                &lt;option value=&quot;&quot; &lt;?php selected( !$selected ); ?&gt;&gt;&lt;?php _e( 'Show all activity types', 'buddypress' ); ?&gt;&lt;/option&gt;
</ins><span class="cx"> 
</span><del>-                                &lt;option value=&quot;new_member&quot; &lt;?php selected( 'new_member', $selected ); ?&gt;&gt;&lt;?php _e( 'New Members', 'buddypress' ); ?&gt;&lt;/option&gt;
-                                &lt;option value=&quot;new_avatar&quot; &lt;?php selected( 'new_avatar', $selected ); ?&gt;&gt;&lt;?php _e( 'New Member Avatar', 'buddypress' ); ?&gt;&lt;/option&gt;
-
-                                &lt;?php do_action( 'bp_activity_filter_options' ); ?&gt;
-
</del><ins>+                                &lt;?php foreach ( $actions as $k =&gt; $v ) : ?&gt;
+                                        &lt;option value=&quot;&lt;?php echo esc_attr( $k ); ?&gt;&quot; &lt;?php selected( $k,  $selected ); ?&gt;&gt;&lt;?php echo esc_html( $v ); ?&gt;&lt;/option&gt;
+                                &lt;?php endforeach; ?&gt;
</ins><span class="cx">                         &lt;/select&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php submit_button( __( 'Filter', 'buddypress' ), 'secondary', false, false, array( 'id' =&gt; 'post-query-submit' ) ); ?&gt;
</span><del>-
</del><span class="cx">                 &lt;/div&gt;
</span><ins>+
</ins><span class="cx">         &lt;?php
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpactivitybpactivityfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-functions.php (5436 => 5437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-functions.php        2011-12-03 16:31:06 UTC (rev 5436)
+++ trunk/bp-activity/bp-activity-functions.php        2011-12-04 17:20:57 UTC (rev 5437)
</span><span class="lines">@@ -753,20 +753,21 @@
</span><span class="cx"> /**
</span><span class="cx">  * Register the activity stream actions for updates
</span><span class="cx">  *
</span><del>- * @since 1.2.0
- *
</del><span class="cx">  * @global object $bp BuddyPress global settings
</span><del>- * @uses bp_activity_set_action()
- * @uses do_action() To call the 'updates_register_activity_actions' hook
</del><ins>+ * @since 1.6
</ins><span class="cx">  */
</span><del>-function updates_register_activity_actions() {
</del><ins>+function bp_activity_register_activity_actions() {
</ins><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        bp_activity_set_action( $bp-&gt;activity-&gt;id, 'activity_update', __( 'Posted an update', 'buddypress' ) );
</del><ins>+        bp_activity_set_action( $bp-&gt;activity-&gt;id, 'activity_update', __( 'Posted a status update', 'buddypress' ) );
+        bp_activity_set_action( $bp-&gt;activity-&gt;id, 'activity_comment', __( 'Replied to a status update', 'buddypress' ) );
</ins><span class="cx"> 
</span><ins>+        do_action( 'bp_activity_register_activity_actions' );
+
+        // Backpat. Don't use this.
</ins><span class="cx">         do_action( 'updates_register_activity_actions' );
</span><span class="cx"> }
</span><del>-add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' );
</del><ins>+add_action( 'bp_register_activity_actions', 'bp_activity_register_activity_actions' );
</ins><span class="cx"> 
</span><span class="cx"> /******************************************************************************
</span><span class="cx">  * Business functions are where all the magic happens in BuddyPress. They will
</span></span></pre></div>
<a id="trunkbpcoredeprecated16php"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/deprecated/1.6.php (5436 => 5437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/deprecated/1.6.php        2011-12-03 16:31:06 UTC (rev 5436)
+++ trunk/bp-core/deprecated/1.6.php        2011-12-04 17:20:57 UTC (rev 5437)
</span><span class="lines">@@ -73,4 +73,15 @@
</span><span class="cx">         _deprecated_function( __FUNCTION__, '1.6' );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Activity functions
+ */
+
+/**
+ * @deprecated 1.6
+ * @deprecated No longer used. Renamed to bp_activity_register_activity_actions().
+ */
+function updates_register_activity_actions() {
+        _deprecated_function( __FUNCTION__, '1.6' );
+}
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendsactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-activity.php (5436 => 5437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-activity.php        2011-12-03 16:31:06 UTC (rev 5436)
+++ trunk/bp-friends/bp-friends-activity.php        2011-12-04 17:20:57 UTC (rev 5437)
</span><span class="lines">@@ -47,6 +47,11 @@
</span><span class="cx">         if ( !bp_is_active( 'activity' ) )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><ins>+        // These two added in BP 1.6
+        bp_activity_set_action( $bp-&gt;friends-&gt;id, 'friendship_accepted', __( 'Friendships accepted', 'buddypress' ) );
+        bp_activity_set_action( $bp-&gt;friends-&gt;id, 'friendship_created', __( 'New friendships', 'buddypress' ) );
+
+        // &lt; BP 1.6 backpat
</ins><span class="cx">         bp_activity_set_action( $bp-&gt;friends-&gt;id, 'friends_register_activity_action', __( 'New friendship created', 'buddypress' ) );
</span><span class="cx"> 
</span><span class="cx">         do_action( 'friends_register_activity_actions' );
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-activity.php (5436 => 5437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-activity.php        2011-12-03 16:31:06 UTC (rev 5436)
+++ trunk/bp-xprofile/bp-xprofile-activity.php        2011-12-04 17:20:57 UTC (rev 5437)
</span><span class="lines">@@ -15,12 +15,10 @@
</span><span class="cx"> function xprofile_register_activity_actions() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( bp_is_active( 'activity' ) )
-                return false;
-
</del><span class="cx">         // Register the activity stream actions for this component
</span><ins>+        bp_activity_set_action( $bp-&gt;profile-&gt;id, 'new_avatar',      __( 'Member changed profile picture', 'buddypress' ) );
</ins><span class="cx">         bp_activity_set_action( $bp-&gt;profile-&gt;id, 'new_member',      __( 'New member registered', 'buddypress' ) );
</span><del>-        bp_activity_set_action( $bp-&gt;profile-&gt;id, 'updated_profile', __( 'Updated Profile',       'buddypress' ) );
</del><ins>+        bp_activity_set_action( $bp-&gt;profile-&gt;id, 'updated_profile', __( 'Updated Profile', 'buddypress' ) );
</ins><span class="cx"> 
</span><span class="cx">         do_action( 'xprofile_register_activity_actions' );
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>