This version of random member includes user avatar and signature, just cause i wanted them
This is done only for subsilver2, just cause i use it
random-member2.php
Code: Select all
<?php
/**
*
* @package - Board3portal
* @version $Id: random_member.php 99 2008-01-15 20:31:25Z kevin74 $
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (!defined('IN_PORTAL'))
{
exit;
}
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_inactive_time = 0
ORDER BY RAND()
LIMIT 0,1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$avatar_img = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);
$rank_title = $rank_img = '';
get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src);
$username = $row['username'];
$user_id = (int) $row['user_id'];
$colour = $row['user_colour'];
//$user_sig = $row['user_sig'];
if (user_sig)
{
$user_sig = censor_text($row['user_sig']);
if (user_sig_bbcode_bitfield)
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode();
$bbcode->bbcode_second_pass($user_sig, $row['user_sig_bbcode_uid'], $row['user_sig_bbcode_bitfield']);
}
$user_sig = bbcode_nl2br($user_sig);
$user_sig = smiley_text($user_sig);
}
$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),
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour),
'RANK_TITLE' => $rank_title,
'RANK_IMG' => $rank_img,
'RANK_IMG_SRC' => $rank_img_src,
'USER_POSTS' => (int) $row['user_posts'],
'AVATAR_IMG' => $avatar_img,
'JOINED' => $user->format_date($row['user_regdate'], 'd.M.Y'),
'USER_OCC' => censor_text($row['user_occ']),
'USER_FROM' => censor_text($row['user_from']),
'U_SIG' => $user_sig,
));
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_DISPLAY_RANDOM_MEMBER' => true,
));
?>
On line 10 there is width of cell set to 130px. slightly wider than max pix size of avatar, this can/should be adjusted based on local setting,
this could be done also by system max avatar width + few pixs, but i did har coding here, bad boy
Code: Select all
<table class="tablebg" cellspacing="1" width="100%">
<tr>
<th colspan="2">{L_RND_MEMBER}</th>
</tr>
<!-- BEGIN random_member -->
<tr class="row1">
<td> <a href="{random_member.U_VIEW_PROFILE}">{random_member.USERNAME}</a>
<!-- IF random_member.RANK_TITLE --><br><small>{random_member.RANK_TITLE}</small><!-- ENDIF -->
</td>
<td width="130px" align="center">
<!-- IF random_member.AVATAR_IMG --><a href="{random_member.U_VIEW_PROFILE}">{random_member.AVATAR_IMG}</a><!-- ENDIF -->
</td>
</tr>
<tr class="row1">
<td><strong>{L_JOINED}:</strong></td>
<td align="right">{random_member.JOINED}</td>
</tr>
<tr class="row1">
<td> <strong>{L_POSTS}:</strong></td>
<td align="right">{random_member.USER_POSTS}</td>
</tr>
<!-- IF random_member.USER_FROM -->
<tr class="row1">
<td><strong>{L_LOCATION}:</strong></td>
<td align="right">{random_member.USER_FROM}</td>
</tr>
<!-- ENDIF -->
<!-- IF random_member.U_SIG -->
<tr class="row1">
<td colspan="2"><strong>{L_SIGNATURE}:</strong></td>
<tr class="row1"><td colspan="2">{random_member.U_SIG}</td>
</tr>
<!-- ENDIF -->
<!-- END random_member -->
</table>
<br />