This seems to work:
1. Open search.php, find
$customs
$ip
and above, add
<tr>
<td><input type="checkbox" name="owner_name" id="owner_name" class="checkbox" /><label for="owner_name" class="clickable_option">Owner name</label></td>
<td> </td>
</tr>
2. Open thumbnails.php, find
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type');
and replace with
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type', 'owner_name');
3. Open include/search.inc.php, find
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4');
and below, add
// Use actual column name for search by user name
if ($USER['search']['params']['owner_name']) {
global $cpg_udb;
$USER['search']['params'][$cpg_udb->field['username']] = 'on';
$allowed[] = $cpg_udb->field['username'];
}
find
$query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
WHERE $sql
AND ($sort_order)";
and replace with
$query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
INNER JOIN {$cpg_udb->usertable} AS u ON p.owner_id = u.{$cpg_udb->field['user_id']}
WHERE $sql
AND ($sort_order)";
find
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE " . $sql;
and replace with
$query = "SELECT p.*, u.{$cpg_udb->field['username']} AS owner_name FROM {$CONFIG['TABLE_PICTURES']} AS p
INNER JOIN {$cpg_udb->usertable} AS u ON p.owner_id = u.{$cpg_udb->field['user_id']}
WHERE " . $sql;