vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Execute Hook Location or add code (https://vborg.vbsupport.ru/showthread.php?t=129409)

Rich 10-18-2006 04:39 PM

Execute Hook Location or add code
 
Hello,

I am not sure if this is possible, but I had an ide. I am using the Journal Modification. Currently, when the call to display the journalpage template is made, it has already called on the avatar by using this code:

Code:

                require_once(DIR . '/includes/functions_user.php');
                $avatar = fetch_avatar_url($journalinfo['journalist_id']);
                if ($avatar == '')
                {
                $show['avatar'] = false;
                }
                else
                {
                $show['avatar'] = true;
        //        $userinfo['avatarsize'] = $avatarurl[1];
                $avatarurl = $avatar[0];
                }

Is it possible to do the same type of coding to call upon the profile picture? I can get the profile image that is in use to display, but I can't get it to change when the user has updated it or deleted it. I know this has to do with the dateline, but I am not sure how that is incorporated.

I was thinking that it may be impossible to insert a hook location prior to the template being called. If this is possible, I am trying to learn WHICH hook to call and how I would call the data in the template.

I am not sure if this is even possible.

I have reviewed the hooks tutorial and I have also reviewed the member.php file trying to see how they handle the profile pictures.

I am not afraid to modify php files, so feel free to get me editting.

I would appreciate any assistance with this. Thanks.

Paul M 10-18-2006 06:06 PM

This seems to be the code to get the profile pic ;

PHP Code:

if ($vbulletin->options['usefileavatar'])
{
    
$userinfo['profilepicurl'] = $vbulletin->options['profilepicurl'] . '/profilepic' $userinfo['userid'] . '_' $userinfo['profilepicrevision'] . '.gif';
}
else
{
    
$userinfo['profilepicurl'] = 'image.php?' $vbulletin->session->vars['sessionurl'] . 'u=' $userinfo['userid'] . "&dateline=$userinfo[profilepicdateline]&type=profile";


As best I can tell from a quick look, you need to call $somevar = fetch_userinfo(<userid>,8) first to get the details, and then change $userinfo to $somevar in the code above.

This is all untested, just a quick look at the code.

Rich 10-18-2006 09:20 PM

I couldn't get it to work and I played with it for 45 minutes. I know I am doing something wrong as I am pretty new to this. I can edit templates all day, but the PHP bites me in the ass.

TheMilkCarton 04-23-2007 12:37 AM

Wasn't really sure if I should bump this.. but what the heck.

I was looking to do the same thing for the Journal, and I think I've got it figured out.
PHP Code:

$profpic fetch_userinfo($journalinfo['journalist_id']);
        if (
$vbulletin->options['usefileavatar'])
        {
            
$profpic['profilepicurl'] = $vbulletin->options['profilepicurl'] . '/profilepic' $profpic['userid'] . '_' $profpic['profilepicrevision'] . '.gif';
        }
        else
        {
            
$profpic['profilepicurl'] = 'image.php?' $vbulletin->session->vars['sessionurl'] . 'u=' $profpic['userid'] . "&amp;dateline=$profpic[profilepicdateline]&amp;type=profile";
        }  
        if (
$profpic['profilepicrevision'] == '0')
        {
         
$show['profilepic'] = false;
        }
        else
        {
         
$show['profilepic'] = true;
         } 

Then in my journal_journalpage template:

Code:

<if condition="$show['profilepic']"><td class="alt2" nowrap="nowrap" align="top">
<img src="$profpic[profilepicurl]" $profpic[profilepicsize] alt="$profpic[username]" border="0" />
                </td></if>

It seems to work fine, but I've only tested this with Profile Pics in the filesystem, and also the $show['profilepic'] code I used is filesystem specific. I couldn't figure out any other way to keep the dreaded "Red X" from showing in IE.

Big thanks to Paul M for helping and Rich for asking!!


All times are GMT. The time now is 01:29 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.00953 seconds
  • Memory Usage 1,734KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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