- b2evolution CMS Support Forums
- b2evolution Support
- Plugins & Extensions
- Plugin development assistance
- Blog selection bar in plugins
1 personman Jan 14, 2008 17:27
I was upgrading Democracy Plugin for 2.x and came up with this code for adding the blog selection bar to the top of the page when on the Tools tab for my plugin. I pasted it below. You should be able to drop this code into any plugin that needs the same functionality. It works with 2.3.0 (and probably 1.x, too) as well as current CVS, which includes some changes to the way the blog buttons are displayed.
A plugin hook for this would be nice, but this works ok. One downside is that any messages are shown between the main tabs and the blog list bar. Anyone know of a better way to do this?
function AdminBeginPayload()
{
global $ctrl, $tab, $AdminUI;
if ($ctrl == 'tools' && $tab == 'plug_ID_'.$this->ID)
{
// Generate available blogs list:
if (method_exists($AdminUI, 'get_html_collection_list')) {
// 2.3.0 or earlier
$blogListButtons = $AdminUI->get_html_collection_list( 'blog_properties', 'edit', 'admin.php?ctrl=tools&blog=%d'.'&tab=plug_ID_'.$this->ID );
} else {
// After 2.3.0
$AdminUI->set_coll_list_params('blog_properties', 'edit', array('ctrl' => 'tools', 'tab' => 'plug_ID_'.$this->ID));
$blogListButtons = $AdminUI->get_bloglist_buttons();
}
echo $blogListButtons;
}
}