![](./images/smilies/spacer.gif)
Is it possible to add a
![](./images/smilies/spacer.gif)
Moderators: IMOC Moderators, IMOC Committee Members
michael wrote:Is it possible to add a"real name" field as well to aid in searches?
Code: Select all
// alphanum Method
if ( isset($HTTP_GET_VARS['alphanum']) || isset($HTTP_POST_VARS['alphanum']) )
{
$alphanum = ( isset($HTTP_POST_VARS['alphanum']) ) ? htmlspecialchars($HTTP_POST_VARS['alphanum']) : htmlspecialchars($HTTP_GET_VARS['alphanum']);
$alphanum = str_replace("\'", "''", $alphanum);
switch( $dbms )
{
case 'postgres':
$alpha_where = ( $alphanum == 'num' ) ? "AND username !~ '^[A-Z]+'" : "AND username ILIKE '$alphanum%'";
$alpha_l = "$alphanum";
break;
default:
$alpha_where = ( $alphanum == 'num' ) ? "AND username NOT RLIKE '^[A-Z]'" : "AND username LIKE '$alphanum%'";
$alpha_l = "$alphanum";
break;
}
}
else
{
$alpahnum = '';
$alpha_where = '';
}
Code: Select all
//
// gets for alphanum
//
$alpha_range = array();
$alpha_letters = array();
$alpha_letters = range('A','Z');
$alpha_start = array($lang['All'], '#');
$alpha_range = array_merge($alpha_start, $alpha_letters);
$i = 0;
while( $i < count($alpha_range) )
{
if ( $alpha_range[$i] != $lang['All'] )
{
if ( $alpha_range[$i] != '#' )
{
$temp = strtolower($alpha_range[$i]);
}
else
{
$temp = 'num';
}
$alphanum_search_url = append_sid($phpbb_root_path . "memberlist.$phpEx?mode=$mode&order=$sort_order&show=50&alphanum=$temp");
}
else
{
$alphanum_search_url = append_sid($phpbb_root_path . "memberlist.$phpEx?mode=$mode&order=$sort_order&show=$show");
}
if ( ( $alphanum == $temp ) || ( $alpha_range[$i] == $lang['All'] && empty($alphanum) ) )
{
$alpha_range[$i] = '<b>' . $alpha_range[$i] . '</b>';
}
$template->assign_block_vars('alphanumsearch', array(
'SEARCH_SIZE' => floor(100/count($alpha_range)) . '%',
'SEARCH_TERM' => $alpha_range[$i],
'SEARCH_LINK' => $alphanum_search_url)
);
$i++;
}
$hidden_fields = '<input type="hidden" name="start" value="' . $start . '">';
$hidden_fields .= '<input type="hidden" name="alphanum" value="' . $alphanum . '">';
Code: Select all
$sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS ." $alpha_where";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
}
if ( $total = $db->sql_fetchrow($result) )
{
$total_members = $total['total'];
if ( $alpha_l )
{
$pagination = generate_pagination("memberlist.$phpEx?mode=$mode&alphanum=$alpha_l&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). ' ';
}
else
{
$pagination = generate_pagination("memberlist.$phpEx?mode=$mode&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). ' ';
}
}
$db->sql_freeresult($result);