I don’t know that you can… most of the internal pages also have a page in the root (topic.php, forum.php, etc)
The memberlist plugin did it the same way you did.
this is what i think can be done.. very hacky and very primitive
create a plugin which filters ‘bb_template’ for template ‘front-page.php’. check for $_GET == listplugins. if so return list-plugins.php
that will load list-plugins.php is the user goes to
go to <bbinstall>/index.php?action=listplugins
here is the plugin
add_filter(‘bb_template’,’my_plugin_change_template’);
function my_plugin_change_template($template) {
return ( ‘listplugins’ == $_GET ) ? ‘list-plugins.php’ : $template;
}
kapish?
Indeed I don’t believe there is a method for doing so. I was wondering the same thing and couldn’t find anything, especially since the files accessed in root are all actual files and none of them virtual. Would be good to have such a thing, so yay trac ticket.
s010, that’s very clever.
Unfortunately it doesn’t work.
Not certain if slugs would translate either,
ie. /action/listplugins
I think the shortest shortcut is a universal loader could be made for all future extensions, ie.
/forums/option/listplugins
where option is really option.php in the bbpress root and it just passes to the template listplugins.php
This would have to be made in the the bbpress core of course.
ooooh I just had an idea… where is the hook for bbpress’s internal 404…
er, no i guess that won’t work either…. BUT
take a look at view.php in the bbpress root
you can hook bb_custom_view
basically since there will not be any view name, it won’t do the mysql call, then after you catch it on the do_action(‘bb_custom_view you can exit() after your own custom page load.
ie. /forums/view/listplugins
Let me try to code something working…
Yup! Solved it… and a nice way too…
To have a custom template attached to a view, ie.
/forums/view/listplugins
function view_listplugins($view) {
if ($view=="listplugins") {bb_load_template( 'list-plugins.php'); exit();}
} add_action( 'bb_custom_view', 'view_listplugins' );
function view_listplugins_filter( $views ) {
global $views;
$views['listplugins'] = "List Plugins Used";
return $views;
} add_filter('bb_views', 'view_listplugins_filter');
Now the question is, will this work in the trunk since they completely changed how views are done…
THE ANSWER IS YES! WOOHOO!
http://bbpress.nfshost.com/forums/view/list-plugins
So we have a way to attach any custom page to bbpress.
The only catch is it will show up in the views list.
But you can filter the views list for admin/mods, etc.
I think I can make my “my-views” plugin work with the trunk with this “feature”.
I’m pretty sure you can call any file using the bb_load_template()
function, so you can keep your files all neatly bundled up in your plugin directory.
There are various was you can work out where your plugin is located, and if your template file has a predictable location relative to that, it should be easy to refer to it in the bb_load_template()
function.
A really neat trick would be not to have a physical template at all but pass it data. My entire template just consists of
<? bb_get_header();bb_list_plugins();bb_get_footer(); ?>
Which seems silly to have a physical file.
I guess I could try to hook it after the init and bypass the bb_load_template entirely.