Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2006, 04:39 PM
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Location: U.S.A
Posts: 921
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 10-18-2006, 06:06 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 10-18-2006, 09:20 PM
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Location: U.S.A
Posts: 921
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 04-23-2007, 12:37 AM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!!
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 01:27 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.03793 seconds
  • Memory Usage 2,205KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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_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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete