aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-10-10 21:32:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-10-10 21:32:03 -0300
commit99af5bfd118dc657f3c5c363a237c8cef49039fd (patch)
tree2516ac1f2c83c9afc07f0e69dce9e6d57353335e
parentdb6fd9706157928ce20fc26689fe9db41d533537 (diff)
downloadmuamba-99af5bfd118dc657f3c5c363a237c8cef49039fd.tar.gz
muamba-99af5bfd118dc657f3c5c363a237c8cef49039fd.tar.bz2
Check if user is logged in
-rw-r--r--muamba-widget.tpl.php6
-rw-r--r--muamba.misc.inc8
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;
}