vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   What am I doing wrong? (https://vborg.vbsupport.ru/showthread.php?t=33181)

LanciaStratos 12-13-2001 10:21 PM

I'm trying to create a hack which displays member's avatars in memberlist.php. So, in memberlist.php, where it says this...
PHP Code:

    if ($userinfo[receivepm]) {
      eval(
"\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
    } else {
      
$userinfo[pmlink] = " ";
    }

    eval(
"\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";"); 

...I changed it to this...
PHP Code:

    if ($userinfo[receivepm]) {
      eval(
"\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
    } else {
      
$userinfo[pmlink] = " ";
    }

    if (
$userinfo[avatar]) {
      eval(
"\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
    } else {
      
$userinfo[avatar] = " ";
    }

    eval(
"\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";"); 

After I uploaded the new memberlist.php, I edited my memberlistbit template, and stuck $userinfo[avatar] where I wanted the avatar to show up. But, nothing happened! Can anyone show me what I did wrong here? :stupid:

Gimp 12-14-2001 10:38 AM

hmm im not sure why but maybe try to use a variable w/o array
ie $avatar
and are u sure $userinfo[avatar] is actually the avatar?

try this:
PHP Code:

$theavatar=getavatarurl($bbuserinfo[userid]);

if (
$theavatar!='') {
      eval(
"\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
    } else {
      
$theavatar " ";
    }

    eval(
"\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";"); 


Admin 12-14-2001 10:56 AM

Code:

$[high]avatarurl[/high]=getavatarurl($[high]userinfo[/high][userid]);

if ($[high]avatarurl[/high]!='') {
      eval("\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
    } else {
      $[high]userinfo[avatar][/high] = " ";
    }

    eval("\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";");

$bbuserinfo is the info of the user viewing the page.

And [high]avatarurl[/high] because that's what postbit_avatar uses.

Admin 12-14-2001 11:08 AM

Also using getavatarurl() adds an extra query whenever its run, so in a list with lots of members the page will really slow down.

Anyway, here's how you do it.
In memberlist.php, add this:
Code:

    if ($userinfo[avatarid]!=0) {
      $avatarurl=$userinfo[avatarpath];
    } else {
      if ($userinfo[hascustomavatar] and $avatarenabled) {
        $avatarurl="avatar.php?userid=$userinfo[userid]&dateline=$userinfo[avatardateline]";
      } else {
        $avatarurl="";
      }
    }
    if ($avatarurl=="" or ($bbuserinfo[userid]>0 and !($bbuserinfo[showavatars]))) {
      $userinfo[avatar]="";
    } else {
      eval("\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
    }

right after this:
Code:

    if ($userinfo[homepage]!="" and $userinfo[homepage]!="http://") {
Now replace this:
Code:

  $users=$DB_site->query("SELECT *
                          FROM user,userfield

with this:
Code:

  $users=$DB_site->query("SELECT *,avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline
                          FROM user,userfield
                                                  LEFT JOIN avatar ON avatar.avatarid=user.avatarid
                                                  LEFT JOIN customavatar ON customavatar.userid=user.userid

And now place $userinfo[avatar] in the memberlist template.

LanciaStratos 12-15-2001 02:58 PM

Oh, that's perfect, FireFly! Thanks for helping out a PHP-newbie! :)

HellRazor 03-23-2002 10:31 PM

This doesn't seem to display custom avatars tho... can anyone post a mod that will allow this to show them?

LanciaStratos 03-23-2002 10:41 PM

[QUOTE]Originally posted by HellRazor
This doesn't seem to display custom avatars tho... can anyone post a mod that will allow this to show them?

svoec 04-06-2002 12:09 AM

OK, i'm probably going to get smacked down for asking a stupid question, but where do you put $userinfo[avatar] in the template???

Thanks :cheeky: h
Eric C

LanciaStratos 04-06-2002 03:51 PM

[QUOTE]Originally posted by svoec
OK, i'm probably going to get smacked down for asking a stupid question, but where do you put $userinfo[avatar] in the template???

Thanks :cheeky: h
Eric C

svoec 04-06-2002 04:51 PM

that worked great, I was trying to edit the wrong template.

only problem is, it throws the columns off one row. Did I miss something?? or do I need to change another template??

Thanks again!
Eric C


All times are GMT. The time now is 03:30 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.01340 seconds
  • Memory Usage 1,748KB
  • 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
  • (5)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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