Log in

View Full Version : How to make $vbulletin->wol_spiders available?


mikelbeck
01-28-2006, 01:13 AM
How do I make $vbulletin->wol_spiders available for a plug-in that uses the global_start hook?

Paul M
01-28-2006, 04:26 AM
You have to add "wol_spiders" to the list of special templates. AFAIK, This requires a fie edit.

harmor19
01-28-2006, 04:36 AM
I think you can do a plugin, I'm not sure what hook, maybe "cache_templates"?

$specialtemplates[] = 'wol_spiders';

Paul M
01-28-2006, 05:00 AM
I'm pretty sure they are built before any hooks exist, you have to add that line to the bottom of config.php.

harmor19
01-28-2006, 05:15 AM
I found this in global.php

($hook = vBulletinHook::fetch_hook('cache_templates')) ? eval($hook) : false;

// now get all the templates we have specified
cache_templates($globaltemplates, $style['templatelist']);
unset($globaltemplates, $actiontemplates, $_get_edit_templates, $_templatedo);

Would adding $specialtemplates to the list in the "cache_templates" or "unset" function help make my code work?

mikelbeck
01-28-2006, 01:49 PM
The problem is I have a plug-in that runs from global_start. I find that wol_spiders doesn't exist at that point... I found some code from online.php that builds wol_spiders if it's not there, but I don't think that running that on every page load would be a good idea.

Any ideas?

mikelbeck
01-29-2006, 11:35 PM
Anybody?

Andreas
01-29-2006, 11:41 PM
Datastore Items can't be loaded via Plugins, as Plugins themselves are loaded from the datastore.

You'll have to edit the file, or, alternatively to save you from having to apply the change on every update: edit config.php.

mikelbeck
01-29-2006, 11:44 PM
Thanks for the quick response.

Datastore Items can't be loaded via Plugins, as Plugins themselves are loaded from the datastore.

Ah. Bummer.

If I were to put my script in a file and then include that in the plug-in code, would that get around this limitation? I suppose not...

You'll have to edit the file

Which file?

, or, alternatively to save you from having to apply the change on every update: edit config.php.

Ah, I think I'd like to avoid doing that.

Andreas
01-29-2006, 11:46 PM
If I were to put my script in a file and then include that in the plug-in code, would that get around this limitation? I suppose not...

No. As said, Plugins are loaded from the datastore - which is only be queried once, so you can't load datastore items through plugins - no matter what.


Which file
The file which contains the hooks you've placed plugins that require the datastore item.
For a hook in global.php it would be ... guess it ... global.php :)

mikelbeck
01-29-2006, 11:52 PM
No. As said, Plugins are loaded from the datastore - which is only be queried once, so you can't load datastore items through plugins - no matter what.

Ah, ok. Thanks for the clarification.

The file which contains the hooks you've placed plugins that require the datastore item.
For a hook in global.php it would be ... guess it ... global.php :)

Believe it or not, I had no clue. ;-)

Ok, last question... In online.php there's a block of code that looks like it loads $vbulletin->wol_spiders (it starts with a line that says "// Refresh cache if the XML has changed")

If I were to take that code and put it in global.php,
a) would wol_spiders then become available to my plug-in hooked at global_start and
b) would that block of code run on every page load?

Bump?