View Full Version : Avatars on none VB pages.
dannyb2100
09-01-2009, 01:19 PM
Hey all, I'm trying to get the avatar to link on a none vb page ??
Any help or ideas,
Code as follows
<img src="http://www.soulquestrpg.com/forum/image.php?u='.$vbulletin->userinfo[userid].'" alt="Your avatar" border="0" />
I would of thought $vbulletin->userinfo[userid],
Would call the userid but I'm getting 0,
Anyone ?
Lynne
09-01-2009, 02:08 PM
Where are you using that code - is it in a template or is it part of the php (don't use $vbulletin->userinfo in a template, use $bbuserinfo)? Are you trying to get the userid of the person viewing the page or ?? Did you include global.php in your page? You can't get the userid if you didn't.
dannyb2100
09-01-2009, 02:49 PM
Where are you using that code - is it in a template or is it part of the php (don't use $vbulletin->userinfo in a template, use $bbuserinfo)? Are you trying to get the userid of the person viewing the page or ?? Did you include global.php in your page? You can't get the userid if you didn't.
Its a none template page, its part of the php, global.php is included yes,
I'm trying to get the userid if the person viewing the page.
Lynne
09-01-2009, 03:02 PM
If you have included global.php, then $vbulletin->userinfo[userid] should work. Perhaps you should post up your code.
dannyb2100
09-01-2009, 03:14 PM
ok, Um, As par my sig I use VBB as my forum,
so its quite a complex system that mixes the two,
$curdir = getcwd ();
chdir('forum');
require_once('forum/global.php');
chdir ($curdir);
?>
Image Here ??
<table cellpadding="0" cellspacing="0" align="left" style="margin-top:5px;">
<tr>
<td>
<?php
echo '<img src="http://www.soulquestrpg.com/forum/image.php?u='.$vbulletin->userinfo[userid].'" alt="Your avatar" border="0" /></a>
</td>
</tr>
</table>';
Thats pretty much everything needed.
Lynne
09-01-2009, 03:52 PM
Once you chdir to the forum directory, you don't need it in your include statement for global:
chdir ('/forum');
require_once('./global.php');
dannyb2100
09-05-2009, 02:46 PM
Hey Lynn,
Thanks for the reply, I changed the code as you said,
but it's still feeding me back 0 as a userid........
Image Here ??
<table cellpadding="0" cellspacing="0" align="left" style="margin-top:5px;">
<tr>
<td>
<?php
echo '<a href="http://www.soulquestrpg.com/forum/profile.php?$session[sessionurl]do=editavatar"><img src="http://www.soulquestrpg.com/forum/image.php?u='.$vbulletin->userinfo[userid].'" alt="Your avatar" border="0" /></a>
</td>
</tr>
</table>';
echo $vbulletin->userinfo[userid];
I really dont know whats wrong................
Lynne
09-05-2009, 04:27 PM
Are you getting the rest of the table to output? You may need to make $vbulletin global in your code. It's kinda hard to tell with just that little bit you posted.
Also, you need to include global at the very top of your page, before you output anything else. Have you looked at this - [How-To] vBulletin API Basics: Creating Custom Pages & Misc. (https://vborg.vbsupport.ru/showthread.php?t=98009)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.