collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 555
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Lastest members.  (Read 6086 times)

0 Members and 1 Guest are viewing this topic.

Offline Joshie

  • Semi Newbie
  • *
  • Posts: 6
Lastest members.
« on: January 19, 2009, 11:20:07 PM »
For latest members. I am looking for to have 4 in block instead of only one. How can I change it from 1 to 4?

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Lastest members.
« Reply #1 on: January 26, 2009, 03:38:28 PM »
This Code displays the lastest 4 members registered , up to down from newest to oldest with a link to their profile when clicking on the name .. the list is without their Avatars , this is another story which I dont have time for now :D
to change the background colors change #dddddd or #ffffff
just put the folowing code in a php block
Code: [Select]
<?php

/////////// FINDING the Latest //////////////////
$colorb=-1;
echo 
"<table cellspacing='0' cellpadding='5' style='border:1px solid gray; width:100%' align='center'>";
$askm=mysql_query("SELECT * FROM smf_members ORDER BY DateRegistered DESC LIMIT 4");
while(
$rowm mysql_fetch_array($askmMYSQL_ASSOC)){
$colorb*=-1; if ($colorb==1){ $colortd='#dddddd'; } else {$colortd='#ffffff'; };
$latestm=$rowm[memberName];
$latestmID=$rowm[ID_MEMBER];
echo 
"<tr><td style='background-color:$colortd'><b><a href='index.php?action=profile;u=$latestmID'>$latestm</a></b></td></tr>";
// end while
echo "</table>";
?>


« Last Edit: January 26, 2009, 03:40:58 PM by Nabil »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Lastest members.
« Reply #2 on: February 02, 2009, 05:41:02 PM »
An alternative, with avatar and date registered:

Code: [Select]
global $db_prefix, $scripturl, $txt, $settings, $modSettings, $color_profile;

$request = db_query("
SELECT m.ID_MEMBER, m.realName, m.dateRegistered, m.avatar, a.ID_ATTACH, a.attachmentType, a.filename
FROM ({$db_prefix}members as m)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
ORDER BY m.ID_MEMBER DESC
LIMIT 4", __FILE__, __LINE__);
$members = array();
$colorids = array();
while ($row = mysql_fetch_assoc($request)) {
if (stristr($row['avatar'], 'http://') && !empty($modSettings['avatar_check_size']))
{
$sizes = url_image_size($row['avatar']);

if ($modSettings['avatar_action_too_large'] == 'option_refuse' && is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external']))))
{
$row['avatar'] = '';
updateMemberData($row['ID_MEMBER'], array('avatar' => '\'\''));
}
}

if(!empty($row['ID_MEMBER']))
$colorids[$row['ID_MEMBER']] = $row['ID_MEMBER'];

$members[] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'date' => timeformat($row['dateRegistered']),
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
)
);
}
mysql_free_result($request);

if(!empty($colorids) && sp_loadColors($colorids) !== false)
foreach($members as $k => $p)
if(!empty($color_profile[$p['id']]['link']))
$members[$k]['link'] = $color_profile[$p['id']]['link'];

echo '
<table>';

foreach ($members as $member)
{
if (!empty($member['avatar']['href']))
echo '
<tr>
<td><img src="' . $member['avatar']['href'] . '" alt="" width="35" /></td><td>&nbsp;</td>
<td>' . $member['link'] . '<br />' . $member['date'] . '</td>
</tr>';
else
echo '
<tr>
<td>&nbsp;</td><td>&nbsp;</td>
<td>' . $member['link'] . '<br />' . $member['date'] . '</td>
</tr>';
}

echo '
</table>';

You can use it in a PHP block.
And slowly, you come to realize... It's all as it should be...

Offline Aw06

  • Full Member
  • ***
  • Posts: 238
  • Gender: Male
    • www.ShopinJA.com
  • SMF Version: 1.1.13
  • SP Version: 2.3.2
Re: Lastest members.
« Reply #3 on: April 02, 2009, 02:52:01 PM »
An alternative, with avatar and date registered:

Code: [Select]
global $db_prefix, $scripturl, $txt, $settings, $modSettings, $color_profile;

$request = db_query("
SELECT m.ID_MEMBER, m.realName, m.dateRegistered, m.avatar, a.ID_ATTACH, a.attachmentType, a.filename
FROM ({$db_prefix}members as m)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
ORDER BY m.ID_MEMBER DESC
LIMIT 4", __FILE__, __LINE__);
$members = array();
$colorids = array();
while ($row = mysql_fetch_assoc($request)) {
if (stristr($row['avatar'], 'http://') && !empty($modSettings['avatar_check_size']))
{
$sizes = url_image_size($row['avatar']);

if ($modSettings['avatar_action_too_large'] == 'option_refuse' && is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external']))))
{
$row['avatar'] = '';
updateMemberData($row['ID_MEMBER'], array('avatar' => '\'\''));
}
}

if(!empty($row['ID_MEMBER']))
$colorids[$row['ID_MEMBER']] = $row['ID_MEMBER'];

$members[] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'date' => timeformat($row['dateRegistered']),
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
)
);
}
mysql_free_result($request);

if(!empty($colorids) && sp_loadColors($colorids) !== false)
foreach($members as $k => $p)
if(!empty($color_profile[$p['id']]['link']))
$members[$k]['link'] = $color_profile[$p['id']]['link'];

echo '
<table>';

foreach ($members as $member)
{
if (!empty($member['avatar']['href']))
echo '
<tr>
<td><img src="' . $member['avatar']['href'] . '" alt="" width="35" /></td><td>&nbsp;</td>
<td>' . $member['link'] . '<br />' . $member['date'] . '</td>
</tr>';
else
echo '
<tr>
<td>&nbsp;</td><td>&nbsp;</td>
<td>' . $member['link'] . '<br />' . $member['date'] . '</td>
</tr>';
}

echo '
</table>';

You can use it in a PHP block.

Nice code,,, im now using this ..

But is it possible for me the specify an avatar to display when the user does not have one ?

Aslo can i get the date to read 1:03 PM instead of 01:03:25 PM
« Last Edit: April 02, 2009, 03:01:44 PM by Aw06 »

Offline KahneFan

  • Jr. Member
  • **
  • Posts: 83
    • I Post You Post
  • SMF Version: 2 RC1.2
  • SP Version: 2.3.1
Re: Lastest members.
« Reply #4 on: April 02, 2009, 03:45:39 PM »
SP 2.2 now has multiple newest members built in.

As for the avatar, you could try the default avatar mod...

http://custom.simplemachines.org/mods/index.php?mod=975
I Post You Post - Forum Owners Helping Forum Owners

Offline Aw06

  • Full Member
  • ***
  • Posts: 238
  • Gender: Male
    • www.ShopinJA.com
  • SMF Version: 1.1.13
  • SP Version: 2.3.2
Re: Lastest members.
« Reply #5 on: April 02, 2009, 05:10:27 PM »
thanks.. applied the mod ... but in the Simple portal block, it does'nt seem to pick up the AV :'(

Offline KahneFan

  • Jr. Member
  • **
  • Posts: 83
    • I Post You Post
  • SMF Version: 2 RC1.2
  • SP Version: 2.3.1
Re: Lastest members.
« Reply #6 on: April 02, 2009, 05:15:02 PM »
I don't know if it will help, but have you tried clearing your cache?
I Post You Post - Forum Owners Helping Forum Owners

Offline Aw06

  • Full Member
  • ***
  • Posts: 238
  • Gender: Male
    • www.ShopinJA.com
  • SMF Version: 1.1.13
  • SP Version: 2.3.2
Re: Lastest members.
« Reply #7 on: April 02, 2009, 05:21:03 PM »
I don't know if it will help, but have you tried clearing your cache?

Just did, still not showing .. shows everwhere else :o

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Lastest members.
« Reply #8 on: April 02, 2009, 06:36:43 PM »
In Simple Portal 2.2 if you go to "Add Block" the description for Latest Member says the following...

Latest Member

Displays the latest member and their avatar.

But it doesn't show the avatar?

Offline iosys

  • Newbie
  • Posts: 3
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Lastest members.
« Reply #9 on: August 04, 2009, 12:45:45 AM »
I have the same problem, no avatars displayed.  I tried the suggested custom code on SMF 2.0 RC1.2 --- SP 2.2.2 and it didnt like it. Got the following error:

Fatal error: Call to undefined function db_query() in /home/aafun/public_html/Sources/SPortal2.php(3218) : eval()'d code on line 3


Any idea if the Avatars will be included in the next builtin block?