]> gitweb.fluxo.info Git - drupal/muamba.git/commitdiff
Check if user is logged in
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 11 Oct 2011 00:32:03 +0000 (21:32 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 11 Oct 2011 00:32:03 +0000 (21:32 -0300)
muamba-widget.tpl.php
muamba.misc.inc

index 06d547b4bb7c4f132c229b4aa4bcf8170d354ed3..1c79606d19b9d9b6551010c9c757c22b23c82f08 100644 (file)
@@ -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) {
index 70aa5988369ca517a59d84d68a4d11d3be6afc07..d15b056ee610324d8eab876631ac79d4b46e96ad 100644 (file)
@@ -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;
   }