vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Show avatar in PM, I wrote the plugin but there is error ! (https://vborg.vbsupport.ru/showthread.php?t=299169)

sadiq6210 06-16-2013 08:43 AM

Show avatar in PM, I wrote the plugin but there is error !
 
Hi dears,
I want to write a plugin to show the user avatars in PM list (inbox/outbox....etc)

I added this plugin:

Code:

require_once('./includes/functions_user.php');
if (THIS_SCRIPT == 'private')
{
  $pm[avatarurl] = fetch_avatar_url($pm['fromuserid']);
    if (!$pm[avatarurl]) {
                    $pm[avatarurl] = $stylevar['imgdir_misc'] . 'images/misc/unknown.gif';
                  } else {
                    $pm[avatarurl] = $vbulletin->options['bburl'] . '/' . $pm[avatarurl][0];
                  }
}


Then I added this to template(pm_messagelistbit)
Code:

<img src="{vb:raw pm.avatarurl}" />

It is working and the avatar shows but only in first row !
I mean there is avatar only in FIRST pm (one avatar in each page).

Any help?

kh99 06-16-2013 11:06 AM

Which hook did you use for your plugin?

sadiq6210 06-16-2013 02:28 PM

Quote:

Originally Posted by kh99 (Post 2428453)
Which hook did you use for your plugin?


private_messagelist_messagebit

Lynne 06-16-2013 03:30 PM

It works just fine for me (although the avatars are huge - you probably want the thumbnail size ones).

sadiq6210 06-17-2013 08:38 AM

Quote:

Originally Posted by Lynne (Post 2428513)
It works just fine for me (although the avatars are huge - you probably want the thumbnail size ones).

It was from a mod, this issue solved after I disable this mod
https://vborg.vbsupport.ru/showthread.php?t=277502

I will contact with Joe

Thanks Lynne. Thanks Kevin :)

sadiq6210 06-17-2013 09:05 AM

1 Attachment(s)
I faced another issue

In inbox it is working perfect
but in (send folder / outbox) it shows the avatar for sender (my avatar)

I want to show the avatar for the user who will receive the message.

This is the Inbox (OK)

https://vborg.vbsupport.ru/attachmen...1&d=1371463500



This is the send folder (All shows my avatar only!)

https://vborg.vbsupport.ru/attachmen...1&d=1371463500

kh99 06-17-2013 12:01 PM

Maybe you could do something like:
Code:

$avid = $pm['fromuserid'];
if ($avid == $vbulletin->userinfo['userid'])
{
  $avid = $pm['touserid']
}

Then use $avid in place of $pm['fromuserid'] in the rest of your plugin code.

sadiq6210 06-18-2013 07:08 PM

Quote:

Originally Posted by kh99 (Post 2428675)
Maybe you could do something like:
Code:

$avid = $pm['fromuserid'];
if ($avid == $vbulletin->userinfo['userid'])
{
  $avid = $pm['touserid']
}

Then use $avid in place of $pm['fromuserid'] in the rest of your plugin code.

I am confused
Sorry Kevin but could you please explain this more?
Should I add the previous code to the same plugin?

Thanks very much

Lynne 06-18-2013 08:12 PM

You would add it above this line:
$pm[avatarurl] = fetch_avatar_url($pm['fromuserid']);

But also change that line to:
$pm[avatarurl] = fetch_avatar_url($avid);

sadiq6210 06-19-2013 05:59 AM

Quote:

Originally Posted by Lynne (Post 2428999)
You would add it above this line:
$pm[avatarurl] = fetch_avatar_url($pm['fromuserid']);

But also change that line to:
$pm[avatarurl] = fetch_avatar_url($avid);

So I need to modify the plugin only?
I did but it is not working, all avatars is broken and I got this error above the page

Code:


Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8

Parse error: syntax error, unexpected '}' in /home/userhere/public_html/forum/private.php(2274) : eval()'d code on line 8


This is the plugin after modified

Code:

require_once('./includes/functions_user.php');
if (THIS_SCRIPT == 'private')
{
$avid = $pm['fromuserid'];
if ($avid == $vbulletin->userinfo['userid'])
{
  $avid = $pm['touserid']
}
  $pm[avatarurl] = fetch_avatar_url($avid);
    if (!$pm[avatarurl]) {
                    $pm[avatarurl] = $stylevar['imgdir_misc'] . 'images/misc/unknown.gif';
                  } else {
  $pm[avatarurl] = $vbulletin->options['bburl'] . '/' . $pm[avatarurl][0];
                  }
}

:erm:


All times are GMT. The time now is 03:51 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.01095 seconds
  • Memory Usage 1,749KB
  • 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
  • (6)bbcode_code_printable
  • (4)bbcode_quote_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