<!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] [2405] trunk: Hide a user'
 s activity when they are marked as a spammer.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2405</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-22 13:03:10 +0000 (Fri, 22 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Hide a user's activity when they are marked as a spammer.</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>
<li><a href="#trunkbpblogsphp">trunk/bp-blogs.php</a></li>
<li><a href="#trunkbpcorebpcoreavatarsphp">trunk/bp-core/bp-core-avatars.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpthemesbpdefaultmemberssinglemessagesmessagesloopphp">trunk/bp-themes/bp-default/members/single/messages/messages-loop.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 (2404 => 2405)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2010-01-22 12:48:45 UTC (rev 2404)
+++ trunk/bp-activity/bp-activity-classes.php        2010-01-22 13:03:10 UTC (rev 2405)
</span><span class="lines">@@ -539,6 +539,12 @@
</span><span class="cx"> 
</span><span class="cx">                 return $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT id FROM {$bp-&gt;activity-&gt;table_name} WHERE content = %s&quot;, $content ) );
</span><span class="cx">         }
</span><ins>+
+        function hide_all_for_user( $user_id ) {
+                global $wpdb, $bp;
+
+                return $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;UPDATE {$bp-&gt;activity-&gt;table_name} SET hide_sitewide = 1 WHERE user_id = %d&quot;, $user_id ) );
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (2404 => 2405)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2010-01-22 12:48:45 UTC (rev 2404)
+++ trunk/bp-activity.php        2010-01-22 13:03:10 UTC (rev 2405)
</span><span class="lines">@@ -733,8 +733,12 @@
</span><span class="cx">         return apply_filters( 'bp_activity_add_timesince_placeholder', $content );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function bp_activity_hide_user_activity( $user_id ) {
+        return BP_Activity_Activity::hide_all_for_user( $user_id );
+}
+
</ins><span class="cx"> /**
</span><del>- * bp_activity_thumnail_content_images()
</del><ins>+ * bp_activity_thumbnail_content_images()
</ins><span class="cx">  *
</span><span class="cx">  * Take content, remove all images and replace them with one thumbnail image.
</span><span class="cx">  *
</span><span class="lines">@@ -742,7 +746,7 @@
</span><span class="cx">  * @param $content str - The content to work with
</span><span class="cx">  * @return $content str - The content with images stripped and replaced with a single thumb.
</span><span class="cx">  */
</span><del>-function bp_activity_thumnail_content_images( $content ) {
</del><ins>+function bp_activity_thumbnail_content_images( $content ) {
</ins><span class="cx">         preg_match_all( '/&lt;img[^&gt;]*&gt;/Ui', $content, $matches );
</span><span class="cx">         $content = preg_replace('/&lt;img[^&gt;]*&gt;/Ui', '', $content );
</span><span class="cx"> 
</span><span class="lines">@@ -772,7 +776,7 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return apply_filters( 'bp_activity_thumnail_content_images', $content, $matches );
</del><ins>+        return apply_filters( 'bp_activity_thumbnail_content_images', $content, $matches );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_activity_set_action( $component_id, $key, $value ) {
</span></span></pre></div>
<a id="trunkbpblogsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs.php (2404 => 2405)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs.php        2010-01-22 12:48:45 UTC (rev 2404)
+++ trunk/bp-blogs.php        2010-01-22 13:03:10 UTC (rev 2405)
</span><span class="lines">@@ -260,8 +260,8 @@
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx"> 
</span><span class="cx">         /* Remove large images and replace them with just one image thumbnail */
</span><del>-         if ( function_exists( 'bp_activity_thumnail_content_images' ) &amp;&amp; !empty( $content ) )
-                $content = bp_activity_thumnail_content_images( $content );
</del><ins>+         if ( function_exists( 'bp_activity_thumbnail_content_images' ) &amp;&amp; !empty( $content ) )
+                $content = bp_activity_thumbnail_content_images( $content );
</ins><span class="cx"> 
</span><span class="cx">         if ( !empty( $action ) )
</span><span class="cx">                 $action = apply_filters( 'bp_blogs_record_activity_action', $action );
</span></span></pre></div>
<a id="trunkbpcorebpcoreavatarsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-avatars.php (2404 => 2405)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-avatars.php        2010-01-22 12:48:45 UTC (rev 2404)
+++ trunk/bp-core/bp-core-avatars.php        2010-01-22 13:03:10 UTC (rev 2405)
</span><span class="lines">@@ -385,7 +385,7 @@
</span><span class="cx">         if ( !bp_core_is_multisite() )
</span><span class="cx">                 return WP_CONTENT_URL;
</span><span class="cx"> 
</span><del>-        return apply_filters( 'bp_core_avatar_upload_path', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) );
</del><ins>+        return apply_filters( 'bp_core_avatar_url', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (2404 => 2405)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2010-01-22 12:48:45 UTC (rev 2404)
+++ trunk/bp-core.php        2010-01-22 13:03:10 UTC (rev 2405)
</span><span class="lines">@@ -467,8 +467,12 @@
</span><span class="cx">                 else
</span><span class="cx">                         bp_core_add_message( __( 'User removed as spammer.', 'buddypress' ) );
</span><span class="cx"> 
</span><del>-                do_action( 'bp_core_action_set_spammer_status' );
</del><ins>+                /* Hide this user's activity */
+                if ( $is_spam &amp;&amp; function_exists( 'bp_activity_hide_user_activity' ) )
+                        bp_activity_hide_user_activity( $bp-&gt;displayed_user-&gt;id );
</ins><span class="cx"> 
</span><ins>+                do_action( 'bp_core_action_set_spammer_status', $bp-&gt;displayed_user-&gt;id, $is_spam );
+
</ins><span class="cx">                 bp_core_redirect( wp_get_referer() );
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -1811,8 +1815,11 @@
</span><span class="cx">  * redirect them to the home page and stop them from logging in.
</span><span class="cx">  *
</span><span class="cx">  * @package BuddyPress Core
</span><del>- * @param $username The username of the user
- * @uses delete_usermeta() deletes a row from the wp_usermeta table based on meta_key
</del><ins>+ * @param $auth_obj The WP authorization object
+ * @param $username The username of the user logging in.
+ * @uses get_userdatabylogin() Get the userdata object for a user based on their username
+ * @uses bp_core_redirect() Safe redirect to a page
+ * @return $auth_obj If the user is not a spammer, return the authorization object
</ins><span class="cx">  */
</span><span class="cx"> function bp_core_boot_spammer( $auth_obj, $username ) {
</span><span class="cx">         global $bp;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultmemberssinglemessagesmessagesloopphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/members/single/messages/messages-loop.php (2404 => 2405)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/members/single/messages/messages-loop.php        2010-01-22 12:48:45 UTC (rev 2404)
+++ trunk/bp-themes/bp-default/members/single/messages/messages-loop.php        2010-01-22 13:03:10 UTC (rev 2405)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;?php if ( bp_has_message_threads() ) : ?&gt;
</span><span class="cx"> 
</span><del>-        &lt;div class=&quot;pagination&quot; id=&quot;user-pag&quot;&gt;
</del><ins>+        &lt;div class=&quot;pagination no-ajax&quot; id=&quot;user-pag&quot;&gt;
</ins><span class="cx"> 
</span><span class="cx">                 &lt;div class=&quot;pag-count&quot; id=&quot;messages-dir-count&quot;&gt;
</span><span class="cx">                         &lt;?php bp_messages_pagination_count() ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>