=== modified file 'modules/realname/realname.install'
--- modules/realname/realname.install	2009-03-05 16:02:45 +0000
+++ modules/realname/realname.install	2009-03-06 11:55:41 +0000
@@ -11,6 +11,30 @@
 //********************************************************************
 //* Drupal Hooks
 //********************************************************************
+/**
+ * Implementation of hook_schema().
+ */
+function realname_schema() {
+  $schema['realname_calculated_realname'] = array(
+    'fields' => array(
+         'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+         'realname' => array('type' => 'varchar', 'length' => '254', 'not null' => TRUE),
+        ),
+    'indexes' => array(
+         'uid' => array('uid'),
+         'realname' => array('realname')
+        ),
+  );
+  return $schema;
+}
+
+/**
+ * Implementation of hook_install().
+ */
+function realname_install() {
+  drupal_install_schema('realname');
+}
+
 
 /**
  * Implementation of hook_enable().
@@ -34,6 +58,8 @@
   variable_del('realname_profile_module');
   variable_del('realname_profile_type');
   variable_del('realname_theme');
+  
+  drupal_uninstall_schema('realname');
 }
 
 /**
@@ -71,3 +97,40 @@
 
   return $ret;
 }
+
+/**
+ * Implementation of hook_update_N().
+ */
+function realname_update_6102() {
+  $ret = array();
+  $table = array(
+    'fields' => array(
+         'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+         'realname' => array('type' => 'varchar', 'length' => '254', 'not null' => TRUE),
+        ),
+    'indexes' => array(
+         'uid' => array('uid'),
+         'realname' => array('realname')
+        ),
+  );
+  // 1. Create new table
+  db_create_table($ret, 'realname_calculated_realname', $table);
+  // 2. Populate table using current settings
+  // @TODO: User processing can take quite long. We probably need to use BATCH API
+  $module = variable_get('realname_profile_module' , null);
+  if ($module) {
+    include_once(drupal_get_path('module', 'realname') .'/realname.module');
+    $query = "SELECT u.uid, u.name, u.mail FROM {users} u";
+    $result = db_query($query);
+    while ($row = db_fetch_object($result)) {
+      $realname = _realname_make_name($row);
+      db_query("INSERT INTO {realname_calculated_realname} (uid, realname) VALUES(%d, '%s')", $row->uid, $realname);
+    }
+    $ret[] = array('success' => TRUE, 'query' => t('Realnames has been recalculated'));
+  }
+  else {
+    drupal_set_message(t('Realname module has been updated. In order to start using it you have to select profile module to be used'), 'warning');
+  }
+  
+  return $ret;
+}

=== modified file 'modules/realname/realname.module'
--- modules/realname/realname.module	2009-03-05 16:02:45 +0000
+++ modules/realname/realname.module	2009-03-06 16:35:09 +0000
@@ -18,7 +18,12 @@
 //********************************************************************
 //* Drupal Hooks
 //********************************************************************/
-
+/**
+ * Views API implementation
+ */
+function realname_views_api() {
+  return array('api' => 2.0);
+}
 /**
  * Implementation of hook_help().
  */
@@ -82,7 +87,27 @@
     'type' => MENU_LOCAL_TASK,
     'weight' => 2,
     );
-
+    
+  $items['admin/user/realname/recalc'] = array(
+    'title' => 'Recalculate names',
+    'access arguments' => array('administer users'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('realname_rebuild_confirm'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 3,
+    );
+
+  // Path is not admin/build/views due to menu complications with the wildcards from
+  // the generic ajax callback.
+  $items['admin/user/realname/ajax/autocomplete/user'] = array(
+    'page callback' => 'realname_ajax_autocomplete_user',
+    'access callback' => 'user_access',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
+
+    
+    
   return $items;
 }
 
@@ -210,16 +235,29 @@
  * Implementation of hook_user().
  */
 function realname_user($op, &$edit, &$account, $category = NULL) {
-  if ($op == 'load') {
-    $account->realname = realname_make_name($account);
+  switch ($op) {
+    case 'load':
+      $account->realname = realname_make_name($account);
 
-    // If theme then replace name with realname.
-    if (variable_get('realname_theme', TRUE) && $account->realname) {
-      //Store it for places where it needed
-      if (!isset($account->realname_save) && is_object($account)) {
-        $account->realname_save = $account->name;
+      // If theme then replace name with realname.
+      if (variable_get('realname_theme', TRUE) && $account->realname) {
+        //Store it for places where it needed
+        if (!isset($account->realname_save) && is_object($account)) {
+          $account->realname_save = $account->name;
+        }
       }
-    }
+      break;
+    case 'delete':
+      db_query("DELETE FROM {realname_calculated_realname} WHERE uid=%d", $account->uid);
+      break;
+    case 'insert':
+    case 'after_update':
+      $realname = _realname_make_name($account);
+      // now the tricky part. We cannot be sure that user already have have row in the database and REPLACE is limitied to myslq dialect, so...
+      db_lock_table('realname_calculated_realname');
+      db_query("DELETE FROM {realname_calculated_realname} WHERE uid=%d", $account->uid);
+      db_query("INSERT INTO {realname_calculated_realname} (uid, realname) VALUES(%d, '%s')", $account->uid, $realname);      
+      db_unlock_tables();      
   }
 }
 
@@ -233,6 +271,23 @@
     return;
   }
 
+  // NickSI: Yes, we will have another switch later but I would like to separate table update with other processing
+  if ( variable_get('realname_profile_module', NULL) == 'content_profile'  &&
+       is_content_profile($node->type)) { // do realnames table update if content_profile has been changed
+    switch ($op) {
+      case 'update':
+      case 'insert':
+      case 'delete':
+        $realname = _realname_make_name($account);
+        // now the tricky part. We cannot be sure that user already have have row in the database and REPLACE is limitied to myslq dialect, so...
+        db_lock_table('realname_calculated_realname');
+        db_query("DELETE FROM {realname_calculated_realname} WHERE uid=%d", $account->uid);
+        db_query("INSERT INTO {realname_calculated_realname} (uid, realname) VALUES(%d, '%s')", $account->uid, $realname);      
+        db_unlock_tables();            
+    }
+  }
+  
+  
   if (!variable_get('realname_nodeapi', FALSE)) {
     return;
   }
@@ -345,31 +400,55 @@
 //********************************************************************
 //* Module Functions
 //********************************************************************
-
 /**
- * Using selected fields, build the "real name" field in the object.
+ * Retreive calculated user name. Try static cache first, DB next and on failure call
+ * helper function to calculate realname and populate DB
  *
  * @param
  *   $account - the user object to update.
  *
  * @return
- *   The constructed "real name" string.
- */
+ *   The retreived "real name" string. 
+ */ 
 function realname_make_name(&$account) {
-  static $fields, $pattern_saved, $homepage, $use_theme, $type, $module, $profile_privacy;
   static $users = array();
-  static $links = array();
-  static $edit = array();
-
   // Return anonymous user right away.
   if ($account->uid == 0) {
     return $account->name;
   }
-
+  
+  // Check static cache first  
   if (isset($users[$account->uid])) {
     $account->homepage = isset($links[$account->uid]) ? $links[$account->uid] : NULL;
     return $users[$account->uid];
   }
+  // Check DB next
+  $query = "SELECT realname from {realname_calculated_realname} WHERE uid=%d";
+  $result = db_result(db_query($query, $account->uid));
+  
+  if ($result) { // we've succeed
+    return $result;
+  }
+  
+  $result = _realname_make_name($account);
+  db_query("INSERT INTO {realname_calculated_realname} (uid, realname) VALUES(%d, '%s')", $account->uid, $result);
+  return $result;
+}
+
+/**
+ * Helper function for realname_make_name. Using selected fields, build the "real name" field in the object.
+ *
+ * @param
+ *   $account - the user object to update.
+ *
+ * @return
+ *   The constructed "real name" string.
+ */
+function _realname_make_name(&$account) {
+  static $fields, $pattern_saved, $homepage, $use_theme, $type, $module, $profile_privacy;
+  static $users = array();
+  static $links = array();
+  static $edit = array();
 
   // Get our controlling variables (static makes it once per page load).
   if (!isset($fields)) {
@@ -480,6 +559,11 @@
 }
 
 function realname_admin_bypass() {
+  // Show rebuild warning
+  if (variable_get('realname_recalculate', FALSE)) {
+    drupal_set_message(t('In order to apply new settings you need to !rebuild your realnames', array('!rebuild' => '<b>'. l(t('rebuild'), 'admin/user/realname/recalc') .'</b>')), 'warning');
+  }
+
   $form = array();
 
   $current = variable_get('realname_bypass_forms', array(array('name' => 'comment_form', 'fields' => array('name'))));
@@ -523,11 +607,21 @@
       $bypass_forms[] = $form_info;
     }
   }
+
   variable_set('realname_bypass_forms', $bypass_forms);
+
+  // mark form for realname recalculation
+  variable_set('realname_recalculate', TRUE);
+  
   drupal_set_message(t('Information saved for !count forms.', array('!count' => count($bypass_forms))), 'status');
 }
 
 function realname_admin_module($form_state) {
+  // Show rebuild warning
+  if (variable_get('realname_recalculate', FALSE)) {
+    drupal_set_message(t('In order to apply new settings you need to !rebuild your realnames', array('!rebuild' => '<b>'. l(t('rebuild'), 'admin/user/realname/recalc') .'</b>')), 'warning');
+  }
+
   $form = array();
   // Get the list of modules we support.
   include_once(drupal_get_path('module', 'realname') .'/realname_supported.inc');
@@ -602,6 +696,9 @@
     }
   }
   // We are done with types, so go pick fields.
+  // mark form for realname recalculation
+  variable_set('realname_recalculate', TRUE);
+  
   unset($form_state['storage']);
   $form_state['redirect'] = 'admin/user/realname/fields'; // Go get the fields now.
   return;
@@ -616,7 +713,12 @@
   if (!$module) {
     drupal_goto('admin/user/realname/module');
   }
-
+  // Show rebuild warning
+  if (variable_get('realname_recalculate', FALSE)) {
+    drupal_set_message(t('In order to apply new settings you need to !rebuild your realnames', array('!rebuild' => '<b>'. l(t('rebuild'), 'admin/user/realname/recalc') .'</b>')), 'warning');
+  }
+  
+  
   $what = t('You are using the %module module to provide fields.', array('%module' => $module));
   if ($type) {
     $what .= t('The %type type is the source of data.', array('%type' => $type));
@@ -711,6 +813,16 @@
     '#description' => t('Drupal core adds "Not verified" for anonymous users, this option allows that to be turned off.'),
     '#default_value' => variable_get('realname_notver', TRUE),
     );
+  
+  if ( module_exists('views') ) {  
+    $form['realname_view'] = array(
+      '#type' => 'checkbox',
+      '#title' => '<strong>'. t('Overwrite user fields in view to show realnames') .'</strong>',
+      '#description' => t('This option will overwrite default user name definition in Views in order to show realnames without the need to modify views. Remember to rebuild view cache after changing this option.'),
+      '#default_value' => variable_get('realname_view', FALSE),
+      );
+  }  
+  
 
   // If there were any URL fields, give a home page option.
   if ($links) {
@@ -767,9 +879,112 @@
   variable_set('realname_max_username', $form_state['values']['realname_max_username']);
   variable_set('realname_nodeapi', $form_state['values']['realname_nodeapi']);
   variable_set('realname_notver', $form_state['values']['realname_notver']);
+  variable_set('realname_view', $form_state['values']['realname_view']);
   variable_set('realname_nofollow', $form_state['values']['realname_nofollow']);
 //  variable_set('realname_myacct', $form_state['values']['realname_myacct']);
   variable_set('realname_homepage', $form_state['values']['realname_homepage']);
 
+  // mark form for realname recalculation
+  variable_set('realname_recalculate', TRUE);
   drupal_set_message(t('Configuration has been updated.'), 'status');
 }
+
+/**
+ * Real names rebuild (in case of config change) handlers
+ */
+ 
+/**
+ * Menu callback: confirm rebuilding of realnames.
+ */
+function realname_rebuild_confirm() {
+  return confirm_form(array(), t('Are you sure you want to rebuild the realnames for all site users?'),
+                  'admin/user/realname', t('This action rebuilds realnames for all users , and may be a lengthy process. This action cannot be undone.'), t('Rebuild realnames'), t('Cancel'));
+}
+
+/**
+ * Handler for rebuild confirmation
+ */
+function realname_rebuild_confirm_submit($form, &$form_state) {
+  // @TODO: Make it batchable?
+  $batch = array(
+    'title' => t('Rebuilding realnames'),
+    'operations' => array(
+      array('_realname_rebuild_realnames', array()),
+    ),
+    'finished' => '_realname_rebuild_batch_finished'
+  );
+  batch_set($batch);
+}
+
+/**
+ * Batchable function used to rebuild realnames
+ */
+function _realname_rebuild_realnames(&$context) {
+  if (empty($context['sandbox'])) {
+    // Initiate multistep processing.
+    $context['sandbox']['progress'] = 0;
+    $context['sandbox']['current_user'] = 0;
+    $context['sandbox']['max'] = db_result(db_query('SELECT COUNT(DISTINCT uid) FROM {users}'));
+  }
+
+  // Process the next 20 users.
+  $limit = 20;
+  $result = db_query_range("SELECT u.uid, u.name, u.mail FROM {users} u WHERE uid >= %d ORDER BY uid ASC", $context['sandbox']['current_user'], 0, $limit);
+  while ($row = db_fetch_object($result)) {
+    $realname = _realname_make_name($row);
+    // we do it row by row in order to avoid race condition
+    db_lock_table('realname_calculated_realname');
+    db_query("DELETE FROM {realname_calculated_realname} WHERE uid=%d", $row->uid);
+    db_query("INSERT INTO {realname_calculated_realname} (uid, realname) VALUES(%d, '%s')", $row->uid, $realname);
+    db_unlock_tables();  
+    $context['sandbox']['progress']++;
+    $context['sandbox']['current_user'] = $row->uid;
+  }
+
+  // Multistep processing : report progress.
+  if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
+    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
+  }
+}
+
+function _realname_rebuild_batch_finished($success, $results, $operations) {
+  if ($success) {
+    drupal_set_message(t('The realnames have been rebuilt.'));
+    variable_set('realname_recalculate', FALSE);
+    drupal_goto('admin/user/realname');
+  }
+  else {
+    drupal_set_message(t('The realanmes have not been properly rebuilt.'), 'error');
+  }
+}
+
+/**
+* Page callback for user autocomplete
+*/
+function realname_ajax_autocomplete_user($string = '') {
+  // The user enters a comma-separated list of tags. We only autocomplete the last tag.
+  $array = drupal_explode_tags($string);
+
+  // Fetch last tag
+  $last_string = trim(array_pop($array));
+  $matches = array();
+  if ($last_string != '') {
+    $prefix = count($array) ? implode(', ', $array) . ', ' : '';
+
+    if (strpos('anonymous', strtolower($last_string)) !== FALSE) {
+      $matches[$prefix . 'Anonymous'] = 'Anonymous';
+    }
+    $result = db_query_range("SELECT realname FROM {realname_calculated_realname} WHERE LOWER(realname) LIKE LOWER('%s%%')", $last_string, 0, 10);
+
+    while ($account = db_fetch_object($result)) {
+      $n = $account->realname;
+      // Commas and quotes in terms are special cases, so encode 'em.
+      if (strpos($account->realname, ',') !== FALSE || strpos($account->realname, '"') !== FALSE) {
+        $n = '"' . str_replace('"', '""', $account->realname) . '"';
+      }
+      $matches[$prefix . $n] = check_plain($account->realname);
+    }
+  }
+
+  drupal_json($matches);
+}

=== added file 'modules/realname/realname.views.inc'
--- modules/realname/realname.views.inc	1970-01-01 00:00:00 +0000
+++ modules/realname/realname.views.inc	2009-03-06 18:21:31 +0000
@@ -0,0 +1,99 @@
+<?php
+// $Id: realname.views.inc,v 1.1.2.2 2008/11/03 20:10:34 nancyw Exp $
+/**
+ * @file
+ * Realname VIEW declarations.
+ */
+
+function realname_views_data_alter(&$data) {
+  if (variable_get('realname_view', FALSE)) {
+    // override username handling in order to use realname theme
+    $data['users']['name']['field']['handler'] = 'realname_handler_field_user_name_override';
+    $data['users']['uid']['filter']['handler'] = 'realname_handler_filter_user_name';
+    $data['users']['uid']['argument']['handler'] = 'realname_handler_argument_user_uid';
+  }
+}
+
+function realname_views_data() {
+  $tables['realname_calculated_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',
+        ),
+      ),
+  );
+
+  return $tables;
+}
+
+/**
+ * Implementation of hook_views_plugins
+ */
+function realname_views_plugins() {
+  return array(
+    'argument validator' => array(
+      'user_realname' => array(
+        'title' => t('User (realname)'),
+        'handler' => 'realname_plugin_argument_validate_user',
+        'parent' => 'user',
+      ),
+    ),
+  );
+}
+
+
+/**
+ * Define all realname views handlers
+ *
+ **/
+function realname_views_handlers() {
+  return array(
+    'info' => array(),
+    'handlers' => array(
+      'realname_handler_field_user_name' => array(
+        'parent' => 'views_handler_field_user_name',
+      ),
+      'realname_handler_argument_user_uid' => array(
+        'parent' => 'views_handler_argument_user_uid',
+      ),
+      'realname_handler_filter_user_name' => array(
+        'parent' => 'views_handler_filter_user_name',
+      ),
+      'realname_handler_field_user_name_override' => array(
+        'parent' => 'views_handler_field_user_name',
+      ),
+    )
+  );
+}
\ No newline at end of file

=== added file 'modules/realname/realname_handler_argument_user_uid.inc'
--- modules/realname/realname_handler_argument_user_uid.inc	1970-01-01 00:00:00 +0000
+++ modules/realname/realname_handler_argument_user_uid.inc	2009-03-06 16:13:09 +0000
@@ -0,0 +1,25 @@
+<?php
+// $Id:
+
+/**
+ * Argument handler for realnames
+ */
+class realname_handler_argument_user_uid extends views_handler_argument_user_uid {
+  /**
+   * Override the behavior of title(). Get the realname of the user.
+   */
+  function title_query() {
+    if (!$this->argument) {
+      return array(variable_get('anonymous', t('Anonymous')));
+    }
+    
+    $titles = array();
+    $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
+
+    $result = db_query("SELECT ru.realname FROM {users} u LEFT JOIN {realname_calculated_realname} ru ON u.uid = ru.uid WHERE u.uid IN ($placeholders)", $this->value);
+    while ($term = db_fetch_object($result)) {
+      $titles[] = check_plain($term->realname);
+    }
+    return $titles;
+  }
+}
\ No newline at end of file

=== added file 'modules/realname/realname_handler_field_user_name.inc'
--- modules/realname/realname_handler_field_user_name.inc	1970-01-01 00:00:00 +0000
+++ modules/realname/realname_handler_field_user_name.inc	2009-03-06 15:28:53 +0000
@@ -0,0 +1,30 @@
+<?php
+// $Id:
+
+/**
+ * Field handler for realnames
+ */
+class realname_handler_field_user_name extends views_handler_field_user_name {
+  function init(&$view, &$data) {
+    parent::init($view, $data);
+    $this->additional_fields['realname'] = 'realname';
+  }
+  
+  function render_link($data, $values) {
+    if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
+      $account = new stdClass();
+      $account->uid = $values->{$this->aliases['uid']};
+      if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
+        // This is an anonymous user, and we're overriting the text.
+        return check_plain($this->options['anonymous_text']);
+      }
+      elseif (!empty($this->options['link_to_user'])) {
+        $account->name = $values->{$this->field_alias};
+        return theme('username', $account);
+      }
+    }
+    // Otherwise, there's no special handling, so return the data directly.
+    return $values->{$this->aliases['realname']};
+  }
+
+}
\ No newline at end of file

=== added file 'modules/realname/realname_handler_field_user_name_override.inc'
--- modules/realname/realname_handler_field_user_name_override.inc	1970-01-01 00:00:00 +0000
+++ modules/realname/realname_handler_field_user_name_override.inc	2009-03-06 15:35:02 +0000
@@ -0,0 +1,31 @@
+<?php
+// $Id:
+
+/**
+ * Field handler for realnames
+ */
+class realname_handler_field_user_name_override extends views_handler_field_user_name {
+  function init(&$view, &$data) {
+    parent::init($view, $data);
+    $this->additional_fields['uid'] = 'uid';
+  }
+  
+  function render_link($data, $values) {
+    $account = new stdClass();
+    $account->uid = $values->{$this->aliases['uid']};
+    $account->name = $values->{$this->field_alias};
+    
+    if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
+      if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
+        // This is an anonymous user, and we're overriting the text.
+        return check_plain($this->options['anonymous_text']);
+      }
+      elseif (!empty($this->options['link_to_user'])) {
+        return theme('username', $account);
+      }
+    }
+    // Otherwise, there's no special handling, so return the data directly.
+    return realname_make_name($account);
+  }
+
+}
\ No newline at end of file

=== added file 'modules/realname/realname_handler_filter_user_name.inc'
--- modules/realname/realname_handler_filter_user_name.inc	1970-01-01 00:00:00 +0000
+++ modules/realname/realname_handler_filter_user_name.inc	2009-03-06 14:31:02 +0000
@@ -0,0 +1,96 @@
+<?php
+// $Id:
+
+/**
+ * Filter handler for usernames
+ */
+class realname_handler_filter_user_name extends views_handler_filter_user_name {
+  var $no_single = TRUE;
+
+  function value_form(&$form, &$form_state) {
+    $values = array();
+    if ($this->value) {
+      $result = db_query("SELECT u.*, ru.realname FROM {users} u LEFT JOIN {realname_calculated_realname} ru ON ru.uid=u.uid WHERE u.uid IN ("  . implode(', ', $this->value) . ")");
+      while ($account = db_fetch_object($result)) {
+        if ($account->uid) {
+          $values[] = $account->realname;
+        }
+        else {
+          $values[] = 'Anonymous'; // Intentionally NOT translated.
+        }
+      }
+    }
+
+    sort($values);
+    $default_value = implode(', ', $values);
+    $form['value'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Realnames'),
+      '#description' => t('Enter a comma separated list of user real names.'),
+      '#default_value' => $default_value,
+      '#autocomplete_path' => 'admin/user/realname/ajax/autocomplete/user',
+    );
+
+    if (!empty($form_state['exposed']) && !isset($form_state['input'][$this->options['expose']['identifier']])) {
+      $form_state['input'][$this->options['expose']['identifier']] = $default_value;
+    }
+  }
+
+  /**
+   * Validate the user string. Since this can come from either the form
+   * or the exposed filter, this is abstracted out a bit so it can
+   * handle the multiple input sources.
+   */
+  function validate_user_strings(&$form, $values) {
+    $uids = array();
+    $placeholders = array();
+    $args = array();
+    $results = array();
+    foreach ($values as $value) {
+      if (strtolower($value) == 'anonymous') {
+        $uids[] = 0;
+      }
+      else {
+        $missing[strtolower($value)] = TRUE;
+        $args[] = $value;
+        $placeholders[] = "'%s'";
+      }
+    }
+
+    if (!$args) {
+      return $uids;
+    }
+
+    $result = db_query("SELECT u.*, ru.realname FROM {users} u LEFT JOIN {realname_calculated_realname} ru ON ru.uid=u.uid WHERE ru.realname IN (" . implode(', ', $placeholders) . ")", $args);
+    while ($account = db_fetch_object($result)) {
+      unset($missing[strtolower($account->realname)]);
+      $uids[] = $account->uid;
+    }
+
+    if ($missing) {
+      form_error($form, format_plural(count($missing), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', array_keys($missing)))));
+    }
+
+    return $uids;
+  }
+
+  function admin_summary() {
+    // set up $this->value_options for the parent summary
+    $this->value_options = array();
+
+    if ($this->value) {
+      $result = db_query("SELECT u.*, ru.realname FROM {users} u LEFT JOIN {realname_calculated_realname} ru ON ru.uid=u.uid WHERE u.uid IN ("  . implode(', ', $this->value) . ")");
+
+      while ($account = db_fetch_object($result)) {
+        if ($account->uid) {
+          $this->value_options[$account->uid] = $account->realname;
+        }
+        else {
+          $this->value_options[$account->uid] = 'Anonymous'; // Intentionally NOT translated.
+        }
+      }
+    }
+
+    return parent::admin_summary();
+  }
+}

=== added file 'modules/realname/realname_plugin_argument_validate_user.inc'
--- modules/realname/realname_plugin_argument_validate_user.inc	1970-01-01 00:00:00 +0000
+++ modules/realname/realname_plugin_argument_validate_user.inc	2009-03-06 16:12:30 +0000
@@ -0,0 +1,16 @@
+<?php
+// $Id: realname_plugin_argument_validate_user.inc
+
+/**
+ * Override of style plugin. Replaces username with realname
+ *
+ */
+class realname_plugin_argument_validate_user extends views_plugin_argument_validate_user {
+  
+  function validate_argument($argument) {
+    $result = parent::validate_argument($argument);
+    $this->argument->validated_title = realname_make_name($account);
+    return TRUE;
+  }
+}
+
