From 9f31ba02a50d8930a5ce6d9365fcd4a454218271 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 23 Sep 2011 19:26:38 -0300 Subject: Privatemsg integration --- muamba.info | 1 + muamba.misc.inc | 12 +++++++++++- muamba.module | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/muamba.info b/muamba.info index f039221..0b16b58 100644 --- a/muamba.info +++ b/muamba.info @@ -8,3 +8,4 @@ dependencies[] = features dependencies[] = strongarm dependencies[] = muamba_interface dependencies[] = muamba_system +dependencies[] = privatemsg diff --git a/muamba.misc.inc b/muamba.misc.inc index 4168464..25fceac 100644 --- a/muamba.misc.inc +++ b/muamba.misc.inc @@ -13,7 +13,17 @@ */ function muamba_request($nid) { // Sanitize - $nid = (int) $nid; + $nid = (int) $nid; + $node = node_load($nid); + if (!$node) { + // TODO: error + return; + } + + global $user; + + // TODO: check if user is not blocked? + privatemsg_new_thread(array(user_load($node->uid)), 'User request', 'User has requested an item'); return t('You have requested an item'); } diff --git a/muamba.module b/muamba.module index fbddf45..8a2da28 100644 --- a/muamba.module +++ b/muamba.module @@ -10,8 +10,8 @@ */ function muamba_permission() { return array( - 'administer muamba' => array( - 'title' => t('request item'), + 'request item' => array( + 'title' => t('Request an item'), 'description' => t('Request an item to be borrowed or donated.'), ), ); -- cgit v1.2.3