<!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] [2817] branches/1.2/bp-friends.php: Fixes #2090</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2817</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-03-08 15:20:50 +0000 (Mon, 08 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixes #2090</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpfriendsphp">branches/1.2/bp-friends.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpfriendsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-friends.php (2816 => 2817)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-friends.php        2010-03-08 15:05:25 UTC (rev 2816)
+++ branches/1.2/bp-friends.php        2010-03-08 15:20:50 UTC (rev 2817)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="cx">         // Delete any friendship acceptance notifications for the user when viewing a profile
</span><del>-        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'friends', 'friendship_accepted' );
</del><ins>+        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_accepted' );
</ins><span class="cx">
</span><span class="cx">         do_action( 'friends_screen_my_friends' );
</span><span class="cx">
</span><span class="lines">@@ -133,6 +133,9 @@
</span><span class="cx">
</span><span class="cx">         do_action( 'friends_screen_requests' );
</span><span class="cx">
</span><ins>+        if ( isset( $_GET['new'] ) )
+                bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_request' );
+
</ins><span class="cx">         bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -317,11 +320,11 @@
</span><span class="cx">
</span><span class="cx">                 case 'friendship_request':
</span><span class="cx">                         if ( (int)$total_items > 1 ) {
</span><del>-                                return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
</del><ins>+                                return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests/?new" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $user_fullname = bp_core_get_user_displayname( $item_id );
</span><span class="cx">                                 $user_url = bp_core_get_user_domain( $item_id );
</span><del>-                                return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
</del><ins>+                                return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests/?new" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
</ins><span class="cx">                         }
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="lines">@@ -362,7 +365,7 @@
</span><span class="cx">
</span><span class="cx">                 if ( !$force_accept ) {
</span><span class="cx">                         // Add the on screen notification
</span><del>-                        bp_core_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, 'friends', 'friendship_request' );
</del><ins>+                        bp_core_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, $bp->friends->id, 'friendship_request' );
</ins><span class="cx">
</span><span class="cx">                         // Send the email notification
</span><span class="cx">                         require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
</span><span class="lines">@@ -408,10 +411,10 @@
</span><span class="cx">                 friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
</span><span class="cx">
</span><span class="cx">                 /* Remove the friend request notice */
</span><del>-                bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, 'friends', 'friendship_request' );
</del><ins>+                bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
</ins><span class="cx">
</span><span class="cx">                 /* Add a friend accepted notice for the initiating user */
</span><del>-                bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, 'friends', 'friendship_accepted' );
</del><ins>+                bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_accepted' );
</ins><span class="cx">
</span><span class="cx">                 $initiator_link = bp_core_get_userlink( $friendship->initiator_user_id );
</span><span class="cx">                 $friend_link = bp_core_get_userlink( $friendship->friend_user_id );
</span><span class="lines">@@ -449,7 +452,7 @@
</span><span class="cx">
</span><span class="cx">         if ( !$friendship->is_confirmed && BP_Friends_Friendship::reject( $friendship_id ) ) {
</span><span class="cx">                 // Remove the friend request notice
</span><del>-                bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, 'friends', 'friendship_request' );
</del><ins>+                bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
</ins><span class="cx">
</span><span class="cx">                 do_action( 'friends_friendship_rejected', $friendship_id, &$friendship );
</span><span class="cx">                 return true;
</span><span class="lines">@@ -597,7 +600,7 @@
</span><span class="cx">         delete_usermeta( $user_id, 'total_friend_count' );
</span><span class="cx">
</span><span class="cx">         /* Remove friendship requests FROM user */
</span><del>-        bp_core_delete_notifications_from_user( $user_id, $bp->friends->slug, 'friendship_request' );
</del><ins>+        bp_core_delete_notifications_from_user( $user_id, $bp->friends->id, 'friendship_request' );
</ins><span class="cx">
</span><span class="cx">         do_action( 'friends_remove_data', $user_id );
</span><span class="cx"> }
</span><span class="lines">@@ -631,7 +634,7 @@
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="cx">         if ( isset($_GET['new']) )
</span><del>-                bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'friends', 'friendship_accepted' );
</del><ins>+                bp_core_delete_notifications_for_user_by_type( $bp->displayed_user->id, $bp->friends->id, 'friendship_accepted' );
</ins><span class="cx"> }
</span><span class="cx"> add_action( 'bp_activity_screen_my_activity', 'friends_clear_friend_notifications' );
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>