I'm not sure if this is related to other views issues such as https://drupal.org/node/1373896 but here goes.

I'm using the statuses on user profile pages and I'd like to modify the fields. I want for example to display a user photo but not the core profile one. So I modify the statuses_stream view and try to add a new field. The field is not there so I add a relationship (Statuses Comments: Users). I see now that I have all my custom user fields to play with but there's 2 issues when I view the saved result:

  1. User photo is visible but only for the user who created the status. Users who commented don't have a photo.
  2. Results are duplicate. And not just that - there's only one status that displays twice (plus comments). Other statutes have disappeared somewhere.

Usually this sort of thing 'just works' so I'm thinking something is not fully supported? Or am I doing something wrong?

Comments

icecreamyou’s picture

Status: Active » Fixed

The relationship you added doesn't do what you think it does. Take a look at the SQL query it generates (you can see it while editing the view -- might need to enable a setting on the Tools page). You're probably JOINing on the comment author UID, which would reduce the results to only those with comments, and display one copy of a status for each comment it has.

I am not sure which photo you are trying to get to display. If what you are trying to do is display users' photos next to the comments they write on status updates, there is actually a setting for that (Show user pictures on comments). If you are trying to show a picture related to the status author, you may want to look at the Statuses: Users relationship if it's not already added.

-Mania-’s picture

Thanks for the quick response.

I am not sure which photo you are trying to get to display.

I've added a custom image field in the user account settings.

If what you are trying to do is display users' photos next to the comments they write on status updates, there is actually a setting for that (Show user pictures on comments).

This only works if one uses the core 'user pictures'.

If you are trying to show a picture related to the status author, you may want to look at the Statuses: Users relationship if it's not already added.

These are the relationships available in views:

  • Statuses Comments: Statuses
  • Statuses Comments: Users
  • User: Content authored
  • User: Representative node

I think you are referring to the "Statuses Comments: Users" relationship which as explained previously brings up all my custom fields to use but creates duplicates and doesn't really work. This is easy to test: have the default views and just add this one relationship and save.

icecreamyou’s picture

I still don't really get what you are trying to do. I am really not trying to be insultingly simplistic, but:

Conceptually, there is a view.

--------------------
| View             |
|                  |
|                  |
|                  |
|                  |
|                  |
--------------------

The view shows statuses.

--------------------
| View             |
|                  |
| [ status 1 ]     |
| [ status 2 ]     |
| [ status 3 ]     |
|                  |
--------------------

Completely separately from this concept, when a status is displayed, comments are displayed with it. The comments are not part of the view; they are completely unrelated. You cannot change how the comments display by changing the view.

Now, each status has a sender and a recipient, which are sometimes the same user. Additionally, each comment has an author. Next to each status you can display the sender's or recipient's picture. Additionally, next to each comment, you can display the comment author's picture.

If you want to display information about the status sender or recipient other than their avatar, such as a Profile module field you added to the user account, you can do so by adding a User field to the view.

If you want to display information about the authors of comments on statuses next to the comments they authored, such as a Profile module field you added to the user account, the only way to do so is by overriding the theme function(s) that are used to render status comment threads.

-Mania-’s picture

I still don't really get what you are trying to do.

Simply put I want to display other fields than what the default statuses_stream view provides me. E.g. a user photo, age, city or whatever custom fields I might have.

If you want to display information about the status sender or recipient other than their avatar, such as a Profile module field you added to the user account, you can do so by adding a User field to the view.

You mean a user relationship? You keep saying this but it doesn't work as mentioned a couple of times now.

In any case as I'd like to have a consistent look for both the statuses and comments using my custom fields it looks like the only way is to do a module/theme override. If you could point me to the specific function(s) to use with perhaps a simple example I'd appreciate it.

icecreamyou’s picture

You mean a user relationship? You keep saying this but it doesn't work as mentioned a couple of times now.

I don't know how to explain this more clearly. You cannot change how status comments look by changing the view. Changing the view can only affect how the status itself looks.

In any case as I'd like to have a consistent look for both the statuses and comments using my custom fields it looks like the only way is to do a module/theme override. If you could point me to the specific function(s) to use with perhaps a simple example I'd appreciate it.

I already gave you the links you need in #3: documentation on overriding theme functions and the function you probably want to override is theme_fbss_comments_item().

-Mania-’s picture

I don't know how to explain this more clearly. You cannot change how status comments look by changing the view. Changing the view can only affect how the status itself looks.

Yea, well you can't even change the status itself if using custom fields. Views is supposed to enable you to make your own queries yet there's very little you can do with this view.

I already gave you the links you need in #3: documentation on overriding theme functions and the function you probably want to override is theme_fbss_comments_item().

Okay thanks, I'll see what I can come up with.

icecreamyou’s picture

Yea, well you can't even change the status itself if using custom fields. Views is supposed to enable you to make your own queries yet there's very little you can do with this view.

You can change anything you want about the status itself by changing the View. It's not any different than any other view except that the fields are arranged using the last field ("Global: Custom text") to provide some structural markup. But you should just be careful what you're doing with Relationships if you don't actually understand how they are changing the underlying query.

Status: Fixed » Closed (fixed)

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

jaimealsilva’s picture

Version: 7.x-1.0-beta1 » 7.x-1.0-beta2
Status: Closed (fixed) » Active

Hello.

I'm reopening this bug because I'm having the same issue.

I can see in the query that the users table is joined but I can not add any custom user profile field to the view, I only can access the properties or columns from the users table. The fields added by the Field API are not available.

I'm suspecting somethins is wrong on the hook_views_data().

icecreamyou’s picture

Version: 7.x-1.0-beta2 » 7.x-1.0-beta1
Status: Active » Closed (fixed)

Different question, please open a separate issue