Showing and filtering on uid isn't very useful so I wanted to add usernames. After some reading it turned out to be very simple:

I edited support_views.views.inc and added this:

   // Assigned
   $data['support_ticket']['assigned'] = array(
     'title' => t('Assigned ID'),
     'help' => t('The Assigned ID of the ticket.'),
     'relationship' => array(
       'base' => 'users',
       'field' => 'uid',
       'handler' => 'views_handler_relationship',
       'label' => t('Assigned user'),
     ),

That is, I added the relationship part. Then I add that relationship in the view and it lets me both show and filter on usernames.

Hope it's useful to someone.

CommentFileSizeAuthor
#3 support_views.patch620 bytestoby.batch

Comments

de3pimpact’s picture

Would it be possible to add a field based on the assigned user? When I add a field in Views, I could not select Assigned user, but only Assigned ID.

If I used your method above, what are the things I need to add in fields for Views and relationship to show the Assigned username instead of the assigned user ID?

Thanks

downtap’s picture

de3pimpact:

To clarify, here are the steps:
- Add code above
- Clear cache
- Go into your view
- Under relationships, add Support Tickets: Assigned ID relationship
- In your fields, and User: Name with a Relationship of Assigned user

toby.batch’s picture

StatusFileSize
new620 bytes

I have a patch that allows the assigned user to be included as an association. It's basically your code but I've patchified it and added a sort handler.

de3pimpact’s picture

Hi downtap

It is working now.

Thanks for the clarification.

rsevero’s picture

Status: Needs review » Reviewed & tested by the community

Using the patch by toby.batch at #3 in one production site. Works as expected.

MisterSpeed’s picture

Status: Reviewed & tested by the community » Fixed

Committed; thanks !

Status: Fixed » Closed (fixed)

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

Sizzly’s picture

Okay. I added that code at the end of the file and it broke my site. Where should I add it? Replace the existing bit? Please help.

MisterSpeed’s picture

Sizzly: just download the -dev version currently listed on the page, it already includes the patch.