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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2011, 01:17 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Getting custom phrase

The following is about the subscriptions.php in the Admin panel.

I have created the custom phrase "setting_zombaio_siteid_title" with content "Site ID".

An excerpt of the script:
PHP Code:
$phrasegroups = array('subscription''cpuser''stats');
//...
//test echo
var_dump$vbphrase["setting_zombaio_siteid_title"] ); 
The phrase is echoed as being null.
Do I have to load a certain phrase group to get this phrase?
How would I add the custom phrase that I created to the 'subscription' phrase group?
Reply With Quote
  #2  
Old 01-13-2011, 03:25 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think when you edit the phrase, for "Phrase Type" choose "Subscription Tools".

I don't know if there's any other way to know what Phrase Type matches which group name, but I did it by finding another phrase in that php file and searching for it to look at its type.
Reply With Quote
  #3  
Old 01-13-2011, 07:13 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The problem is because you're calling var_dump before this line:
Code:
require_once('./global.php');
The phrases don't contain any data until global.php is called.
Reply With Quote
  #4  
Old 03-08-2011, 05:07 PM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm also struggling to get my head around this

I am trying to access a phrase from within a vbA CMPS module I am writing

OK I know I could/should? ask this in the vbA forums but I thought you helpful lot could help me here?

I've had a look around in another php file (usercp.php) where the phrase I want is available in the $vbphrase array

However in my module the $vbphrase array does not contain the phrase I want.

Also the $vbphrase array in my custom module contains quite a lot of phrases whether I put require_once('./global.php'); in my file or not

I have also tried adding $phrasegroups = array('user', 'infractionlevel'); I got that from usercp.php so assume one of those phrasegroups contains the phrase I want to use?

None of this helped any

So I am also wondering where does this $vbphrase array get built and how do I choose what phrases I want to be in it?

I know I could get around all this hassle by putting the text string I want to use directly into my php (I only want to access a couple of phrases anyway) but I would like to know how to do it the proper way

cheers
Rich
Reply With Quote
  #5  
Old 03-08-2011, 05:39 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Search for the phrase in phrase manager in Admin CP and find out for sure what type of phrase it is.
Reply With Quote
  #6  
Old 03-08-2011, 05:50 PM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi BirdOfPrey

OK the two phrases are
you_have_pending_friend_requests_from_x

and

you_have_pending_friend_requests_from_x_and_y_more

which look like they are in User Tools (global) Phrases (or Standard Phrases, I'm not sure which is the phrase group)

Anyway for some reason these are there in $vbphrase in usercp.php but not there in $vbphrase in my custom vbA module - though $vbphrase does contain a lot of other phrases in my module (whether I put that ./global.php thing or not) - so it must have already been initialised somewhere...

Rich
Reply With Quote
  #7  
Old 03-08-2011, 07:43 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I searched my templates but I don't see where those phrases are actually used in vBulletin... Do you know where they would normally show up?
Reply With Quote
  #8  
Old 03-08-2011, 09:02 PM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmmm there is a lot of stuff on my very customised site that was previously modified by another guy who did a bunk and left me to pick up the mess

So of course I sometimes don't know what is original vbulletin code and what is not

Looks like maybe I found some more of his modded stuff

However those phrases are showing up in $vbphrase while in my usercp.php file so he must have declared (or added them) somewhere

Perhaps if you could point me to documentation explaining the general mechanism involved and where this array originates I can work out what he did

Rich
Reply With Quote
  #9  
Old 03-09-2011, 12:38 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have those phrases in my stock vbulletin, they exist in my phrase manager and yes are in user tools (global).

However no where in any templates can I find them being used.

It's possible they are used in a php file, not a template... or maybe old phrases from earlier vBulletin version not used anymore.

LOL at documentation, I don't deal with that. There's the manual but I doubt it will be of much use.

I would look in functions.php file at:
Code:
function init_language()
That function builds the $vbphrase array.
Reply With Quote
  #10  
Old 03-09-2011, 03:01 PM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Joe

It's always nice to have somewhere to start looking

Rich
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:16 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.04383 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
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)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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