--- /Users/mjo/Desktop/activity/contrib/user_relationshipsactivity/user_relationshipsactivity.module 2008-01-21 09:47:31.000000000 -0500 +++ ./user_relationshipsactivity.module 2008-02-28 22:29:34.000000000 -0500 @@ -161,3 +161,24 @@ function user_relationshipsactivity_user activity_insert('user_relationshipsactivity', $type, $operation, $data, $target_users_roles); } } + + +function user_relationshipsactivity_activityapi($activity, $op) { + if($op == 'insert') { + $author = $activity['data']['author-uid']; + //Load the users relationships + $relationships = user_relationships_load_relationships(array('uid' => $author)); + foreach($relationships as $key => $relationship) { + //If the requester is the user, enter the uid of their friend(the requestee) + if($relationship->requester_id == $author) { + db_query("INSERT INTO {activity_targets} (aid, target_uid, target_role) + VALUES (%d, %d, 'all')", $activity['aid'], $relationship->requestee_id); + } + //If the requestee is the user, enter the uid of their friend(the requester) + if($relationship->requestee_id == $author) { + db_query("INSERT INTO {activity_targets} (aid, target_uid, target_role) + VALUES (%d, %d, 'all')", $activity['aid'], $relationship->requester_id); + } + } + } +}