From af9f953bd66ebf3c276a13ff0259519301e2959a Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 7 Oct 2011 17:11:26 -0300 Subject: Adding muamba_node_update() --- muamba.install | 2 -- muamba.module | 12 ++++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/muamba.install b/muamba.install index 2ffc573..bd1a710 100644 --- a/muamba.install +++ b/muamba.install @@ -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', diff --git a/muamba.module b/muamba.module index 5e3880a..1d72289 100644 --- a/muamba.module +++ b/muamba.module @@ -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(); + } +} -- cgit v1.2.3