Support Views FILTER
| Project: | RealName |
| Version: | 6.x-1.2 |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
When I choose username in the views 'fields' section, the realname automatically displays instead.
But when I do the same thing in the 'filter' section, Views still utilises the username.
As a workaround, I tried adding the realname profile field into the filter instead, but Views seems
to crash at the moment when adding any profile fields to either the 'fields' or 'filter' section.
Actually, come to think of it, it's not the realname profile that breaking Views is it?
Anyway, I don't know if you're still considering support requests for D6, since D7 will probably
use separate username and display name, but my site's going to be using D6 for two more years,
so I thought there's no harm in asking.
Cheers.

#1
First, I don't have a lot of hope for decent core support like this in D7. The core maintainers keep pointing to contributed modules like RealName.
I can try looking at the Views stuff, but I must admit that I am not a Views guru and usually get lost when I look at that code.
If some Views guru comes along, a patch would be wonderful.
#2
I'm not totally sure what the original poster was looking for, but I needed a quick way to add an exposed Realname filter in a view, and I was able to get it just by adding a short bit of code to realname.views.inc. Here's the whole function, with my small addition noted.
function realname_views_data() {
$tables['realname'] = array(
'table' => array(
'group' => t('Realname'),
'join' => array(
'users' => array(
'field' => 'uid',
'left_field' => 'uid'
)
),
),
'uid' => array(
'title' => t('Uid'),
'help' => t('The user ID'), // The help that appears on the UI,
'argument' => array(
'handler' => 'realname_handler_argument_user_uid',
),
'filter' => array(
'title' => t('User Realname'),
'handler' => 'realname_handler_filter_user_name',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'realname' => array(
'title' => t('Name'), // The item it appears as on the UI,
'help' => t('The user or author name.'), // The help that appears on the UI,
'field' => array(
'handler' => 'realname_handler_field_user_name',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
/** My addition begins here. **/
'filter' => array(
'handler' => 'views_handler_filter_string',
),
/** Ends here. **/
),
);
return $tables;
}
#3
Thanks for the patch.
#4
Included in 6.x-1.3
#5
How about the same thing when filtering with user reference field?
Can it be done somehow?