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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-25-2008, 04:04 AM
Jacob B Jacob B is offline
 
Join Date: Aug 2008
Location: Australia
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default fetch_avatar_url()

I'm looking for a way to fetch a users avatar to display inside a modification, a ticket support system. I've done a search and been through about 60+ pages of avatar modifications and can't find the actual code for it. I'm not exactly sure where I would need to insert the code into the PHP file, plus using the avatar conditional (<if condition="$show['avatar']">) doesn't seem to work on the modification.

Basically, this is how I've got it setup. This is the "ticket_display" template:

PHP Code:
<if condition="$issue[status]==0">

<
img src="$stylevar[imgdir_button]/threadclosed.gif" border="0" alt"" />

</if>
<
table border="0" cellpadding="0" cellspacing="0" width="100%">
<
tr>
<
td valign="top">

<
table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" style="border-bottom-width:0px">
<
tr align="left">
    <
th class="tcat" width="100%">
        
$issue[title]
    </
th>
<if 
condition="$show['member']">
    <
th class="vbmenu_control" id="issuetools" nowrap="nowrap">
        <
a href="$vbptions[bburl]/issue.php?$session[sessionurl]do=issuetools">Issue Tools</a>
        <
script type="text/javascript">vbmenu_register("issuetools");</script>
    </
th>
</if>
</
tr>
</
table>

<
table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%">
<
tr>
    <
td class="thead normal">
     
    <if 
condition="$show['can_delete_issues'] OR $show['can_delete_any_issues']">
    <
div style="float:right">
    [<
a href="$vboptions[bburl]/issue.php?$session[sessionurl]do=delete&amp;id=$_REQUEST[id]">Delete</a>]
    </
div>
    </if>
        
        <
img src="$stylevar[imgdir_statusicon]/post_new.gif" alt="#$_REQUEST[id]class="inlineimg" />
        
$ticket[datelogged]
    </
td>
</
tr>
<
tr valign="top">
    <
td class="alt2">
        <
table cellpadding="0" cellspacing="6" border="0" width="100%">
        <
tr>
            <
td class="alt2">
            <if 
condition="$show['avatar']">
            <
a href="$vboptions[bburl]/member.php?$session[sessionurl]u=$issue[ownerid]"><img src="$vboptions[bburl]/image.php?u=$issue[ownerid]alt="" border="0" />
</if>






</
td>
            <
td nowrap="nowrap" width="100%">

                <
div id="notemenu_68661">
            
                        <
class="bigusername" href="$vboptions[bburl]/member.php?$session[sessionurl]u=$issue[ownerid]">$issue[ownerusername]</a>
                        
                            
                            
                            
                        
                    
                </
div>
                <
div class="smallfont">Posted <span class="time">$issue[datelogged]</span></div>
            </
td>
        </
tr>
        </
table>
    </
td>
</
tr>
<
tr>
    <
td class="alt1" valign="top">
    
        <
div style="font-size:12pt">$issue[title]</div>
        <
div><strong></strong></div>
        <
hr style="border:0px; height:1px; color:#D1D1E1; background-color:#D1D1E1" />
        <
div>$issue[message]</div>
        
        <
div class="smallfont" align="right" style="margin-top:12px">
            <
div style="float:left" align="left">
                
                
                
            </
div>
            <if 
condition="$show['can_edit_issues'] OR $show['can_edit_any_issues']">
            <
a href="$vboptions[bburl]/issue.php?$session[sessionurl]do=edit&amp;id=$_REQUEST[id]"><img src="$stylevar[imgdir_button]/edit.gif" alt="Edit" border="0" /></a>
</if>
            
        </
div>
    
    </
td>
</
tr>


</
table>



</
td>
</
tr>
</
table>



<
br />
<
a name="comments"></a>
<
div style="font-size:12pt">Comments</div>
<
div style="height:3px">&nbsp;</div
For some reason using the 'avatar' conditional is hindering the ability to display the user's avatar. It simply doesn't show. I've never written the PHP code to fetch an avatar. I've tried this code only it results in a database error:

PHP Code:
require_once('./includes/init.php');
require_once(
'./includes/functions_user.php');
$issue['owner_avatar']=fetch_avatar_url($issue['ownerid']);
if (
$issue['owner_avatar']=='') ($bbuserinfo['owner_avatar']='images/misc/noavatar.gif'); 
$issue['owner_avatar']="<img src='$vboptions[bburl]/{$issue['owner_avatar']}' border='0'>";
$issue['owner_avatar']="<a href='$vboptions[bburl]/profile.php?{$session['sessionurl']}&do=editavatar'>{$issue['owner_avatar']}</a>";
$issue_avatar=$issue['owner_avatar']; 
How do I fetch the avatar? Sorry to ask guys, but this is driving me insane. I can't use $bbuserinfo because that will only display the avatar of the user browsing the actual modification.
Reply With Quote
  #2  
Old 09-25-2008, 04:36 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You know that fetch_avatar_url() returns an array, right?
Reply With Quote
  #3  
Old 09-25-2008, 04:54 AM
Jacob B Jacob B is offline
 
Join Date: Aug 2008
Location: Australia
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have no idea, that's why I'm asking. lol
Reply With Quote
  #4  
Old 09-25-2008, 05:45 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, if you're using a function you have no idea about, why don't you have a look at it first?
Reply With Quote
  #5  
Old 09-25-2008, 06:22 AM
Jacob B Jacob B is offline
 
Join Date: Aug 2008
Location: Australia
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's the thing, I'm not using it. I'm asking you kindly if you could possibly point me in the right direction as to where I can find how to use it and how to impliment it into my PHP file. I've been through API and found nothing relevant in regard to what I'm looking for, and what I require.

I'm not a vBulletin expert, so I do require help from time to time. I'm a grunt, not a development engineer. I'm looking for the code that I would be required to write into my product to fetch a user's avatar to display inside the modification for each issue and reply posted. Nothing more, nothing less. So for example, if a user posted a support issue, I would write the following to display his/her relevant avatar if applicable:

PHP Code:
<if condition="$show['avatar']">
<
a href="$vboptions[bburl]/member.php?$session[sessionurl]u=$issue[ownerid]"><img src="$vboptions[bburl]/image.php?u=$issue[ownerid]alt="Avatar" title="$issue[ownerusername]'s Avatar" border="0" /></a>
</if> 

As I explained, the conditional <if condition="$show['avatar']"> doesn't appear to work in this modification. I find it strange because both 'member' and 'guest' conditionals function correctly inside the modification, so I don't quite understand why the 'avatar' conditional does not work. My first thought was 'Perhaps I need to write a table or something to fetch the user's avatar?' as if I cannot get conditionals to work, then I am unsure of other options.

So if anybody has any information as to why the 'avatar' conditional does not work, and how I can get it to function correctly, it would be greatly appreciated.
Reply With Quote
  #6  
Old 09-25-2008, 07:28 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$show['avatar'] doesn't work because it's not defined . And yes, you do have to fetch the avatar. The API doesn't really do much apart from listing arguments and what file it's in, so go into the file itself and look what happens.
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 01:25 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.03719 seconds
  • Memory Usage 2,270KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (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_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
  • 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