The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Using custom phrasegroups in a plugin in VB4?
Been searching for this answer for a while... Quite a few old threads about this but from the VB 3.5 and 3.6 days...
Apparently you used to just add this code to init_startup hook: Code:
$phrasegroups[] = 'groupname'; I can use the phrasegroup on a custom php page by having this code near the top: Code:
$phrasegroups = array('groupname'); However neither works on init_startup. Any ideas on this? |
#2
|
|||
|
|||
Hook: global_bootstrap_init_start
Code:
global $phrasegroups; $phrasegroups[] = 'dbtech_vbanalytics'; |
#3
|
||||
|
||||
global_bootstrap_init_start would be better actually since $vbulletin->options is available so I could limit it to only when the mod setting that required it was enabled.
However it just isn't working. This is what I have in global_bootstrap_init_start: Code:
global $phrasegroups; $phrasegroups[] = 'bop5'; Code:
global $vbphrase; echo "<pre>"; print_r ($vbphrase); echo "</pre>"; die(); EDIT- very weird as it is listed as an available phrasegroup in the debug info |
#4
|
|||
|
|||
Dug in a bit. That will indeed add that phrasegroup to the array which ini's $vbphrase, however, for some odd reason, at that moment $vbulletin->userinfo contains elements "phrasegroup_x" full of serialized array values which are unset after $vbphrase is created. This is called in fetch_userinfo which is called includes/init.php. This all happens before that hook.
Hook: fetch_userinfo_query PHP Code:
|
#5
|
||||
|
||||
You're right, it does work when logged in, but not for guests.
Thank you for this- I will investigate too and let you know if I come up with something. |
#6
|
|||
|
|||
Actually it was as simple as:
PHP Code:
Works for logged-in and guests. Phrases get fetched when they're building sessions: fetch_language_fields_sql() method. |
#7
|
||||
|
||||
on what hook?
Right now I have Code:
global $phrasegroups; $phrasegroups[] = 'bop5'; Edit- it seems I only need it on init_startup now... but I could have swotn I tried it already... oh well... many thanks. |
#8
|
|||
|
|||
Just in init_startup.
Note of caution, be sure your phrasegroup is correct- or else you'll get a database error even within the ACP. |
#9
|
||||
|
||||
Quote:
Code:
if (defined('THIS_SCRIPT')) { global $phrasegroups; $phrasegroups[] = 'bop5'; } |
#10
|
|||
|
|||
Good call. I used a test phrase and had to unset it in the method.
|
Благодарность от: | ||
BirdOPrey5 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|