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.

Comments

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

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.

zengenuity’s picture

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;
}
nancydru’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks for the patch.

nancydru’s picture

Status: Fixed » Closed (fixed)

Included in 6.x-1.3

bfr’s picture

How about the same thing when filtering with user reference field?
Can it be done somehow?

johnhanley’s picture

@bfr, I second your request. I looked at this module for the first time today, but unfortunately it lacks user reference field support w/ exposed filters.

liquidcms’s picture

+1 on Realname use in userref exposed filter

nancydru’s picture

Open a new issue.

liquidcms’s picture

why, when it is the issue reported here?

nancydru’s picture

Because a) this issue is closed; you're lucky I even saw it, and b) it differs from the original request.