From 8981da89c3426f94b8a963ffe8189a9d0400333f Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 19 Oct 2012 03:36:09 -0700 Subject: don't show categories widget if there are none --- include/contact_widgets.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'include/contact_widgets.php') diff --git a/include/contact_widgets.php b/include/contact_widgets.php index a8eb893a5..ebefa1c23 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -111,20 +111,21 @@ function categories_widget($baseurl,$selected = '') { intval($a->profile['profile_uid']), intval(TERM_CATEGORY) ); - if(count($r)) { + if($r && count($r)) { foreach($r as $rr) - $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); - } + $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); - return replace_macros(get_markup_template('categories_widget.tpl'),array( - '$title' => t('Categories'), - '$desc' => '', - '$sel_all' => (($selected == '') ? 'selected' : ''), - '$all' => t('Everything'), - '$terms' => $terms, - '$base' => $baseurl, + return replace_macros(get_markup_template('categories_widget.tpl'),array( + '$title' => t('Categories'), + '$desc' => '', + '$sel_all' => (($selected == '') ? 'selected' : ''), + '$all' => t('Everything'), + '$terms' => $terms, + '$base' => $baseurl, - )); + )); + } + return ''; } function common_friends_visitor_widget($profile_uid) { -- cgit v1.2.3