<!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] [1815] trunk: Fixes #974 props djpaul</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>1815</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-07 20:42:59 +0000 (Mon, 07 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #974 props djpaul</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpfriendsbpfriendsnotificationsphp">trunk/bp-friends/bp-friends-notifications.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsnotificationsphp">trunk/bp-groups/bp-groups-notifications.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesnotificationsphp">trunk/bp-messages/bp-messages-notifications.php</a></li>
<li><a href="#trunkbpxprofilebpxprofilenotificationsphp">trunk/bp-xprofile/bp-xprofile-notifications.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (1814 => 1815)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-09-07 19:51:46 UTC (rev 1814)
+++ trunk/bp-core.php        2009-09-07 20:42:59 UTC (rev 1815)
</span><span class="lines">@@ -845,10 +845,7 @@
</span><span class="cx">                 
</span><span class="cx">                 $ud = get_userdata( $user['users'][0]-&gt;user_id );
</span><span class="cx">                 
</span><del>-                if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) )
-                        bp_core_redirect( $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login );
-                else
-                        bp_core_redirect( $bp-&gt;root_domain . '/' . $ud-&gt;user_login );                        
</del><ins>+                bp_core_redirect( bp_core_get_user_domain( $user['users'][0]-&gt;user_id ) );                
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp', 'bp_core_get_random_member' );
</span><span class="lines">@@ -914,13 +911,8 @@
</span><span class="cx">         
</span><span class="cx">         if ( !is_numeric($uid) )
</span><span class="cx">                 return false;
</span><del>-        
-        $ud = get_userdata($uid);
-        
-        if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) )        
-                return apply_filters( 'bp_core_get_userurl', $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/' );
-        else
-                return apply_filters( 'bp_core_get_userurl', $bp-&gt;root_domain . '/' . $ud-&gt;user_login . '/' );        
</del><ins>+
+        return apply_filters( 'bp_core_get_userurl', bp_core_get_user_domain( $uid ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendsnotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-notifications.php (1814 => 1815)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-notifications.php        2009-09-07 19:51:46 UTC (rev 1814)
+++ trunk/bp-friends/bp-friends-notifications.php        2009-09-07 20:42:59 UTC (rev 1815)
</span><span class="lines">@@ -11,10 +11,10 @@
</span><span class="cx">         $ud = get_userdata( $friend_id );
</span><span class="cx">         $initiator_ud = get_userdata( $initiator_id );
</span><span class="cx">         
</span><del>-        $all_requests_link = site_url( BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/friends/requests/' );
-        $settings_link = site_url( BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications' );
</del><ins>+        $all_requests_link = bp_core_get_user_domain( $friend_id ) . 'friends/requests/';
+        $settings_link = bp_core_get_user_domain( $friend_id ) . 'settings/notifications';
</ins><span class="cx">         
</span><del>-        $initiator_link = site_url( BP_MEMBERS_SLUG . '/' . $initiator_ud-&gt;user_login . '/profile' );
</del><ins>+        $initiator_link = bp_core_get_user_domain( $initiator_id );
</ins><span class="cx"> 
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud-&gt;user_email;
</span><span class="lines">@@ -48,10 +48,9 @@
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><span class="cx">         $ud = get_userdata( $initiator_id );
</span><del>-        $friend_ud = get_userdata( $friend_id );
</del><span class="cx">         
</span><del>-        $friend_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $friend_ud-&gt;user_login;
-        $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+        $friend_link = bp_core_get_user_domain( $friend_id );
+        $settings_link = bp_core_get_user_domain( $initiator_id ) . 'settings/notifications'; 
</ins><span class="cx">                 
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud-&gt;user_email;
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsnotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-notifications.php (1814 => 1815)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-notifications.php        2009-09-07 19:51:46 UTC (rev 1814)
+++ trunk/bp-groups/bp-groups-notifications.php        2009-09-07 20:42:59 UTC (rev 1815)
</span><span class="lines">@@ -10,10 +10,9 @@
</span><span class="cx">         $group = new BP_Groups_Group( $group_id, false, true );
</span><span class="cx">         
</span><span class="cx">         $poster_name = bp_core_get_user_displayname( $wire_post-&gt;user_id );
</span><del>-        $poster_ud = get_userdata( $wire_post-&gt;user_id );
-        $poster_profile_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $poster_ud-&gt;user_login;
</del><ins>+        $poster_profile_link = bp_core_get_user_domain( $wire_post-&gt;user_id ); 
</ins><span class="cx"> 
</span><del>-        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New wire post on group: %s', 'buddypress' ), stripslashes($group-&gt;name) );
</del><ins>+        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New wire post on group: %s', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ) );
</ins><span class="cx"> 
</span><span class="cx">         foreach ( $group-&gt;user_dataset as $user ) {
</span><span class="cx">                 if ( 'no' == get_usermeta( $user-&gt;user_id, 'notification_groups_wire_post' ) ) continue;
</span><span class="lines">@@ -23,9 +22,9 @@
</span><span class="cx">                 // Set up and send the message
</span><span class="cx">                 $to = $ud-&gt;user_email;
</span><span class="cx"> 
</span><del>-                $wire_link = site_url() . '/' . $bp-&gt;groups-&gt;slug . '/' . $group-&gt;slug . '/wire';
-                $group_link = site_url() . '/' . $bp-&gt;groups-&gt;slug . '/' . $group-&gt;slug;
-                $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+                $wire_link = site_url( $bp-&gt;groups-&gt;slug . '/' . $group-&gt;slug . '/wire/' );
+                $group_link = site_url( $bp-&gt;groups-&gt;slug . '/' . $group-&gt;slug . '/' );
+                $settings_link = bp_core_get_user_domain( $user-&gt;user_id ) . 'settings/notifications/'; 
</ins><span class="cx"> 
</span><span class="cx">                 $message = sprintf( __( 
</span><span class="cx"> '%s posted on the wire of the group &quot;%s&quot;:
</span><span class="lines">@@ -39,7 +38,7 @@
</span><span class="cx"> To view %s\'s profile page: %s
</span><span class="cx"> 
</span><span class="cx"> ---------------------
</span><del>-', 'buddypress' ), $poster_name, stripslashes($group-&gt;name), stripslashes($wire_post-&gt;content), $wire_link, $group_link, $poster_name, $poster_profile_link );
</del><ins>+', 'buddypress' ), $poster_name, stripslashes( attribute_escape( $group-&gt;name ) ), stripslashes($wire_post-&gt;content), $wire_link, $group_link, $poster_name, $poster_profile_link );
</ins><span class="cx"> 
</span><span class="cx">                 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
</span><span class="cx"> 
</span><span class="lines">@@ -64,8 +63,8 @@
</span><span class="cx">                 // Set up and send the message
</span><span class="cx">                 $to = $ud-&gt;user_email;
</span><span class="cx"> 
</span><del>-                $group_link = site_url() . '/' . $bp-&gt;groups-&gt;slug . '/' . $group-&gt;slug;
-                $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+                $group_link = site_url( $bp-&gt;groups-&gt;slug . '/' . $group-&gt;slug );
+                $settings_link = bp_core_get_user_domain( $user-&gt;user_id ) . 'settings/notifications/';
</ins><span class="cx"> 
</span><span class="cx">                 $message = sprintf( __( 
</span><span class="cx"> 'Group details for the group &quot;%s&quot; were updated:
</span><span class="lines">@@ -73,7 +72,7 @@
</span><span class="cx"> To view the group: %s
</span><span class="cx"> 
</span><span class="cx"> ---------------------
</span><del>-', 'buddypress' ), stripslashes($group-&gt;name), $group_link );
</del><ins>+', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ), $group_link );
</ins><span class="cx"> 
</span><span class="cx">                 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
</span><span class="cx"> 
</span><span class="lines">@@ -99,12 +98,12 @@
</span><span class="cx">         $requesting_ud = get_userdata($requesting_user_id);
</span><span class="cx"> 
</span><span class="cx">         $group_requests = bp_get_group_permalink( $group ) . '/admin/membership-requests';
</span><del>-        $profile_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $requesting_ud-&gt;user_login . '/profile';
-        $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+        $profile_link = bp_core_get_user_domain( $requesting_user_id );
+        $settings_link = bp_core_get_user_domain( $requesting_user_id ) . 'settings/notifications/';
</ins><span class="cx"> 
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud-&gt;user_email;
</span><del>-        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group: %s', 'buddypress' ), stripslashes($group-&gt;name) );
</del><ins>+        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group: %s', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ) );
</ins><span class="cx"> 
</span><span class="cx"> $message = sprintf( __( 
</span><span class="cx"> '%s wants to join the group &quot;%s&quot;.
</span><span class="lines">@@ -117,7 +116,7 @@
</span><span class="cx"> To view %s\'s profile: %s
</span><span class="cx"> 
</span><span class="cx"> ---------------------
</span><del>-', 'buddypress' ), $requesting_user_name, stripslashes($group-&gt;name), $group_requests, $requesting_user_name, $profile_link );
</del><ins>+', 'buddypress' ), $requesting_user_name, stripslashes( attribute_escape( $group-&gt;name ) ), $group_requests, $requesting_user_name, $profile_link );
</ins><span class="cx"> 
</span><span class="cx">         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
</span><span class="cx"> 
</span><span class="lines">@@ -142,30 +141,30 @@
</span><span class="cx">         $ud = get_userdata($requesting_user_id);
</span><span class="cx"> 
</span><span class="cx">         $group_link = bp_get_group_permalink( $group );
</span><del>-        $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+        $settings_link = bp_core_get_user_domain( $requesting_user_id ) . 'settings/notifications/';
</ins><span class="cx"> 
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud-&gt;user_email;
</span><span class="cx">         
</span><span class="cx">         if ( $accepted ) {
</span><del>-                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group &quot;%s&quot; accepted', 'buddypress' ), stripslashes($group-&gt;name) );
</del><ins>+                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group &quot;%s&quot; accepted', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ) );
</ins><span class="cx">                 $message = sprintf( __( 
</span><span class="cx"> 'Your membership request for the group &quot;%s&quot; has been accepted.
</span><span class="cx"> 
</span><span class="cx"> To view the group please login and visit: %s
</span><span class="cx"> 
</span><span class="cx"> ---------------------
</span><del>-', 'buddypress' ), stripslashes($group-&gt;name), $group_link );
</del><ins>+', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ), $group_link );
</ins><span class="cx">                 
</span><span class="cx">         } else {
</span><del>-                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group &quot;%s&quot; rejected', 'buddypress' ), stripslashes($group-&gt;name) );
</del><ins>+                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'Membership request for group &quot;%s&quot; rejected', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ) );
</ins><span class="cx">                 $message = sprintf( __( 
</span><span class="cx"> 'Your membership request for the group &quot;%s&quot; has been rejected.
</span><span class="cx"> 
</span><span class="cx"> To submit another request please log in and visit: %s
</span><span class="cx"> 
</span><span class="cx"> ---------------------
</span><del>-', 'buddypress' ), stripslashes($group-&gt;name), $group_link );
</del><ins>+', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ), $group_link );
</ins><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
</span><span class="lines">@@ -195,12 +194,12 @@
</span><span class="cx">         $ud = get_userdata($user_id);
</span><span class="cx"> 
</span><span class="cx">         $group_link = bp_get_group_permalink( $group );
</span><del>-        $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+        $settings_link = bp_core_get_user_domain( $user_id ) . 'settings/notifications/';
</ins><span class="cx"> 
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud-&gt;user_email;
</span><span class="cx"> 
</span><del>-        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'You have been promoted in the group: &quot;%s&quot;', 'buddypress' ), stripslashes($group-&gt;name) );
</del><ins>+        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'You have been promoted in the group: &quot;%s&quot;', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ) );
</ins><span class="cx"> 
</span><span class="cx">         $message = sprintf( __( 
</span><span class="cx"> 'You have been promoted to %s for the group: &quot;%s&quot;.
</span><span class="lines">@@ -208,7 +207,7 @@
</span><span class="cx"> To view the group please visit: %s
</span><span class="cx"> 
</span><span class="cx"> ---------------------
</span><del>-', 'buddypress' ), $promoted_to, stripslashes($group-&gt;name), $group_link );
</del><ins>+', 'buddypress' ), $promoted_to, stripslashes( attribute_escape( $group-&gt;name ) ), $group_link );
</ins><span class="cx"> 
</span><span class="cx">         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
</span><span class="cx"> 
</span><span class="lines">@@ -220,9 +219,9 @@
</span><span class="cx"> function groups_notification_group_invites( &amp;$group, &amp;$member, $inviter_user_id ) {
</span><span class="cx">         global $bp;
</span><span class="cx">         
</span><del>-        $inviter_ud = get_userdata($inviter_user_id);
</del><ins>+        $inviter_ud = get_userdata( $inviter_user_id );
</ins><span class="cx">         $inviter_name = bp_core_get_userlink( $inviter_user_id, true, false, true );
</span><del>-        $inviter_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $inviter_ud-&gt;user_login;
</del><ins>+        $inviter_link = bp_core_get_user_domain( $inviter_user_id );
</ins><span class="cx">         
</span><span class="cx">         $group_link = bp_get_group_permalink( $group );
</span><span class="cx">         
</span><span class="lines">@@ -236,14 +235,15 @@
</span><span class="cx">                         return false;
</span><span class="cx"> 
</span><span class="cx">                 $invited_ud = get_userdata($invited_user_id);
</span><del>-                $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $invited_ud-&gt;user_login . '/settings/notifications';
-                $invited_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $invited_ud-&gt;user_login;
</del><ins>+                
+                $settings_link = bp_core_get_user_domain( $invited_user_id ) . 'settings/notifications/';
+                $invited_link = bp_core_get_user_domain( $invited_user_id );
</ins><span class="cx">                 $invites_link = $invited_link . '/' . $bp-&gt;groups-&gt;slug . '/invites';
</span><span class="cx"> 
</span><span class="cx">                 // Set up and send the message
</span><span class="cx">                 $to = $invited_ud-&gt;user_email;
</span><span class="cx"> 
</span><del>-                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'You have an invitation to the group: &quot;%s&quot;', 'buddypress' ), stripslashes($group-&gt;name) );
</del><ins>+                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'You have an invitation to the group: &quot;%s&quot;', 'buddypress' ), stripslashes( attribute_escape( $group-&gt;name ) ) );
</ins><span class="cx"> 
</span><span class="cx">                 $message = sprintf( __( 
</span><span class="cx"> 'One of your friends %s has invited you to the group: &quot;%s&quot;.
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx"> To view %s\'s profile visit: %s
</span><span class="cx"> 
</span><span class="cx"> ---------------------
</span><del>-', 'buddypress' ), $inviter_name, stripslashes($group-&gt;name), $invites_link, $group_link, $inviter_name, $inviter_link );
</del><ins>+', 'buddypress' ), $inviter_name, stripslashes( attribute_escape( $group-&gt;name ) ), $invites_link, $group_link, $inviter_name, $inviter_link );
</ins><span class="cx"> 
</span><span class="cx">                 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesnotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-notifications.php (1814 => 1815)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-notifications.php        2009-09-07 19:51:46 UTC (rev 1814)
+++ trunk/bp-messages/bp-messages-notifications.php        2009-09-07 20:42:59 UTC (rev 1815)
</span><span class="lines">@@ -11,13 +11,13 @@
</span><span class="cx">         for ( $i = 0; $i &lt; count($recipient_ids); $i++ ) {
</span><span class="cx">                 if ( $message-&gt;sender_id == $recipient_ids[$i] || 'no' == get_userdata( $recipient_ids[$i], 'notification-messages-new-message' ) ) continue;
</span><span class="cx"> 
</span><del>-                $ud = get_userdata($recipient_ids[$i]);
-                $message_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/messages/view/' . $message-&gt;id;
-                $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+                $ud = get_userdata( $recipient_ids[$i] );
+                $message_link = bp_core_get_user_domain( $recipient_ids[$i] ) . 'messages/view/' . $message-&gt;id; 
+                $settings_link = bp_core_get_user_domain( $recipient_ids[$i] ) . 'settings/notifications'; 
</ins><span class="cx">                 
</span><span class="cx">                 // Set up and send the message
</span><span class="cx">                 $to = $ud-&gt;user_email;
</span><del>-                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), stripslashes($sender_name) );
</del><ins>+                $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), stripslashes( $sender_name ) );
</ins><span class="cx"> 
</span><span class="cx">                 $content = sprintf( __( 
</span><span class="cx"> '%s sent you a new message:
</span><span class="lines">@@ -39,43 +39,42 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-/* This is too expensive to send on normal servers uncomment at your own risk. */
</del><ins>+/* This is too expensive to send on normal servers uncomment action at your own risk. */
+function messages_notification_new_notice( $message_subject, $message ) {
+        global $bp, $wpdb;
</ins><span class="cx"> 
</span><del>-// function messages_notification_new_notice( $message_subject, $message ) {
-//         global $bp, $wpdb;
-// 
-//         $users = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT ID as user_id, user_email, user_login FROM {$wpdb-&gt;base_prefix}users WHERE user_status = 0 AND spam = 0 AND deleted = 0&quot; ) );
-//         
-//         for ( $i = 0; $i &lt; count($users); $i++ ) {
-//                 if ( get_userdata( $users[$i]-&gt;user_id, 'notification-messages-new-notice' ) == 'no' ) continue;
-// 
-//                 $message_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $users[$i]-&gt;user_login . '/messages';
-//                 $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $users[$i]-&gt;user_login . '/settings/notifications';
-// 
-//                 // Set up and send the message
-//                 $to = $users[$i]-&gt;user_email;
-//                 $subject = __( 'New Site Notice', 'buddypress' );
-// 
-//                 $message = sprintf( __( 
-// 'A new site notice has been posted on %s:
-// 
-// &quot;%s: %s&quot;
-// 
-// To view the notice: %s
-// 
-// ---------------------
-// ', 'buddypress' ), get_blog_option( BP_ROOT_BLOG, 'blogname' ), stripslashes( strip_tags( $message_subject ) ), stripslashes( strip_tags( $message ) ), $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 );
-//                 
-//                 unset($message);
-//                 unset($subject);
-//                 unset($to);
-//         }
-// }
</del><ins>+        $users = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT ID as user_id, user_email, user_login FROM {$wpdb-&gt;base_prefix}users WHERE user_status = 0 AND spam = 0 AND deleted = 0&quot; ) );
+        
+        for ( $i = 0; $i &lt; count($users); $i++ ) {
+                if ( get_userdata( $users[$i]-&gt;user_id, 'notification-messages-new-notice' ) == 'no' ) continue;
+
+                $message_link = bp_core_get_user_domain( $users[$i]-&gt;user_id ) . 'messages'; 
+                $settings_link = bp_core_get_user_domain( $users[$i]-&gt;user_id ) . 'settings/notifications'; 
+
+                // Set up and send the message
+                $to = $users[$i]-&gt;user_email;
+                $subject = __( 'New Site Notice', 'buddypress' );
+
+                $message = sprintf( __( 
+'A new site notice has been posted on %s:
+
+&quot;%s: %s&quot;
+
+To view the notice: %s
+
+---------------------
+', 'buddypress' ), get_blog_option( BP_ROOT_BLOG, 'blogname' ), stripslashes( wp_filter_kses( $message_subject ) ), stripslashes( wp_filter_kses( $message ) ), $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 );
+                
+                unset($message);
+                unset($subject);
+                unset($to);
+        }
+}
</ins><span class="cx"> // add_action( 'bp_messages_notice_sent', 'messages_notification_new_notice', 10, 2 );
</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="trunkbpxprofilebpxprofilenotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-notifications.php (1814 => 1815)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-notifications.php        2009-09-07 19:51:46 UTC (rev 1814)
+++ trunk/bp-xprofile/bp-xprofile-notifications.php        2009-09-07 20:42:59 UTC (rev 1815)
</span><span class="lines">@@ -27,10 +27,10 @@
</span><span class="cx">                 if ( !get_usermeta( $user_id, 'notification_profile_wire_post' ) || 'yes' == get_usermeta( $user_id, 'notification_profile_wire_post' ) ) {
</span><span class="cx">                         $poster_name = bp_core_get_user_displayname( $poster_id );
</span><span class="cx">                         $wire_post = new BP_Wire_Post( $bp-&gt;profile-&gt;table_name_wire, $wire_post_id, true );
</span><del>-                        $ud = get_userdata($user_id);
</del><ins>+                        $ud = get_userdata( $user_id );
</ins><span class="cx">                         
</span><del>-                        $wire_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/wire';
-                        $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/settings/notifications';
</del><ins>+                        $wire_link = bp_core_get_user_domain( $user_id ) . 'wire';
+                        $settings_link = bp_core_get_user_domain( $user_id ) . 'settings/notifications';
</ins><span class="cx">                         
</span><span class="cx">                         // Set up and send the message
</span><span class="cx">                         $to = $ud-&gt;user_email;
</span></span></pre>
</div>
</div>

</body>
</html>