diff --git a/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php new file mode 100644 index 0000000..5979d61 --- /dev/null +++ b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php @@ -0,0 +1,28 @@ + + * @package timwolla.wcf.chat + * @subpackage system.menu.page + */ +class ChatPageMenuItemProvider extends DefaultPageMenuItemProvider { + /** + * Hides the button when there is no valid room + * + * @see wcf\system\menu\page\PageMenuItemProvider::isVisible() + */ + public function isVisible() { + try { + \wcf\data\chat\room\ChatRoom::getCache()->seek(0); + return true; + } + catch (\OutOfBoundsException $e) { + return false; + } + } +} diff --git a/pagemenu.xml b/pagemenu.xml new file mode 100644 index 0000000..3ec684d --- /dev/null +++ b/pagemenu.xml @@ -0,0 +1,10 @@ + + + + + index.php/Chat + header + wcf\system\menu\page\ChatPageMenuItemProvider + + + \ No newline at end of file