vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Placing some vb elements into non-bv pages (https://vborg.vbsupport.ru/showthread.php?t=188443)

Lynne 08-19-2008 01:59 PM

Quote:

Originally Posted by Chris11987 (Post 1602193)
I'm trying to make this page outside of my forums directory.

You need to chdir to the forums directory:

PHP Code:

chdir ('/path/to/your/forums'); 
require_once(
'./global.php'); 


Chris11987 08-19-2008 06:08 PM

I did that and the page is coming up without error now, but nothing from vb works when I place it on the page, like avatars for example. I tried this code for an avatar:

Code:

<table cellpadding="0" cellspacing="0" align="left" style="margin-top:5px;">
<tr>
<td><a href="$vbpoptions[bbdir]/profile.php?$session[sessionurl]do=editavatar"><img src="$vbpoptions[bbdir]/image.php?u=$bbuserinfo[userid]" alt="Your avatar" border="0" /></a>
</td>


Lynne 08-19-2008 06:45 PM

I don't believe that is the code to get you to the avatar. You are calling a script (image.php) not an image. You need to call an actual image in order to have an image displayed. Where did you get that code from?

Chris11987 08-19-2008 09:07 PM

From the article. What would be the proper code to display an avatar for a member if they were logged in?

Lynne 08-19-2008 09:56 PM

Quote:

Originally Posted by Chris11987 (Post 1602638)
From the article.

Hmmm, I tried to look but couldn't find it in there. Perhaps they were using an older version of vbulletin or something.

I'm not really sure what to use for the avatar. I looked in the postbit template and this is what is in there:
HTML Code:

<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
I'm not sure that the post variable is available to you. You may have to replace that with $user and see if that works.

Dismounted 08-20-2008 05:31 AM

Avatars can be accessed using image.php - but only if avatars are stored in the database. You can access avatars stored in the file system using fetch_avatar_url().

Chris11987 08-20-2008 10:16 AM

Mine are stored as files, so I'd need to use fetch. Can you give me the exact code (using an example file path) I would need for an avatar to appear?

Lynne 08-20-2008 02:52 PM

Take a look in member.php around line 395:

PHP Code:

// AVATAR
$avatarurl fetch_avatar_url($userinfo['userid']);

if (
$avatarurl == '' OR !$vbulletin->options['avatarenabled'] OR ($avatarurl['hascustom'] AND !($userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar']) AND !$userinfo['adminavatar']))
{
    
$show['avatar'] = false;
}
else
{
    
$show['avatar'] = true;
    
$userinfo['avatarsize'] = $avatarurl[1];
    
$userinfo['avatarurl'] = $avatarurl[0];


Does that help?

Chris11987 08-21-2008 04:23 AM

I then get this error:

Fatal error: Call to undefined function fetch_avatar_url() in ********************** on line 16


I'm using this code in the header:

PHP Code:

<?php
    chdir 
('./forums'); 
    require_once(
'./global.php'); 
?>


Dismounted 08-21-2008 05:23 AM

You need to include the user functions to be able to use it:
PHP Code:

require_once(DIR '/includes/functions_user.php'); 



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

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.01546 seconds
  • Memory Usage 1,747KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete