Added random member block
This commit is contained in:
42
root/language/en/mods/portal/portal_random_member_module.php
Normal file
42
root/language/en/mods/portal/portal_random_member_module.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal - Random Member
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DO NOT CHANGE
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($lang) || !is_array($lang))
|
||||||
|
{
|
||||||
|
$lang = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEVELOPERS PLEASE NOTE
|
||||||
|
//
|
||||||
|
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
|
||||||
|
//
|
||||||
|
// Placeholders can now contain order information, e.g. instead of
|
||||||
|
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
|
||||||
|
// translators to re-order the output of data while ensuring it remains correct
|
||||||
|
//
|
||||||
|
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
|
||||||
|
// equally where a string contains only two placeholders which are used to wrap text
|
||||||
|
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||||
|
$lang = array_merge($lang, array(
|
||||||
|
'PORTAL_RANDOM_MEMBER' => 'Random member',
|
||||||
|
'RND_JOIN' => 'Join',
|
||||||
|
'RND_POSTS' => 'Posts',
|
||||||
|
'RND_OCC' => 'Occupation',
|
||||||
|
'RND_FROM' => 'Location',
|
||||||
|
'RND_WWW' => 'Web page',
|
||||||
|
));
|
||||||
|
|
||||||
|
?>
|
||||||
143
root/portal/modules/portal_random_member.php
Normal file
143
root/portal/modules/portal_random_member.php
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal - Random Member
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Random Member
|
||||||
|
*/
|
||||||
|
class portal_random_member_module
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||||
|
* top 1
|
||||||
|
* left 2
|
||||||
|
* center 4
|
||||||
|
* right 8
|
||||||
|
* bottom 16
|
||||||
|
*/
|
||||||
|
var $columns = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default modulename
|
||||||
|
*/
|
||||||
|
var $name = 'PORTAL_RANDOM_MEMBER';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default module-image:
|
||||||
|
* file must be in "{T_THEME_PATH}/images/portal/"
|
||||||
|
*/
|
||||||
|
var $image_src = 'portal_random_member.png';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* module-language file
|
||||||
|
* file must be in "language/{$user->lang}/mods/portal/"
|
||||||
|
*/
|
||||||
|
var $language = 'portal_random_member_module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* custom acp template
|
||||||
|
* file must be in "adm/style/portal/"
|
||||||
|
*/
|
||||||
|
var $custom_acp_tpl = '';
|
||||||
|
|
||||||
|
function get_template_side($module_id)
|
||||||
|
{
|
||||||
|
global $config, $template, $db, $user;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
$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'];
|
||||||
|
|
||||||
|
$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_WWW' => censor_text($row['user_website']),
|
||||||
|
));
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
return 'random_member_side.html';
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_template_acp($module_id)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'title' => 'PORTAL_RANDOM_MEMBER',
|
||||||
|
'vars' => array(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API functions
|
||||||
|
*/
|
||||||
|
function install($module_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall($module_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<!--version $Id$ //-->
|
||||||
|
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="16" height="16" alt="" /> <!-- ENDIF -->{L_PORTAL_RANDOM_MEMBER}{$LR_BLOCK_H_R}
|
||||||
|
<!-- BEGIN random_member -->
|
||||||
|
<div style="text-align: center;"><span style="font-size:12px; padding-top:1px; margin-bottom: 5px;">{random_member.USERNAME_FULL}</span><br style="clear:both" />
|
||||||
|
<!-- IF random_member.AVATAR_IMG --><a href="{random_member.U_VIEW_PROFILE}">{random_member.AVATAR_IMG}</a><br style="clear:both" /><!-- ENDIF -->
|
||||||
|
<!-- IF random_member.RANK_TITLE --><span class="gensmall">{random_member.RANK_TITLE}</span><br style="clear:both" /><!-- ENDIF -->
|
||||||
|
<!-- IF random_member.RANK_IMG -->{random_member.RANK_IMG}<br style="clear:both" /><!-- ENDIF -->
|
||||||
|
</div>
|
||||||
|
<br style="clear:both" />
|
||||||
|
<span style="float:left;"><strong>{L_RND_JOIN}:</strong></span><span style="float:right;padding-right:10px;">{random_member.JOINED}</span><br style="clear:both" />
|
||||||
|
<span style="float:left;"><strong>{L_RND_POSTS}:</strong></span><span style="float:right;padding-right:10px;">{random_member.USER_POSTS}</span><br style="clear:both" />
|
||||||
|
<!-- IF random_member.USER_OCC -->
|
||||||
|
<span style="float:left;"><strong>{L_RND_OCC}:</strong></span><span style="float:right;padding-right:10px;"> {random_member.USER_OCC}</span><br style="clear:both" />
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- IF random_member.USER_FROM -->
|
||||||
|
<span style="float:left;"><strong>{L_RND_FROM}:</strong></span><span style="float:right;padding-right:10px;"> {random_member.USER_FROM}</span><br style="clear:both" />
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- IF random_member.U_WWW -->
|
||||||
|
<span style="float:left;"><a href="{random_member.U_WWW}" title="{random_member.U_WWW}"><strong>{L_RND_WWW}</strong></a></span><br style="clear:both" />
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- END random_member -->
|
||||||
|
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user