PDA

View Full Version : Getting custom phrase


squishi
01-13-2011, 01:17 PM
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:
$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?

kh99
01-13-2011, 03:25 PM
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.

BirdOPrey5
01-13-2011, 07:13 PM
The problem is because you're calling var_dump before this line:
require_once('./global.php');
The phrases don't contain any data until global.php is called.

richy96
03-08-2011, 05:07 PM
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

BirdOPrey5
03-08-2011, 05:39 PM
Search for the phrase in phrase manager in Admin CP and find out for sure what type of phrase it is.

richy96
03-08-2011, 05:50 PM
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

BirdOPrey5
03-08-2011, 07:43 PM
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?

richy96
03-08-2011, 09:02 PM
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

BirdOPrey5
03-09-2011, 12:38 PM
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:
function init_language()

That function builds the $vbphrase array.

richy96
03-09-2011, 03:01 PM
Thanks Joe

It's always nice to have somewhere to start looking

Rich