summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoachim Noreiko2010-02-15 13:33:49 (GMT)
committer Joachim Noreiko2010-02-15 13:33:49 (GMT)
commitd371144cf15652d76191e6fcc803d10c184685fd (patch)
tree97f94ab15e24bfb5d6c3d560117eb1cce82eaed7
parent1af4de1193e388ae97eac6c47b72e7737e084805 (diff)
#714794 by joachim: Fixed lack of user warning about clobbering on editing a retrieved node.6.x-2.0-beta4
-rw-r--r--modules/content_retriever/content_retriever.module10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/content_retriever/content_retriever.module b/modules/content_retriever/content_retriever.module
index 2326fe9..c5f488c 100644
--- a/modules/content_retriever/content_retriever.module
+++ b/modules/content_retriever/content_retriever.module
@@ -647,11 +647,21 @@ function content_retriever_preprocess_page(&$variables) {
/**
* Implementation of hook_nodeapi().
*
+ * Warn when editing retrieved nodes.
* Delete the record from the content_retriever table when a node
* is deleted.
*/
function content_retriever_nodeapi(&$node, $op, $teaser, $page) {
switch ($op) {
+ case 'prepare':
+ // If this is a node that has been retrieved from a remote site, warn
+ // a user about to edit it that their edits are not safe and may be
+ // overwritten by future updates.
+ $content_retriever_nid = db_result(db_query("SELECT nid FROM {content_retriever} WHERE nid = %d", $node->nid));
+ if ($content_retriever_nid) {
+ drupal_set_message(t('This %type was originally retrieved from a remote site. Any changes you make here are liable to be overwritten when new content is fetched from the remote site.', array('%type' => node_get_types('name', $node))), 'warning');
+ }
+ break;
case 'delete':
// remove db row from content_retriever
db_query('DELETE FROM {content_retriever} WHERE nid = %d', $node->nid);