I like this feature i don't think many have noticed it i can't really see any need for it or what use it is but i really do like it

Code: Select all
switch ($db->sql_layer)
{
case 'postgres':
$order_by = 'RANDOM()';
break;
case 'mssql':
case 'mssql_odbc':
$order_by = 'NEWID()';
break;
default:
$order_by = 'RAND()';
break;
}
$sql = 'SELECT user_id, user_type, username, user_colour
FROM ' . USERS_TABLE . ' WHERE user_type = 2
ORDER BY ' . $order_by;
$result = $db->sql_query_limit($sql, 1);
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('users', array(
'BOT_NAME' => $row['username'],
'BOT_COLOUR' => $row['user_colour'],
));
}
$db->sql_freeresult($result);
Code: Select all
<!-- IF not S_IS_BOT -->
<!-- BEGIN users --><div style="text-align:center;"><p>Vote <span style="font-weight:bold; color:#{users.BOT_COLOUR};">{users.BOT_NAME}</span> for President!</p></div><!-- END users -->
<!-- ENDIF -->
Code: Select all
'BOT_COLOUR' => $row['user_colour'],
Code: Select all
{users.BOT_COLOUR}
Code: Select all
#{users.BOT_COLOUR}
Code: Select all
WHERE user_type = 2
Code: Select all
WHERE group_id = 7
Stoker wrote:To display random users from a specific group change this code from index.php:toCode: Select all
WHERE user_type = 2
7 is the group IDCode: Select all
WHERE group_id = 7