Hi there.

I've spent ages trying to work this out, and I feel like I'm going around in circles a bit .. any pointers would be very much appreciated. I'm sure it's really easy and I'm just being stupid ...

The aim is to display user pictures in the topic list for any given forum. The view being called/displayed is "advanced_forum_topic_list". Precisely, for each row, next to the "topic" and "last post" fields, the user pictures should be displayed - two for each row.

I'm presuming I need to bash some code together to achieve this, but I can't figure out what to hook into ... ?

This is probably really obvious ... any help would be really great.

Thanks, Aaron.

Comments

just_fixed_it’s picture

So .... I'm guessing from the fact that no-one has replied that adding user pictures to the topic page is not easy to do.

Does nobody have any ideas about the most efficient way to go about doing this?

Michelle’s picture

Well, that and the fact that I've been at DrupalCon and not a whole lot of time for support. Getting the picture of the person who posted the topic isn't bad. You can just do that in the Views UI by adding another field. Adding the picture of the last person to reply is harder... You might be able to do it with a relationship but I'm not sure. At any rate, it's harder than I can delve into any time soon.

Will leave this active since that was a half-assed answer and maybe someone else may chime in.

Michelle

just_fixed_it’s picture

Michelle, I hope you had a great time at DrupalCon. Does it count as work or play? Or a bit of both?

Thanks very much for taking the time to reply to my question. I'll take a closer look to see if I can do this in the Views UI although I do find doing anything advanced in Views very confusing. If anyone has any suggestions on how to get the 'last person reply' picture in Views ...

Thans once again for your help, Aaron.

Michelle’s picture

Well, Drupal is a hobby so I guess I'd have to say play. But educational play. :)

Adding a picture of the person who started the topic isn't hard. Just add a new field and choose user picture. The last person to reply one I would have to try and see. I think you could set a relationship to do it but am not entirely sure.

Michelle

Michelle’s picture

Status: Active » Closed (won't fix)

Sorry, but I'm too swamped to put the time into this that I'd need to. And no one else has chimed in during the more than a month it's been open.

Michelle

just_fixed_it’s picture

Status: Closed (won't fix) » Active

Hi Michelle.

If you have a few moments would you mind having a quick look at what I've come up with. It may be completely the wrong way to go about it ... but it seeeems to be working, and with a litle tidying up it could possibly be useful to others with similar requirements:

I reckon I may have a solution to my problem which essentially boils down to how to make the last comment author user picture accessible to a view of type 'node' (the existing relationship available to views of type 'comment' will not work for the topic list view, which is of type 'node'). In my custom module views file (MYMODULE.views.inc) I add this hook implementation

function MYMODULE_views_data() {
  $data['node_comment_statistics'] = array(
    'last_comment_uid' => array(
      'title' => t('Last comment author CUSTOM'),
      'help' => t('My field.'), 
      'field' => array( 'handler' => 'views_handler_field', 'click sortable' => FALSE, ),
			'relationship' => array(	'base' => 'users',
			'base field' => 'uid',
			'handler' => 'views_handler_relationship',
			'label' => t('Last comment user'), ),
    ),
}

Inside the Views UI I now set a relationship of type ''Node: Last comment author CUSTOM', and then add a field 'User: Picture' using the above custom relationship. And by some magic hackery it seems to work. Painfully, deceptively simple after digging around for ages, and banging my head against the table repeatedly. There seems to be very little in the way of examples for doing this kind of thing with views .. maybe this will come in handy for someone else.

Any comments on the above?

Michelle’s picture

I've been sick in bed for a couple of days and honestly don't think I'll have the brainpower to make sense of that any time soon.

Michelle

just_fixed_it’s picture

No worries ... look after yourself, and get well soon.

just_fixed_it’s picture

I just noticed that I seem to have missed out the vital return statement in the function, ie.

    return $data;

Doh! I think my brainpower may be lacking a little just now as well ;-)

"I reckon being ill is one of the great pleasures of life, provided one is not too ill and is not obliged to work till one is better. " ~Samuel Butler, The Way of All Flesh, 1903

I hope you feel better soon, Aaron

Michelle’s picture

Status: Active » Closed (won't fix)

Sorry I never was much help with this. I didn't start getting better until August and never really got back to AF.