TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 207
  • Total: 207

[Block] Newest member block with Avatar image which links to their profile

Started by gbingo, August 23, 2006, 06:04:29 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Omniverse

Is it possible to restrict this to a specific membergroup?

So say you have a membergroup set up for new people, could this be used to only show the latest members placed in that group? (Would still go off when they registered I spose, but only want to show the one group).

Maviarab

Ok been following all this so far and my question is this.

Using jacortina's code, what needs to be changed to make this show highest poster rather than newest member?

Thx in advance.

jacortina

If you're using the code from this message:
http://www.tinyportal.net/index.php?topic=7737.msg80797#msg80797

Then you could try...

Changing:
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

To:
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY posts DESC LIMIT ".$count, __FILE__, __LINE__);

Maviarab

Thx for quick reply   :)

Just about to head to bed (even though it has gone 5am here heh) so will try that later.

Thx again

Maviarab


contra

gotta say guys i cant get this to work at all


is this PHP?
if so it wont work for me

Zetan

Can you post the code you are trying to use?
Simply saying, "it wont work" just makes people like me ask.. "Can you post the code?"

And yes, it should be a php block.

alhaudhie

im now using this simple code

global $db_prefix, $memberContext;

$count = 3;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);

$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center">( No Avatar Yet )<BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}


anybody can help me to put other information about the new user like date/time register and their location..

IchBin

$user_id['registered'] would be the registered date. And location would be $user_id['location']. Add those to your if statement.
if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'<br />',$memberContext['user_id']['registered'],'<br />',$memberContext['user_id']['location'],'</div>';

jacortina

As that gets its info by calling the loadMemberData() function, you have just about every bit of (standard) information about the member available to you already in the $memberContext array:

$memberContext[$user] = array(
'username' => &$profile['memberName'],
'name' => &$profile['realName'],
'id' => &$profile['ID_MEMBER'],
'is_guest' => $profile['ID_MEMBER'] == 0,
'is_buddy' => $profile['buddy'],
'is_reverse_buddy' => in_array($ID_MEMBER, $buddy_list),
'buddies' => $buddy_list,
'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '',
'href' => $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>',
'email' => &$profile['emailAddress'],
'hide_email' => $profile['emailAddress'] == '' || (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($profile['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !allowedTo('moderate_forum') && $ID_MEMBER != $profile['ID_MEMBER']),
'email_public' => (empty($profile['hideEmail']) || empty($modSettings['allow_hideEmail'])) && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']),
'registered' => empty($profile['dateRegistered']) ? $txt[470] : timeformat($profile['dateRegistered']),
'registered_timestamp' => empty($profile['dateRegistered']) ? 0 : forum_time(true, $profile['dateRegistered']),
'blurb' => &$profile['personalText'],
'gender' => array(
'name' => $gendertxt,
'image' => !empty($profile['gender']) ? '<img src="' . $settings['images_url'] . '/' . ($profile['gender'] == 1 ? 'Male' : 'Female') . '.gif" alt="' . $gendertxt . '" border="0" />' : ''
),
'website' => array(
'title' => &$profile['websiteTitle'],
'url' => &$profile['websiteUrl'],
),
'birth_date' => empty($profile['birthdate']) || $profile['birthdate'] === '0001-01-01' ? '0000-00-00' : (substr($profile['birthdate'], 0, 4) === '0004' ? '0000' . substr($profile['birthdate'], 4) : $profile['birthdate']),
'signature' => &$profile['signature'],
'location' => &$profile['location'],
'icq' => $profile['ICQ'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'name' => &$profile['ICQ'],
'href' => 'http://www.icq.com/whitepages/about_me.php?uin=' . $profile['ICQ'],
'link' => '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $profile['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&amp;icq=' . $profile['ICQ'] . '" alt="' . $profile['ICQ'] . '" width="18" height="18" border="0" /></a>',
'link_text' => '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $profile['ICQ'] . '" target="_blank">' . $profile['ICQ'] . '</a>',
) : array('name' => '', 'add' => '', 'href' => '', 'link' => '', 'link_text' => ''),
'aim' => $profile['AIM'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'name' => &$profile['AIM'],
'href' => 'aim:goim?screenname=' . urlencode(strtr($profile['AIM'], array(' ' => '%20'))) . '&amp;message=' . $txt['aim_default_message'],
'link' => '<a href="aim:goim?screenname=' . urlencode(strtr($profile['AIM'], array(' ' => '%20'))) . '&amp;message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $profile['AIM'] . '" border="0" /></a>',
'link_text' => '<a href="aim:goim?screenname=' . urlencode(strtr($profile['AIM'], array(' ' => '%20'))) . '&amp;message=' . $txt['aim_default_message'] . '">' . $profile['AIM'] . '</a>'
) : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''),
'yim' => $profile['YIM'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'name' => &$profile['YIM'],
'href' => 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['YIM']),
'link' => '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($profile['YIM']) . '&amp;m=g&amp;t=0" alt="' . $profile['YIM'] . '" border="0" /></a>',
'link_text' => '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['YIM']) . '">' . $profile['YIM'] . '</a>'
) : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''),
'msn' => $profile['MSN'] !='' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(
'name' => &$profile['MSN'],
'href' => 'http://members.msn.com/' . $profile['MSN'],
'link' => '<a href="http://members.msn.com/' . $profile['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $profile['MSN'] . '" border="0" /></a>',
'link_text' => '<a href="http://members.msn.com/' . $profile['MSN'] . '" target="_blank">' . $profile['MSN'] . '</a>'
) : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''),
'real_posts' => $profile['posts'],
'posts' => $profile['posts'] > 100000 ? $txt[683] : ($profile['posts'] == 1337 ? 'leet' : comma_format($profile['posts'])),
'avatar' => array(
'name' => &$profile['avatar'],
'image' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 ? '<img src="' . (empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 ? (empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar'])
),
'last_login' => empty($profile['lastLogin']) ? $txt['never'] : timeformat($profile['lastLogin']),
'last_login_timestamp' => empty($profile['lastLogin']) ? 0 : forum_time(0, $profile['lastLogin']),
'karma' => array(
'good' => &$profile['karmaGood'],
'bad' => &$profile['karmaBad'],
'allow' => !$user_info['is_guest'] && $user_info['posts'] >= $modSettings['karmaMinPosts'] && allowedTo('karma_edit') && !empty($modSettings['karmaMode']) && $ID_MEMBER != $user
),
'ip' => htmlspecialchars($profile['memberIP']),
'ip2' => htmlspecialchars($profile['memberIP2']),
'online' => array(
'is_online' => $profile['is_online'],
'text' => &$txt[$profile['is_online'] ? 'online2' : 'online3'],
'href' => $scripturl . '?action=pm;sa=send;u=' . $profile['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $profile['ID_MEMBER'] . '">' . $txt[$profile['is_online'] ? 'online2' : 'online3'] . '</a>',
'image_href' => $settings['images_url'] . '/' . ($profile['buddy'] ? 'buddy_' : '') . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif',
'label' => &$txt[$profile['is_online'] ? 'online4' : 'online5']
),
'language' => $func['ucwords'](strtr($profile['lngfile'], array('_' => ' ', '-utf8' => ''))),
'is_activated' => isset($profile['is_activated']) ? $profile['is_activated'] : 1,
'is_banned' => isset($profile['is_activated']) ? $profile['is_activated'] >= 10 : 0,
'options' => $profile['options'],
'is_guest' => false,
'group' => $profile['member_group'],
'group_color' => $profile['member_group_color'],
'group_id' => $profile['ID_GROUP'],
'post_group' => $profile['post_group'],
'post_group_color' => $profile['post_group_color'],
'group_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['stars'][1]) ? $settings['images_url'] . '/' . $profile['stars'][1] : '') . '" alt="*" border="0" />', empty($profile['stars'][0]) || empty($profile['stars'][1]) ? 0 : $profile['stars'][0]),
'local_time' => timeformat(time() + ($profile['timeOffset'] - $user_info['time_offset']) * 3600, false),
);

This website is proudly hosted on Crocweb Cloud Website Hosting.