]> gitweb.fluxo.info Git - drupal/muamba.git/commitdiff
Adding muamba_node_update()
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 7 Oct 2011 20:11:26 +0000 (17:11 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 7 Oct 2011 20:11:26 +0000 (17:11 -0300)
muamba.install
muamba.module

index 2ffc573ce8aaece8fc21fd41d6a9238832b81603..bd1a710dea49dd2a2ff5e9912551a4ba50622bfd 100644 (file)
@@ -31,8 +31,6 @@ function muamba_schema() {
         'not null'    => TRUE,
         'default'     => 0,
       ),
-      // This assumes that the node won't have his author changed,
-      // which might be reasonable depending on the application.
       'owner'         => array(
         'description' => t('The {user}.owner owner of an item.'),
         'type'        => 'int',
index 5e3880abdaeda588badfa288daa3ece227aaf560..1d722893071e07d0d637a725302825f38a0b85f3 100644 (file)
@@ -278,3 +278,15 @@ function muamba_views_api() {
     'api' => 3,
   );
 }
+
+/**
+ * Implements hook_node_update()
+ */
+function muamba_node_update($node) {
+  if ($node->type == MUAMBA_NODE_TYPE) {
+    db_update('muamba')
+      ->fields(array('owner' => $node->uid)
+      ->condition('nid', $node->nid)
+      ->execute();
+  }
+}