aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-09-23 19:26:38 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-09-23 19:26:38 -0300
commit9f31ba02a50d8930a5ce6d9365fcd4a454218271 (patch)
treea4ff47419ccc045901ce250696dc992314e9f835
parenteccec7929df788834f12ba4c6efbccf85a30d530 (diff)
downloadmuamba-9f31ba02a50d8930a5ce6d9365fcd4a454218271.tar.gz
muamba-9f31ba02a50d8930a5ce6d9365fcd4a454218271.tar.bz2
Privatemsg integration
-rw-r--r--muamba.info1
-rw-r--r--muamba.misc.inc12
-rw-r--r--muamba.module4
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.'),
),
);