I had a really strange bug in a multisite environment. In a buddypress group, all media navigation tabs worked fine except for one: Albums.
Click on the albums tab would display albums from a number of groups, and in another blog!!!
It took a lot of head scratching but finally I found the solution:
In app/helper/RTMediaModel.php
On line 217:
$sql = "SELECT * FROM {$this->table_name} WHERE id IN(SELECT DISTINCT (album_id) FROM {$this->table_name} WHERE context_id = $group_id AND album_id IS NOT NULL AND media_type != 'album' AND context = 'group') OR (media_type = 'album' AND context_id = $group_id AND context = 'group')";
I added
AND blog_id = ".get_current_blog_id()."
So that line 217 now looks like this:
$sql = "SELECT * FROM {$this->table_name} WHERE id IN(SELECT DISTINCT (album_id) FROM {$this->table_name} WHERE context_id = $group_id AND album_id IS NOT NULL AND media_type != 'album' AND context = 'group' AND blog_id = ".get_current_blog_id().") OR (media_type = 'album' AND context_id = $group_id AND context = 'group')";