Closed (outdated)
Project:
Real Name
Version:
6.x-1.4
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2011 at 10:31 UTC
Updated:
30 May 2016 at 21:40 UTC
Jump to comment: Most recent
Comments
Comment #1
Dragoonius commentedI'm having a similar problem, however it's only on one of my sites. The other uses the same versions of Realname and Privatemessage and don't suffer from this problem. Perhaps it's a problem with the AJAX autocomplete?
Comment #2
Dragoonius commentedWell I have a partial solution that will at least let you run realnames on the rest of the site. If you open up the realnames.module file and comment out:
if (module_exists('privatemsg')) {
$items['realname/privatemsg/autocomplete'] = array(
'title' => 'Realname Privatemsg autocomplete',
'access callback' => user_access('access private messages'),
'page callback' => 'realname_privatemsg_autocomplete',
'type' => MENU_CALLBACK,
);
}
and then
case 'privatemsg_new':
$form['privatemsg']['recipient']['#autocomplete_path'] = 'realname/privatemsg/autocomplete';
break;
and then
function realname_privatemsg_autocomplete($string) {
$names = explode(',', $string);
$names = array_map('trim', $names);
$search = array_pop($names);
if ($search != '') {
$sql = 'SELECT u.uid, u.name, r.realname FROM {users} u INNER JOIN {realname} r USING(uid) ';
$sql .= ' WHERE u.status <> 0 AND LOWER(r.realname) LIKE LOWER(\'%%%s%%\') AND ';
$sql .= variable_get('privatemsg_default_allow', 1) ? '(u.data NOT LIKE \'%%:16:"privatemsg_allow";i:0%%\' OR u.data IS NULL)' : 'u.data LIKE \'%%:16:"privatemsg_allow";i:1%%\'';
$sql .= ' ORDER BY r.realname ASC';
$result = db_query_range($sql, $search, 0, 10);
$prefix = count($names) ? implode(', ', $names) . ', ' : '';
$matches = array();
while ($user = db_fetch_object($result)) {
$account = user_load(array('uid' => $user->uid));
$matches[$prefix . $user->name] = $user->realname;
if ($user->realname != $user->name) {
$matches[$prefix . $user->name] .= ' (' . $user->name . ')';
}
}
drupal_json($matches);
}
else {
drupal_json(array()); // prevent Drupal autocomplete error message
}
}
this will let allow autocomplete to work on messages again using basic usernames, but you can still see realnames everywhere else. I'll see about actually fixing it later.
Comment #3
Dragoonius commentedWell, turns out there's an easy solution. Not sure why it works, but I reinstalled the latest version of realnames, then ran database updates, cron and flushed caches in that order and boom it worked. Perhaps something got corrupted somewhere. But hopefully that will fix the problem in the future.
Comment #4
hass commented