<!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] [2218] trunk: @username notifications and filters.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2218</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-12-27 20:01:21 +0000 (Sun, 27 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>@username notifications and filters.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityfiltersphp">trunk/bp-activity/bp-activity-filters.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="#trunkbpcorebpcorewpabstractionphp">trunk/bp-core/bp-core-wpabstraction.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="#trunkbpthemesbpdefault_incglobaljs">trunk/bp-themes/bp-default/_inc/global.js</a></li>
<li><a href="#trunkbpthemesbpdefaultactivityentryphp">trunk/bp-themes/bp-default/activity/entry.php</a></li>
<li><a href="#trunkbpxprofilebpxprofilenotificationsphp">trunk/bp-xprofile/bp-xprofile-notifications.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-filters.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-filters.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-activity/bp-activity-filters.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -54,5 +54,26 @@
</span><span class="cx">         return wp_kses( $content, $activity_allowedtags );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function bp_activity_at_name_filter( $content ) {
+        include_once( ABSPATH . WPINC . '/registration.php' );
</ins><span class="cx"> 
</span><ins>+        $pattern = '/[@]+([A-Za-z0-9-_]+)/';
+        preg_match_all( $pattern, $content, $usernames );
+
+        /* Make sure there's only one instance of each username */
+        if ( !$usernames = array_unique( $usernames[1] ) )
+                return $content;
+
+        foreach( (array)$usernames as $username ) {
+                if ( !username_exists( $username ) )
+                        continue;
+
+                $content = str_replace( &quot;@$username&quot;, &quot;&lt;a href='&quot; . bp_core_get_user_domain( bp_core_get_userid( $username ) ) . &quot;' rel='nofollow'&gt;@$username&lt;/a&gt;&quot;, $content );
+        }
+
+        return $content;
+}
+add_filter( 'xprofile_activity_new_update_content', 'bp_activity_at_name_filter' );
+add_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' );
+
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpactivitybpactivitytemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-templatetags.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-templatetags.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-activity/bp-activity-templatetags.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -509,14 +509,7 @@
</span><span class="cx">         function bp_get_activity_thread_permalink() {
</span><span class="cx">                 global $bp, $activities_template;
</span><span class="cx"> 
</span><del>-                if ( 'new_blog_post' == bp_get_activity_action_name() || 'new_blog_comment' == bp_get_activity_action_name() || 'new_forum_topic' == bp_get_activity_action_name() || 'new_forum_post' == bp_get_activity_action_name() )
-                        $link = bp_activity_feed_item_link();
-                else {
-                        if ( 'activity_comment' == bp_get_activity_action_name() )
-                                $link = $bp-&gt;root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template-&gt;activity-&gt;item_id;
-                        else
-                                $link = $bp-&gt;root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template-&gt;activity-&gt;id;
-                }
</del><ins>+                $link = bp_activity_get_permalink( $activities_template-&gt;activity-&gt;id, $activities_template-&gt;activity );
</ins><span class="cx"> 
</span><span class="cx">                  return apply_filters( 'bp_get_activity_thread_permalink', $link );
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-activity.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -162,6 +162,8 @@
</span><span class="cx"> 
</span><span class="cx">         $has_access = apply_filters( 'bp_activity_permalink_access', $has_access, &amp;$activity );
</span><span class="cx"> 
</span><ins>+        do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
+
</ins><span class="cx">         if ( !$has_access ) {
</span><span class="cx">                 bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' );
</span><span class="cx">                 bp_core_redirect( $bp-&gt;loggedin_user-&gt;domain );
</span><span class="lines">@@ -485,6 +487,24 @@
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
+        global $bp;
+
+        if ( !$activity_obj )
+                $activity_obj = new BP_Activity_Activity( $activity_id );
+
+        if ( 'new_blog_post' == $activity_obj-&gt;component_action || 'new_blog_comment' == $activity_obj-&gt;component_action || 'new_forum_topic' == $activity_obj-&gt;component_action || 'new_forum_post' == $activity_obj-&gt;component_action )
+                $link = $activity_obj-&gt;primary_link;
+        else {
+                if ( 'activity_comment' == $activity_obj-&gt;component_action )
+                        $link = $bp-&gt;root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj-&gt;item_id . '/';
+                else
+                        $link = $bp-&gt;root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj-&gt;id . '/';
+        }
+
+        return apply_filters( 'bp_activity_get_permalink', $link );
+}
+
</ins><span class="cx"> function bp_activity_add_timesince_placeholder( $content ) {
</span><span class="cx">         /* Check a time-since span doesn't already exist */
</span><span class="cx">         if ( false === strpos( $content, '&lt;span class=&quot;time-since&quot;&gt;' ) ) {
</span></span></pre></div>
<a id="trunkbpcorebpcorewpabstractionphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-wpabstraction.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-wpabstraction.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-core/bp-core-wpabstraction.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if ( !function_exists( 'wpmu_validate_user_signup' ) ) {
</span><del>-        function wpmu_validate_user_signup($user_name, $user_email) {
</del><ins>+        function wpmu_validate_user_signup( $user_name, $user_email ) {
</ins><span class="cx">                 global $wpdb;
</span><span class="cx"> 
</span><span class="cx">                 $errors = new WP_Error();
</span><span class="lines">@@ -169,33 +169,6 @@
</span><span class="cx">                 if ( email_exists($user_email) )
</span><span class="cx">                         $errors-&gt;add('user_email', __(&quot;Sorry, that email address is already used!&quot;));
</span><span class="cx"> 
</span><del>-                // Has someone already signed up for this username?
-                $signup = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;signups WHERE user_login = %s&quot;, $user_name) );
-                if ( $signup != null ) {
-                        $registered_at =  mysql2date('U', $signup-&gt;registered);
-                        $now = current_time( 'timestamp', true );
-                        $diff = $now - $registered_at;
-                        // If registered more than two days ago, cancel registration and let this signup go through.
-                        if ( $diff &gt; 172800 ) {
-                                $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;signups WHERE user_login = %s&quot;, $user_name) );
-                        } else {
-                                $errors-&gt;add('user_name', __(&quot;That username is currently reserved but may be available in a couple of days.&quot;));
-                        }
-                        if( $signup-&gt;active == 0 &amp;&amp; $signup-&gt;user_email == $user_email )
-                                $errors-&gt;add('user_email_used', __(&quot;username and email used&quot;));
-                }
-
-                $signup = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;signups WHERE user_email = %s&quot;, $user_email) );
-                if ( $signup != null ) {
-                        $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup-&gt;registered);
-                        // If registered more than two days ago, cancel registration and let this signup go through.
-                        if ( $diff &gt; 172800 ) {
-                                $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;signups WHERE user_email = %s&quot;, $user_email) );
-                        } else {
-                                $errors-&gt;add('user_email', __(&quot;That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.&quot;));
-                        }
-                }
-
</del><span class="cx">                 $result = array('user_name' =&gt; $user_name, 'user_email' =&gt; $user_email,        'errors' =&gt; $errors);
</span><span class="cx"> 
</span><span class="cx">                 return apply_filters('wpmu_validate_user_signup', $result);
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-groups.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -2001,8 +2001,8 @@
</span><span class="cx"> 
</span><span class="cx">         $activity_id = groups_record_activity( array(
</span><span class="cx">                 'user_id' =&gt; $user_id,
</span><del>-                'content' =&gt; apply_filters( 'groups_activity_new_wire_post', $activity_content ),
-                'primary_link' =&gt; apply_filters( 'groups_activity_new_wire_post_primary_link', bp_get_group_permalink( $group ) ),
</del><ins>+                'content' =&gt; apply_filters( 'groups_activity_new_update_content', $activity_content ),
+                'primary_link' =&gt; apply_filters( 'groups_activity_new_update_primary_link', bp_get_group_permalink( $group ) ),
</ins><span class="cx">                 'component_action' =&gt; 'new_wire_post',
</span><span class="cx">                 'item_id' =&gt; $item_id
</span><span class="cx">         ) );
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/ajax.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/ajax.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-themes/bp-default/_inc/ajax.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -376,7 +376,6 @@
</span><span class="cx">                         $new_favs[] = $fav;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-
</del><span class="cx">         update_usermeta( $bp-&gt;loggedin_user-&gt;id, 'bp_favorite_activities', $new_favs );
</span><span class="cx"> 
</span><span class="cx">         _e( 'Mark Favorite', 'buddypress' );
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/global.js (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-themes/bp-default/_inc/global.js        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="cx">                                 j(&quot;ul.activity-list&quot;).prepend(response);
</span><ins>+                                j(&quot;ul.activity-list li:first&quot;).addClass('new-update');
</ins><span class="cx">                                 j(&quot;li.new-update&quot;).hide().slideDown( 300 );
</span><span class="cx">                                 j(&quot;li.new-update&quot;).removeClass( 'new-update' );
</span><span class="cx">                                 j(&quot;textarea#whats-new&quot;).val('');
</span><span class="lines">@@ -290,7 +291,6 @@
</span><span class="cx">                         form.slideDown( 200 );
</span><span class="cx">                         j.scrollTo( form, 500, { offset:-100, easing:'easeout' } );
</span><span class="cx">                         j('#ac-form-' + ids[2] + ' textarea').focus();
</span><del>-                        j('#ac-form-' + ids[2] + ' textarea').TextAreaExpander( 60, 1000 );
</del><span class="cx"> 
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultactivityentryphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/activity/entry.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/activity/entry.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-themes/bp-default/activity/entry.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> &lt;?php /* This template is used by permalink pages and AJAX functions to load in new updates */ ?&gt;
</span><del>-&lt;li class=&quot;&lt;?php bp_activity_css_class() ?&gt; new-update&quot; id=&quot;activity-&lt;?php bp_activity_id() ?&gt;&quot;&gt;
</del><ins>+&lt;li class=&quot;&lt;?php bp_activity_css_class() ?&gt;&quot; id=&quot;activity-&lt;?php bp_activity_id() ?&gt;&quot;&gt;
</ins><span class="cx">         &lt;div class=&quot;activity-avatar&quot;&gt;
</span><span class="cx">                 &lt;?php bp_activity_avatar( 'type=full&amp;width=60&amp;height=60' ) ?&gt;
</span><span class="cx">         &lt;/div&gt;
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofilenotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-notifications.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-notifications.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-xprofile/bp-xprofile-notifications.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -1,7 +1,56 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> 
</span><ins>+function xprofile_at_message_notification( $content, $poster_user_id, $activity_id ) {
+        global $bp;
+
+        /* Scan for @username strings in an activity update. Notify each user. */
+        $pattern = '/[@]+([A-Za-z0-9-_]+)/';
+        preg_match_all( $pattern, $content, $usernames );
+
+        /* Make sure there's only one instance of each username */
+        if ( !$usernames = array_unique( $usernames[1] ) )
+                return false;
+
+        foreach( (array)$usernames as $username ) {
+                if ( !$receiver_user_id = bp_core_get_userid($username) )
+                        continue;
+
+                // Add a screen notification of an @message
+                bp_core_add_notification( $activity_id, $receiver_user_id, $bp-&gt;profile-&gt;id, 'new_at_mention', $poster_user_id );
+
+                // Now email the user with the contents of the message (if they have enabled email notifications)
+                if ( !get_usermeta( $user_id, 'notification_activity_new_mention' ) || 'yes' == get_usermeta( $user_id, 'notification_activity_new_mention' ) ) {
+                        $poster_name = bp_core_get_user_displayname( $poster_user_id );
+
+                        $message_link = bp_activity_get_permalink( $activity_id );
+                        $settings_link = bp_core_get_user_domain( $user_id ) . 'settings/notifications/';
+
+                        // Set up and send the message
+                        $ud = get_userdata( $receiver_user_id );
+                        $to = $ud-&gt;user_email;
+                        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), stripslashes($poster_name) );
+
+$message = sprintf( __(
+'%s mentioned you in an update:
+
+&quot;%s&quot;
+
+To view and respond to the message, log in and visit: %s
+
+---------------------
+', 'buddypress' ), $poster_name, wp_filter_kses( stripslashes($content) ), $message_link );
+
+                        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
+
+                        // Send it
+                        wp_mail( $to, $subject, $message );
+                }
+        }
+}
+add_action( 'xprofile_posted_update', 'xprofile_at_message_notification', 10, 3 );
+
</ins><span class="cx"> /**
</span><del>- * xprofile_record_wire_post_notification()
</del><ins>+ * xprofile_record_wire_post_notification() [DEPRECATED]
</ins><span class="cx">  *
</span><span class="cx">  * Records a notification for a new profile wire post to the database and sends out a notification
</span><span class="cx">  * email if the user has this setting enabled.
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (2217 => 2218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2009-12-27 15:05:26 UTC (rev 2217)
+++ trunk/bp-xprofile.php        2009-12-27 20:01:21 UTC (rev 2218)
</span><span class="lines">@@ -718,6 +718,16 @@
</span><span class="cx"> function xprofile_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><ins>+        if ( 'new_at_mention' == $action ) {
+                $user_fullname = bp_core_get_user_displayname( $secondary_item_id );
+
+                if ( (int)$total_items &gt; 1 ) {
+                        return apply_filters( 'bp_xprofile_multiple_at_mentions_notification', '&lt;a href=&quot;' . bp_core_get_user_domain( $secondary_item_id ) . 'activity/&quot; title=&quot;' . __( 'View User', 'buddypress' ) . '&quot;&gt;' . sprintf( __( '%s mentioned you in %d updates', 'buddypress' ), $user_fullname, (int)$total_items ) . '&lt;/a&gt;', $total_items );
+                } else {
+                        return apply_filters( 'bp_xprofile_single_at_mention_notification', '&lt;a href=&quot;' . bp_activity_get_permalink( $item_id ) . '&quot; title=&quot;' . __( 'View Thread', 'buddypress' ) . '&quot;&gt;' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $user_fullname ) . '&lt;/a&gt;', $user_fullname );
+                }
+        }
+
</ins><span class="cx">         if ( 'new_wire_post' == $action ) {
</span><span class="cx">                 if ( (int)$total_items &gt; 1 ) {
</span><span class="cx">                         return apply_filters( 'bp_xprofile_multiple_new_wire_post_notification', '&lt;a href=&quot;' . $bp-&gt;loggedin_user-&gt;domain . $bp-&gt;wire-&gt;slug . '&quot; title=&quot;' . __( 'Wire', 'buddypress' ) . '&quot;&gt;' . sprintf( __( 'You have %d new posts on your wire', 'buddypress' ), (int)$total_items ) . '&lt;/a&gt;', $total_items );
</span><span class="lines">@@ -766,7 +776,7 @@
</span><span class="cx">         /* Now write the values */
</span><span class="cx">         $activity_id = xprofile_record_activity( array(
</span><span class="cx">                 'user_id' =&gt; $user_id,
</span><del>-                'content' =&gt; apply_filters( 'xprofile_activity_new_update', $activity_content ),
</del><ins>+                'content' =&gt; apply_filters( 'xprofile_activity_new_update_content', $activity_content ),
</ins><span class="cx">                 'primary_link' =&gt; apply_filters( 'xprofile_activity_new_update_primary_link', $primary_link ),
</span><span class="cx">                 'component_action' =&gt; 'new_wire_post'
</span><span class="cx">         ) );
</span><span class="lines">@@ -774,6 +784,8 @@
</span><span class="cx">         /* Add this update to the &quot;latest update&quot; usermeta so it can be fetched anywhere. */
</span><span class="cx">         update_usermeta( $bp-&gt;loggedin_user-&gt;id, 'bp_latest_update', array( 'id' =&gt; $activity_id, 'content' =&gt; wp_filter_kses( $content ) ) );
</span><span class="cx"> 
</span><ins>+        do_action( 'xprofile_posted_update', $content, $user_id, $activity_id );
+
</ins><span class="cx">         return $activity_id;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1128,9 +1140,12 @@
</span><span class="cx"> function xprofile_remove_screen_notifications() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><ins>+        bp_core_delete_notifications_for_user_by_type( $bp-&gt;loggedin_user-&gt;id, $bp-&gt;profile-&gt;id, 'new_at_mention' );
</ins><span class="cx">         bp_core_delete_notifications_for_user_by_type( $bp-&gt;loggedin_user-&gt;id, $bp-&gt;profile-&gt;id, 'new_wire_post' );
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_wire_screen_latest', 'xprofile_remove_screen_notifications' );
</span><ins>+add_action( 'bp_activity_screen_my_activity', 'xprofile_remove_screen_notifications' );
+add_action( 'bp_activity_screen_single_activity_permalink', 'xprofile_remove_screen_notifications' );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * xprofile_filter_template_paths()
</span></span></pre>
</div>
</div>

</body>
</html>