aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-10-07 17:11:26 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-10-07 17:11:26 -0300
commitaf9f953bd66ebf3c276a13ff0259519301e2959a (patch)
tree13de3a9a046e4b1b58a734836cd2c8cfdd13f481
parenteccd915b23e2ea7a1485ecceae9e89ecc2e5c3f7 (diff)
downloadmuamba-af9f953bd66ebf3c276a13ff0259519301e2959a.tar.gz
muamba-af9f953bd66ebf3c276a13ff0259519301e2959a.tar.bz2
Adding muamba_node_update()
-rw-r--r--muamba.install2
-rw-r--r--muamba.module12
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();
+ }
+}