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

[Block] Avatar of Users Online

Started by IchBin, December 01, 2008, 02:18:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IchBin

You should be able to add the font properties to the avatar_column or avatar_column td class.

cepsi

#41
this is a great little snippet was searching for something similiar to this but this is better than i had hoped to find :D

great job

edit* Not a major thing, but for some reason where my members have no avatar, instead of getting the default avatar (i uploaded an avatar named default_avatar in gif format to my theme as you said) i am getting a 2px by 3px white line of the gender color (ie girls are a pink line, guys blue line and genderless is  default black)
All members with avatars are working fine though :)

i attached a screen shot. Not a big deal but thought i should post. I copied your marquee code from your first post

once again great snippet :D

fl4pj4ck

that can only mean one thing - you provided incorrect path/filename to the default avatar

cepsi

yeah i thought it may be something like that, the path i have to my default avatar  is this;

http://www.my site.com/forum/Themes/dark_4/images/default_avatar.gif

i tried putting into this but im only just starting to learn html and php, so extremely "challenged"

it should go here i guess .. this is what i have done tothis part of the code and obv its not working and help appreciated this is a great snippet may as well get it working properly

<img class="'.$css.'" src="'.$settings['images_url'].'forum/Themes/dark_4/images/default_avatar.gif" width="'.$width.'" height="'.$height.'" alt=""

ty

JPDeni

Try


<img class="'.$css.'" src="'.$settings['images_url'].'default_avatar.gif" width="'.$width.'" height="'.$height.'" alt=""


If that doesn't work, try doing a right-click on the missing image thing and look at the Properties. (Or view the source for your page.) Compare the URL to the image with the URL where you know the image is. There will likely be duplication of some of the code.

IchBin

If you left the code as it was originally, all you have to do is put a default_avatar.gif inside the images directory of any theme you are going to use on your site.

--Deni beat me to it. But yes, that is the code. :)

cepsi

#46
ty guys :) i tried the cliking on the image trick before but the bloody thing was moving too quick cos the line is very small lmao (i also tried the FF webdeveloper  addon but no image was found) Still wont work with the code JP but as long as i know its path related i can concentrate my efforts till i get it right. thanks for the help and the quick replies.
:D

UPDATE i better post this just in case its not me (but likely is ;) this is the code (exactly) as i used it in the block;

global $memberContext, $db_prefix, $scripturl, $modSettings;

/* ###  CONFIGURATION OPTIONS  ### */
// Set time limit using seconds
// 1 hour = 3600
// 1 day = 84600
$timelimit = 84600;

// Set the height and width of avatars
// This will resize the avatars to be more uniform
$width = "40px";
$height = "40px";

// Set or change the style of all the elements
echo '<style type="text/css">
.avatar_column
{
border: 0;
}
.avatar_column td
{
height: 60px;
width: 60px;
overflow: hidden;
text-align: center;
vertical-align: top;
}
.default
{
border: 2px solid black;
}
.he
{
border: 2px solid blue;
}
.she
{
border: 2px solid pink;
}
</style>';

/* ###  END CONFIGURATION OPTIONS  ### */

// Load all users who have logged in within $timelimit
$result = db_query("
SELECT mem.ID_MEMBER, mem.showOnline, mem.lastLogin, mem.realName, mem.avatar, mem.gender, a.ID_ATTACH, a.attachmentType, a.filename
FROM ({$db_prefix}members as mem)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
WHERE mem.lastLogin > (UNIX_TIMESTAMP() - $timelimit)
ORDER BY mem.lastLogin DESC", __FILE__, __LINE__);

$users = array();

// Loop through the results to display the users avatar
while ($row = mysql_fetch_assoc($result))
{
    $users[$row['ID_MEMBER']] = array (
    'id' => $row['ID_MEMBER'],
    'href' => $scripturl.'?action=profile;u='.$row['ID_MEMBER'],
    'name' => $row['realName'],
    'show' => $row['showOnline'],
'gender' => $row['gender'],
    'avatar' => array(
    'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? 'src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['realName'].'" />' : '') : (stristr($row['avatar'], 'http://') ? 'src="' . $row['avatar'] . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['realName'].'" />' : 'src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['realName'].'" />'),
    ),
    );
}

mysql_free_result($result);

echo '
<marquee direction="left">
<table class="avatar_column">
<tr>';

foreach ($users as $user)
{
if ($user['show'] == 1)
{
switch ($user['gender'])
{
case 0:
$css = "default";
break;
case 1:
$css = "he";
break;
case 2:
$css = "she";
break;
}
echo '
<td>',(empty($user['avatar']['image']) ? '<a href="'.$user['href'].'"><img class="'.$css.'" src="'.$settings['images_url'].'default_avatar.gif" width="'.$width.'" height="'.$height.'" alt="" title="'.$user['name'].'" /></a><h6>'.$user['name'].'</h6>' : '<a href="'.$user['href'].'"><img class="'.$css.'" '.$user['avatar']['image'].'</a><h6>'.$user['name'].'</h6>'),'</td>';

}
}

echo '
</tr>
</table>
</marquee>';


I found the image it was showing (the line) and got this returned on a 404

The requested URL /mysmforum/Themes/dark_4/imagesdefault_avatar.gif was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


i got it working by renaming and uploading  avatar renaming it  "imagesdefault_avatar.gif" lol, horrible shortcut i know but hey! im learning lol

JPDeni

Ah. Well, that explains it. You need a / in there.

Rename the image back to what it should be.

Use


<img class="'.$css.'" src="' . $settings['images_url'] . '/default_avatar.gif" width="' . $width.'" height="'.$height.'" alt=""
[/code[

fl4pj4ck

yup, let's see:
QuoteThe requested URL /mysmforum/Themes/dark_4/imagesdefault_avatar.gif was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

should be:
QuoteThe requested URL /mysmforum/Themes/dark_4/images/default_avatar.gif was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

FERNSIDEâ„¢

Yeah I was trying to figure out why the first code wasnt showing the default avatar, then I realised the code had   images/default_avatar.gif  when it was already calling from the images folder lol
So    $settings['images_url'].'/default_avatar.gif"    does the job.

I took the quick road and didnt read the thread, sorry if that was pointed out earlier

This website is proudly hosted on Crocweb Cloud Website Hosting.