Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-06-2009, 09:40 AM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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" />

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?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04706 seconds
  • Memory Usage 2,205KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete