View Full Version : Custom WOL for a Specific Mod
evenmonkeys
09-15-2012, 12:26 AM
I'm trying to figure out a way to create a WOL option for a modification that already exists: https://vborg.vbsupport.ru/showthread.php?t=92203
Dream made a plugin that just tells "index.php?page=example" to look for a template called "page_example" and displays it. I would like to make a WOL that instead of saying the user is viewing the "Forum Index," but that they're viewing the "Example" page.
If anyone could help, let me know. Thanks!
This article has a section on adding a custom location: https://vborg.vbsupport.ru/showthread.php?t=228112
Edit: that's a vb4 article, but the location code will probably work in vb3.
evenmonkeys
09-22-2012, 01:19 AM
Does that still work the same way for existing locations? For instance, "index.php" already points to "Viewing Forum Index." Can I force "index.php?page=something" to point to "Viewing Something Page?"
It might. It doesn't look like index.php is handled in the existing code, so you should be able to check for $filename == 'index.php' and then use $values['page'] to check for the page.
Edit: Oh, I see you're saying it already says something for index.php. That's strange because I can't see where that's handled. So I'm not sure, but you could try to create a plugin that checks for index.php and see what happens.
OK, now I see why I missed it. The code uses $vbulletin->options['forumhome'] instead of using 'index.php' as a constant. So you're right, what's in that article won't work because index.php is already handled. But what I think you can do is create another plugin using hook online_location_preprocess and change $filename to something else, like:
if ($filename == 'index.php' AND isset($values['page']))
{
$filename = 'custom_page_wrapper';
}
then in the other plugins, check $filename for that value.
Or you could add the page name in the above plugin code like:
if ($filename == 'index.php' AND isset($values['page']))
{
$filename = 'custom_page_wrapper_' . $values['page'];
}
Then in the other plugins you only need to look at $filename and not $values['page'].
evenmonkeys
09-24-2012, 02:49 AM
Ohhhhh. Very nice! Thank you! I didn't think about checking another condition.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.