Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 06-19-2013, 06:06 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good document markup helps, looks like you were missing a ; on your line 7, I added it, formatted it, and moved the require_once inside of the conditional.


PHP Code:
if (THIS_SCRIPT == 'private')
{
    require_once(
'./includes/functions_user.php');
    
$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];
    }

Reply With Quote
Благодарность от:
Lynne
  #12  
Old 06-19-2013, 09:10 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Zachery

The error gone but in sent folder all avatars is (unknown.gif)
see the screen-shot for sent folder


  • In inbox, the username shown under the PM title is for the person who sent the PM for me. so I want to show the avatar for that username (who sent the PM for me)
  • In sent folder, the username shown under the PM title is for the person who will receive my PM, so I want to show the avatar for that username (who will receive my PM)
Attached Images
File Type: png PM_AV3.png (11.3 KB, 0 views)
Reply With Quote
  #13  
Old 06-19-2013, 09:54 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sadiq6210 View Post
Thanks Zachery

The error gone but in sent folder all avatars is (unknown.gif)
see the screen-shot for sent folder
That's my fault. After all that, it turns out my solution is wrong. There is actually an array of "to" users, so I don't know what you would want to display if the message has been sent to more than one user. But a better way to check if you are viewing the Sent folder is to check the folder id, so you could do something like this:

PHP Code:
if (THIS_SCRIPT == 'private')
{
    require_once(
'./includes/functions_user.php');
    if (
$folderid != -1)
    {
        
$avid $pm['fromuserid'];
    }
    else
    {
        
// This is the Sent folder, so find the first userid 
       // that is not the viewing user, checking first 'cc' 
       // then 'bcc' users.
        
$tousers unserialize($pm['touserarray']);
        if (!empty(
$tousers))
        {
            
$toids = (empty($tousers['cc']) ? array() : $tousers['cc']);
            if (!empty(
$tousers['bcc']))
            {
                
$toids array_merge($toids$tousers['bcc']);
            }
            foreach (
$toids AS $id => $username)
            {
                if (
$id != $vbulletin->userinfo['userid'])
                {
                   
$avid $id;
                    break;
                }
            }
        }
    }
    
$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];
    }

Reply With Quote
Благодарность от:
Lynne
  #14  
Old 06-19-2013, 10:40 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
That's my fault. After all that, it turns out my solution is wrong. There is actually an array of "to" users, so I don't know what you would want to display if the message has been sent to more than one user. But a better way to check if you are viewing the Sent folder is to check the folder id, so you could do something like this:

PHP Code:
if (THIS_SCRIPT == 'private')
{
    require_once(
'./includes/functions_user.php');
    if (
$folderid != -1)
    {
        
$avid $pm['fromuserid'];
    }
    else
    {
        
// This is the Sent folder, so find the first userid 
       // that is not the viewing user, checking first 'cc' 
       // then 'bcc' users.
        
$tousers unserialize($pm['touserarray']);
        if (!empty(
$tousers))
        {
            
$toids = (empty($tousers['cc']) ? array() : $tousers['cc']);
            if (!empty(
$tousers['bcc']))
            {
                
$toids array_merge($toids$tousers['bcc']);
            }
            foreach (
$toids AS $id => $username)
            {
                if (
$id != $vbulletin->userinfo['userid'])
                {
                   
$avid $id;
                    break;
                }
            }
        }
    }
    
$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];
    }

Wow :up: working perfect as a charm

Thanks dear
Can I use your code in my mod that I will release to the public here in vb.org?
Reply With Quote
  #15  
Old 06-19-2013, 10:42 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sadiq6210 View Post
Can I use your code in my mod that I will release to the public here in vb.org?
You can use that code in your mod. But you might want to come up with some way to indicate if a message was sent to more than one user. (or not, if it doesn't bother you ).
Reply With Quote
  #16  
Old 06-19-2013, 10:50 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
You can use that code in your mod. But you might want to come up with some way to indicate if a message was sent to more than one user. (or not, if it doesn't bother you ).
Although it is not bothering me, I will try to find a solution because I want to release it to the public.

Thanks Kevin

You must 'Like' someone else's post before liking any more by kh99.
Reply With Quote
  #17  
Old 06-19-2013, 11:23 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sadiq6210 View Post
Although it is not bothering me, I will try to find a solution because I want to release it to the public.
You could release it and wait to see if anyone else cares. Maybe no one will request it.
Reply With Quote
Reply


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 08:41 AM.


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.05776 seconds
  • Memory Usage 2,291KB
  • 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
  • (3)bbcode_php
  • (5)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
  • (7)post_thanks_box
  • (2)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (1)postbit_attachment
  • (7)postbit_onlinestatus
  • (7)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
  • 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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete