]> gitweb.fluxo.info Git - drupal/muamba.git/commitdiff
Privatemsg integration
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 23 Sep 2011 22:26:38 +0000 (19:26 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 23 Sep 2011 22:26:38 +0000 (19:26 -0300)
muamba.info
muamba.misc.inc
muamba.module

index f039221f34e51244f4d1a28c69501ac53d815b3a..0b16b587502a55b92423ad2acccde9159767022d 100644 (file)
@@ -8,3 +8,4 @@ dependencies[] = features
 dependencies[] = strongarm
 dependencies[] = muamba_interface
 dependencies[] = muamba_system
+dependencies[] = privatemsg
index 4168464a671e0d8f067f3f6628e9f03e38ceff55..25fceac21ed59d9bbeda172d2269b61690bae4ac 100644 (file)
  */
 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');
 }
index fbddf45790cb61fa20db9a6b6d9c8f5375253a0d..8a2da287a593e3a7d22ca7f6a9d57442de88c47c 100644 (file)
@@ -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.'),
     ),
   );