Currently, the "friends of" argument in Views restricts results to only show content from the argument-user's friends. However, it would be nice to also be able to show content from the argument-user himself, for example a stream of status updates from this user and his friends.

There's also a problem that including $this->ensure_my_table() causes an extra (unnecessary) join. dww explained to me in IRC today that this is due to the difference between explicit and implicit joins in Views... basically the argument already has an implicit join so it doesn't need the explicit one that's added by "ensuring" the table. This is a problem because it produces multiple copies of the same content when the content is from the user who initiated the friendship.

Patch attached. I'm not quite sure what happens if the Allow multiple terms per argument setting is enabled, but other than that it's working for me.

Comments

marcoBauli’s picture

as far as i can see this is only for "user" kind of views, as the "friend of"argument does not appear in other kinds of views.

So this can be in no way a solution to create list of content by friends using views module. Correct?

icecreamyou’s picture

You can already create a list of content by friends using Views, but that is unrelated to this issue. This issue assumes you already know how to do that, and it offers a patch to allow the current user's content to show up in that view as well. It is not only for User views. Please keep the issue on topic.

marcoBauli’s picture

The purpose of the patch here is to "show content from the argument-user's friends and argument-user himself". As such argument is not allowed in *node* views (only user views) the patch looks wrong to me.

icecreamyou’s picture

"show content" == it works with nodes or anything else. I am personally using it in Facebook-style Statuses views. The patch is not intended to work magic for your specific view to suddenly do whatever you want it to do if you designed the view wrong. All it does is add the argument user's content to whatever content is already being shown if you are using the argument the patch is for and if your view already works.

You are expecting something totally different and very much off-topic.

icecreamyou’s picture

I forgot a line in the patch. The first line in the options_form() function needs to be this:

parent::options_form($form, $form_state);
sirkitree’s picture

Here is a re-roll of the patch with the proposed changes. If I can get someone else to test this out on their view and mark it RTBC I'll commit it. Thanks!

liliplanet’s picture

StatusFileSize
new42.63 KB
new10.21 KB

Hi,

So wonderful now have the FB status and FBMP playing together, and now unfortunately still struggling with flag friend.

Please see attached view and screenshot of the argument.

$account = user_load(array('name' => $argument));
if ($account->uid) {
  $handler->argument = $account->uid;
  return TRUE;
}
return FALSE;

I've tried the filter Facebook-style Statuses: Content from flagged users or the current user, but then only shows current user status.

So much closer to getting this right and will most appreciate any help just to finalize the flag friend please.

Lilian

icecreamyou’s picture

What is the query that your view generates?

liliplanet’s picture

Thank you so much Icecreamyou :)

SELECT users.uid AS uid,
   facebook_status.pid AS facebook_status_pid,
   facebook_status.uid AS facebook_status_uid,
   facebook_status.status AS facebook_status_status,
   facebook_status.sid AS facebook_status_sid,
   facebook_status.status_time AS facebook_status_status_time,
   fbsmp.sid AS fbsmp_sid,
   fbsmp.type AS fbsmp_type,
   fbsmp.data AS fbsmp_data
 FROM main_users users 
 LEFT JOIN main_flag_content flag_content_users ON users.uid = flag_content_users.uid AND (flag_content_users.fid = 20 AND flag_content_users.uid = ***CURRENT_USER***)
 INNER JOIN main_facebook_status facebook_status ON users.uid = facebook_status.uid
 LEFT JOIN main_fbsmp fbsmp ON facebook_status.sid = fbsmp.sid
    ORDER BY facebook_status_status_time DESC
icecreamyou’s picture

Are you sure that's it? And for the same view you exported? You're missing the WHERE statements represented by all filters and arguments.

However your problem is probably that you have "By current user" checked in your Relationship instead of "By any user."

This patch is working for me, by the way, but I probably shouldn't be the one to mark it RTBC since I wrote the original.

liliplanet’s picture

StatusFileSize
new35.18 KB

I think I got it! So appreciated Icecreamyou :)

Instead of the php argument, simply validate by 'user id from logged in user'.

Attached screenshot.

icecreamyou’s picture

Status: Needs review » Reviewed & tested by the community

Good. I take it that means this is working.

mazdakaps’s picture

hello this patch works for flag friend 2 too?

sirkitree’s picture

Flag Friend 2 is a mess and is now unsupported, so no, I doubt it will work for 2.x.

Waiting on git conversion to commit anything else, but this'll be first or second on my list :)

sirkitree’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

sirkitree’s picture

Status: Fixed » Patch (to be ported)

Let's make sure we get this in 7

sirkitree’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.