Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2013, 08:43 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 06-16-2013, 11:06 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Which hook did you use for your plugin?
Reply With Quote
  #3  
Old 06-16-2013, 02:28 PM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
Which hook did you use for your plugin?

private_messagelist_messagebit
Reply With Quote
  #4  
Old 06-16-2013, 03:30 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works just fine for me (although the avatars are huge - you probably want the thumbnail size ones).
Reply With Quote
  #5  
Old 06-17-2013, 08:38 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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
Reply With Quote
  #6  
Old 06-17-2013, 09:05 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)





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

Attached Images
File Type: png pm_av1.png (25.0 KB, 0 views)
File Type: png pm_av2.png (18.7 KB, 0 views)
Reply With Quote
  #7  
Old 06-17-2013, 12:01 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
2 благодарности(ей) от:
Lynne, sadiq6210
  #8  
Old 06-18-2013, 07:08 PM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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
Reply With Quote
  #9  
Old 06-18-2013, 08:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);
Reply With Quote
  #10  
Old 06-19-2013, 05:59 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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:
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05859 seconds
  • Memory Usage 2,286KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete