From bd54358aa6bfe90bfbc8aed7baf3a8110d6e45ba Mon Sep 17 00:00:00 2001 From: marijus Date: Sat, 20 Sep 2014 16:31:56 +0200 Subject: show bookmarks menu only if we have any bookmarks already --- include/menu.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/menu.php') diff --git a/include/menu.php b/include/menu.php index 4b0a11f10..8997d2e39 100644 --- a/include/menu.php +++ b/include/menu.php @@ -124,7 +124,17 @@ function menu_list($channel_id, $name = '', $flags = 0) { return $r; } +function menu_list_count($channel_id, $name = '', $flags = 0) { + $sel_options = ''; + $sel_options .= (($name) ? " and menu_name = '" . protect_sprintf(dbesc($name)) . "' " : ''); + $sel_options .= (($flags) ? " and menu_flags = " . intval($flags) . " " : ''); + + $r = q("select count(*) as total from menu where menu_channel_id = %d $sel_options", + intval($channel_id) + ); + return $r[0]['total']; +} function menu_edit($arr) { -- cgit v1.2.3