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 01-28-2007, 05:02 PM
PayBas PayBas is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Defining global variables in plugin.

What I need is a plugin that defines global variables, to be used for userprofilefields.


This needs to be done in a way that the variables are loaded in EVERY template. So I think it should be a plugin that uses the "global_start" hook. However I cannot get it working.
Here is an example of what code is present in some of my templates (such as postbit_legacy, memberinfo, search_resultbit etc etc).
Code:
<if condition="$pf_job"><img src="job.gif" /></if>
<if condition="$pf_employee"><img src="employee.gif" /></if>

<if condition="$pf_occu & 1"><img src="/images/1-0.gif" border="0" alt="" /></if>
<if condition="$pf_occu & 2"> <img src="/images/1-1.gif" border="0" alt=""></if>
<if condition="$pf_occu & 4"><img src="/images/2-0.gif" border="0" alt=""></if>
<if condition="$pf_occu & 8"><img src="/images/2-1.gif" border="0" alt=""></if>
<if condition="$pf_occu & 16"><img src="/images/3-0.gif" border="0" alt=""></if>
<if condition="$pf_occu & 32"><img src="/images/3-1.gif" border="0" alt=""></if>

<if condition="$pf_artpref">$pf_artpref</if>

and many more.
What I am looking for is a plugin that defines these variables (such as $pf_occu and $pf_job) as the profilefield ID's.

This is what I have so far:
PHP Code:
<plugin active="1">
<
title>Easy Config</title>
<
hookname>global_start</hookname>

<
phpcode><![CDATA[
$pf_job $post['field14'];
$pf_employee $post['field15'];
$pf_occu $post['field16'];
$pf_artpref $post['field17'];
]]></
phpcode>

</
plugin
Why is this plugin, in combination with the above posted template code, not working?

I don't want to modify the source php files, it HAS to be done in a plugin.

thx in advance.
Reply With Quote
  #2  
Old 01-30-2007, 08:37 PM
PayBas PayBas is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

there's got to be SOMEONE who knows more about this kind of stuff

im pretty much stuck here
Reply With Quote
  #3  
Old 01-30-2007, 09:00 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

There is no such array as $post available to the global_start hook, you would need to use $vbulletin->userinfo['field14'] etc.
Reply With Quote
  #4  
Old 01-31-2007, 01:15 AM
PayBas PayBas is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No luck

plugin hook: global_start
PHP Code:
$pf_level $vbulletin->userinfo['field8']; 
in templates:
Code:
<if condition="$pf_level">$pf_level</if>
I didn't expect this to work since $vbulletin->userinfo['field8'] is kind of a weird variable to call in a postbit template for example. But what I should do... dono.
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:20 PM.


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.07702 seconds
  • Memory Usage 2,195KB
  • 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_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
  • 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