Log in

View Full Version : Modifying phrasegroup array from plug-in


mferguson
10-13-2006, 07:13 PM
I'm working on a product that has a custom phrase group and will present menu items in the User CP menu using this phrase group. The phrase group isn't loaded into the global phrase group so I would like to cause it to be added to the phrasegroups used for UserCP using a plugin. In the usercp.php code phrasegroups are loaded as:

// get special phrase groups
$phrasegroups = array('user', 'infractionlevel');

I've done one test using the following code in usercp.php and it works as expected (my phrases are used in the UserCP menu):

// get special phrase groups
$phrasegroups = array('user', 'infractionlevel', 'my_custom_phrases');

Given this I returned the usercp.php to its original form and created a usercp_start hook-based plugin with the following:

$phrasegroups[] = 'dto_garage';

When using this my phrases are no longer displayed in UserCP (ie - they aren't being found)

I've also tried the following without success:

$my_array = array('my_custom_phrases');
$phrasegroups = array_merge($phrasegroups, $my_array);

Is this one of those issues where there is no way to add to the phrasegroups array during runtime for a specific piece of vB code or am I just not using the proper syntax or hook location?

Thanks for any assistance you can provide!

Mark

Oreamnos
10-24-2006, 04:19 AM
Any luck with this? Im having the same problems...

Paul M
10-24-2006, 07:31 AM
Phrases are built pretty early in global.php, the only hook I think you could use is init_startup.

Oreamnos
10-24-2006, 07:52 AM
Phrases are built pretty early in global.php, the only hook I think you could use is init_startup.thanks, i'll try that and see what happens...

Antivirus
01-08-2007, 08:15 PM
Phrases are built pretty early in global.php, the only hook I think you could use is init_startup.

That works great Paul, thanks.