From 99af5bfd118dc657f3c5c363a237c8cef49039fd Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 10 Oct 2011 21:32:03 -0300 Subject: Check if user is logged in --- muamba-widget.tpl.php | 6 +++++- muamba.misc.inc | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/muamba-widget.tpl.php b/muamba-widget.tpl.php index 06d547b..1c79606 100644 --- a/muamba-widget.tpl.php +++ b/muamba-widget.tpl.php @@ -16,7 +16,11 @@ drupal_add_css($path .'/muamba.css'); $content = ''; $output = ''; -if (empty($transaction) && $node->uid != $user->uid) { +if (!user_is_logged_in()) { + print t('You have to be logged in to be able to ask for this item.'); + return; +} +elseif (empty($transaction) && $node->uid != $user->uid) { $content .= theme('muamba_widget_icon', array('status' => MUAMBA_REQUESTED, 'id' => $node->nid)); } elseif ($transaction['uid'] == $user->uid) { diff --git a/muamba.misc.inc b/muamba.misc.inc index 70aa598..d15b056 100644 --- a/muamba.misc.inc +++ b/muamba.misc.inc @@ -93,7 +93,7 @@ function muamba_actions($code = NULL) { * TRUE on success, FALSE otherwise. */ function muamba_has_request_access($node) { - if (!$node || $node->type != MUAMBA_NODE_TYPE || !node_access('view', $node)) { + if (!user_is_logged_in() || !$node || $node->type != MUAMBA_NODE_TYPE || !node_access('view', $node)) { return FALSE; } @@ -113,6 +113,10 @@ function muamba_has_request_access($node) { * TRUE if block exists, FALSE otherwise. */ function muamba_user_has_blocked($node, $user) { + if (!user_is_logged_in()) { + return FALSE; + } + if (module_exists('pm_block_user')) { $owner = user_load($node->uid); if (pm_block_user_has_blocked($user, $owner)) { @@ -140,7 +144,7 @@ function muamba_has_management_access($node, $user = NULL) { global $user; } - if (!$node || $node->type != MUAMBA_NODE_TYPE || $node->uid != $user->uid) { + if (!user_is_logged_in() || !$node || $node->type != MUAMBA_NODE_TYPE || $node->uid != $user->uid) { return FALSE; } -- cgit v1.2.3