vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Cant Pull Avatars from the Database? (https://vborg.vbsupport.ru/showthread.php?t=200856)

Jaxel 01-06-2009 09:40 AM

Cant Pull Avatars from the Database?
 
For the comments on one of my mods, I am using the following code to pull avatars from comment bits... (they should really make the code width boxes bigger)

Code:

$comments = $db->query_read("
        SELECT comment.*, IF(NOT ISNULL(user.userid), user.username, comment.postusername) AS username,
                user.avatarrevision AS avatarrevision, avatar.avatarpath AS avatarpath, NOT ISNULL(customavatar.userid) AS hascustom,
                customavatar.dateline AS avatardateline, customavatar.width_thumb AS width_thumb, customavatar.height_thumb AS height_thumb
        FROM " . TABLE_PREFIX . "videocomment AS comment
        LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = comment.postuserid)
        LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid)
        LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)
        WHERE comment.videoid = '" . $videoinfo['videoid'] . "' AND comment.state = 'visible'
        ORDER BY comment.dateline DESC
        LIMIT " . ($limitlower - 1) . ", $perpage
");

$bbcode_parser_comment =& new vB_BbcodeParser($vbulletin, fetch_tag_list());
$thumb = true;

while ($comment = $db->fetch_array($comments))
{
        $comment['message'] = $bbcode_parser_comment->parse($comment['message'], 'videodirectory_reply');
        $comment['date'] = vbdate($vbulletin->options['dateformat'], $comment['dateline']);
        $comment['time'] = vbdate($vbulletin->options['timeformat'], $comment['dateline']);
        $show['deletionlink'] = ($permissions['videodirectorypermissions'] & $vbulletin->bf_ugp_videodirectorypermissions['canmoderate']);

        fetch_musername($comment);

        if (!empty($comment['avatarpath']))
        {
                $comment['avatar'] = array($comment['avatarpath']);
        }
        else if ($comment['hascustom'])
        {
                $avatarurl = array('hascustom' => 1);
                if ($vbulletin->options['usefileavatar'])
                {
                        $comment['avatarurl'] = $vbulletin->options['avatarurl'] . ($thumb ? '/thumbs' : '') . "/avatar{$comment['postuserid']}_{$comment['avatarrevision']}.gif";
                }
                else
                {
                        $comment['avatarurl'] = "image.php?u=$comment[postuserid]&dateline=$comment[avatardateline]" . ($thumb ? '&type=thumb' : '') ;
                }
        }
        if ($thumb)
        {
                if ($comment['width_thumb'] AND $comment['height_thumb'])
                {
                        $avatarwidth = $comment['width_thumb'];
                        $avatarheight = $comment['height_thumb'];
                }
        }

        if (empty($comment['avatarurl']))
        {
                $comment['avatarurl'] = $stylevar['imgdir_misc'] . '/unknown.gif';
        }

        eval('$commentbits .= "' . fetch_template('video_commentbit') . '";');
}

It pulls the avatars from the file system no problem... but when pulling from the database, it gives a blank avatar. I dont mean the "unknown.gif"; I mean an empty avatar with nothing on it. You can see what I mean here: http://www.waltdisneyboards.com/vide...ootage-12.html The first comment has the unknown avatar, while the second comment has a blank avatar. Looking at the source code of that page, you will see that it clearly finds the avatar with the following code:
Code:

<img src="http://www.waltdisneyboards.com/avatars/wdbarnyvee.gif?dateline=1228446000&amp;type=thumb" class="alt2 avatar" border="0" alt="WDBArnyVee" />
http://www.waltdisneyboards.com/avat...amp;type=thumb
However, its just not displaying it on that page. Is there something I am missing? Do I need to give this script permission to display avatars from the database or something?

Lynne 01-06-2009 02:38 PM

My guess would be is has to do with the class fixed_width_avatar being defined as 60px and the avatar you are trying to show there is obviously larger than that.


All times are GMT. The time now is 01:07 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01011 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete