Vote for president!
Posted: 02 Oct 2012, 05:10
This is the 'Vote for president' snippet.
This is not mine! I grabbed part of the code from the Board3 portal random member module.
------------------------------------------
open index.php
Find:
Add before:
Open: /styles/prosilver/template/index_body.html
Place wherever you want it ti show:
Screenshot:
This is not mine! I grabbed part of the code from the Board3 portal random member module.
------------------------------------------
open index.php
Find:
Code: Select all
// Assign index specific vars
Code: Select all
switch ($db->sql_layer)
{
case 'postgres':
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
ORDER BY RANDOM()';
break;
case 'mssql':
case 'mssql_odbc':
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
ORDER BY NEWID()';
break;
default:
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
ORDER BY RAND()';
break;
}
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$username = $row['username'];
$user_id = (int) $row['user_id'];
$colour = $row['user_colour'];
$template->assign_block_vars('random_member', array(
'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour),
'USERNAME' => get_username_string('username', $user_id, $username, $colour),
'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour),
));
$db->sql_freeresult($result);
Place wherever you want it ti show:
Code: Select all
<!-- BEGIN random_member -->
<p>Vote <span style="font-weight:bold; ">{random_member.USERNAME_FULL}</span> for President!</p>
<!-- END random_member -->