vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Trying to display senders avatar (https://vborg.vbsupport.ru/showthread.php?t=329653)

Dave Strider 08-12-2023 11:02 PM

Trying to display senders avatar
 
I have the following code and it somewhat works:
Code:

                                if ($vbulletin->userinfo['userid']) {
                                        require_once(DIR . '/includes/functions_user.php');
                                        $userid = $pm['fromuserid'];
                                        $pmavatar = fetch_avatar_url($userid);
                                        if (!$pmavatar) {
                                          $pmavatar = $stylevar['imgdir_misc'] . '/unknown.gif';
                                        }
                                        else {
                                          $pmavatar = $vbulletin->options['bburl'] . '/' . $pmavatar[0];
                                        }
                                }
                                else {
                                  $pmavatar = $vbulletin->options['bburl'] . '/image.php?u='.$userid.'&type=thumb';
                                }

however the output is the following:
https://img001.prntscr.com/file/img0...hHD5Wk30jg.png

The second avatar in the image should be in the first space while the third avatar should be in the second and third space as it's from the same user. I feel like I'm on the right track just don't know where to go from here, can anyone help?

Dr.CustUmz 08-13-2023 03:55 AM

well shit the advanced reply seems to be broke here so I cant attach images but, your thinking too hard for this =)

in private_messagelist_messagebit
all you need is a var to fetch the avatar, then display that var in the template. in example..

Plugin:
Code:

$drc_pmpic = fetch_avatar_url($userid);
then in the template pm_messagelistbit:
Code:

<img src="$drc_pmpic[0]" />
now that you got it you can style it however you wish =)

wrap your if conditions for a default pic and all that straight in the template, rather than in the php.

edit: got a pic for you =)

https://i.imgur.com/D1GPTd0.png

Dave Strider 08-26-2023 05:58 PM

Quote:

Originally Posted by Dr.CustUmz
snip

I would follow this same logic for the forum leaders page correct? I've attempted it and I can't seem to get it to work. I'm assuming there's some different logic happening there.


All times are GMT. The time now is 01:33 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.02275 seconds
  • Memory Usage 1,722KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete