Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 01-24-2010, 10:35 PM
David Regimbal David Regimbal is offline
 
Join Date: May 2009
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Avatar URL Variable?

Hi everyone,

I did some searching and couldn't find what I was looking for. Is there a variable that will display the avatar's URL?

something like {vb:raw bbuserinfo.avatar_url}
Reply With Quote
  #2  
Old 01-26-2010, 09:46 AM
MARCO1's Avatar
MARCO1 MARCO1 is offline
 
Join Date: Jun 2008
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I Sure it's needs a database query. If I had a time I will make it for you.
Reply With Quote
  #3  
Old 07-06-2012, 01:54 PM
hoangserip's Avatar
hoangserip hoangserip is offline
 
Join Date: Jun 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have same ploblem like #1.
I need a variable to display avatar's URL, and i've asked "thanhdia", he have already answered me with my ploblem.
My forum version is 4.1.10.
Here is his answer: Create a new variable: {vb:raw cus_avatar} with new plugin.

1. Add new plugin with Template Hook is parse_templates with code:
Code:
if ($vbulletin->userinfo['userid'])
{
    require_once('./includes/functions_user.php');
    $avatar_url = fetch_avatar_url($vbulletin->userinfo['userid']);

  $avatar = $avatar_url[0];
  $cus_avatar = '<a href="profile.php?do=editavatar"><img src="'.$avatar.'" border="0" alt="" /></a>';

  $templater = vB_Template::create('yourtemplate');
  $templater->register('cus_avatar', $cus_avatar);
  vB_Template::preRegister('yourtemplate',array('cus_avatar' => $cus_avatar));
  $templater->render();
}
2. yourtemplate is the name of the template which you want to add the newvariable. Replace it ^^!
Ex: header...
Active new plugin which you have created. OK
3. Final, just need add the variable {vb:raw cus_avatar} at anywhere on your template which you replace in code.


But... some new problem is appear. Mod "Two columns of categories - by rellect" is conflict with this plugin. >"<
Now I want to discuss with everybody to fix it. Help me. Thanks a lot! ^^!
Reply With Quote
  #4  
Old 07-06-2012, 04:09 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What problem happens when using "Two columns of categories"?

The code you posted doesn't make sense - it is calling both register() and preRegister() for the same template, which isn't necessary. Also, it calls render() but doesn't do anything with the output.
Reply With Quote
  #5  
Old 07-07-2012, 09:46 AM
hoangserip's Avatar
hoangserip hoangserip is offline
 
Join Date: Jun 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So what should I do with that code? How should I fix it?
I'm bad in PHP ^^! Thanks for help
Reply With Quote
  #6  
Old 07-07-2012, 11:59 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I guess if "youtemplate" is an existing vb template or one that's being rendered somewhere else, you'd want just the preRegister, like:

Code:
if ($vbulletin->userinfo['userid'])
{
    require_once('./includes/functions_user.php');
    $avatar_url = fetch_avatar_url($vbulletin->userinfo['userid']);

  $avatar = $avatar_url[0];
  $cus_avatar = '<a href="profile.php?do=editavatar"><img src="'.$avatar.'" border="0" alt="" /></a>';

  vB_Template::preRegister('yourtemplate',array('cus_avatar' => $cus_avatar));
}

In any case I don't know why it would interfere with another mod.
Reply With Quote
Благодарность от:
hoangserip
  #7  
Old 07-07-2012, 01:26 PM
hoangserip's Avatar
hoangserip hoangserip is offline
 
Join Date: Jun 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, that was my problem, that plugin didn't interfere with another mod. ^^!
Thanks a lot!!
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 12:43 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.12606 seconds
  • Memory Usage 2,221KB
  • 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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (1)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete