Random member 2

Forum rules
This forum is not for support requests.

Only post Modifications for Board3 Portal 1.0.x in this forum.
Locked

Topic author
pokkis
Active Member
Posts: 5
Joined: 5. February 2008 14:48

Random member 2

Post by pokkis »

I dont know where to put this so i wil put this here :?
This version of random member includes user avatar and signature, just cause i wanted them :D
This is done only for subsilver2, just cause i use it :D
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,
));
?>
random_member2.html
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 :oops:

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 />
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Random member 2

Post by Kevin »

Thank you pokkis!
I moved this topic to the Add-Ons / Snippets forum.
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!
Locked

Return to “board3 Portal v1.0.x - Modifications in Dev”