From eb803411d1586f04adf3fab966cc26b40c17927e Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Mon, 6 Jun 2005 18:59:37 +0000
Subject: [PATCH] - Patch #24003 by Steven: fix problems with node attribute
 checking (and improve defaults).

---
 database/database.mysql        | 2 ++
 database/database.pgsql        | 2 ++
 modules/blogapi.module         | 8 ++++----
 modules/blogapi/blogapi.module | 8 ++++----
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/database/database.mysql b/database/database.mysql
index eca633468e39..334561860b9f 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -822,3 +822,5 @@ INSERT INTO variable (name,value) VALUES ('filter_html_1','i:1;');
 INSERT INTO locales_meta (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1');
 
 INSERT INTO url_alias (src, dst) VALUES ('node/feed', 'rss.xml');
+
+INSERT INTO variable (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:"status";}');
diff --git a/database/database.pgsql b/database/database.pgsql
index 0fbdc66863ac..8485c6623d2f 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -817,6 +817,8 @@ INSERT INTO locales_meta (locale, name, enabled, isdefault) VALUES ('en', 'Engli
 
 INSERT INTO url_alias (src, dst) VALUES ('node/feed', 'rss.xml');
 
+INSERT INTO variable (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:"status";}');
+
 ---
 --- Alter some sequences
 ---
diff --git a/modules/blogapi.module b/modules/blogapi.module
index 3c6172837c3f..a6c73a0d793e 100644
--- a/modules/blogapi.module
+++ b/modules/blogapi.module
@@ -118,13 +118,13 @@ function blogapi_new_post($req_params) {
   $edit = array();
   $edit['type'] = _blogapi_blogid($params[0]);
   // get the node type defaults
-  $node_type_default = variable_get('node_options_'. $edit['type'], array());
+  $node_type_default = variable_get('node_options_'. $edit['type'], array('status', 'promote'));
   $edit['uid'] = $user->uid;
   $edit['name'] = $user->name;
-  $edit['promote'] = $node_type_default['promote'];
+  $edit['promote'] = in_array('promote', $node_type_default);
   $edit['comment'] = variable_get('comment_'. $edit['type'], 2);
-  $edit['moderate'] = $node_type_default['moderate'];
-  $edit['revision'] = $node_type_default['revision'];
+  $edit['moderate'] = in_array('moderate', $node_type_default);
+  $edit['revision'] = in_array('revision', $node_type_default);
   $edit['format'] = FILTER_FORMAT_DEFAULT;
   $edit['status'] = $params[4];
 
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index 3c6172837c3f..a6c73a0d793e 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -118,13 +118,13 @@ function blogapi_new_post($req_params) {
   $edit = array();
   $edit['type'] = _blogapi_blogid($params[0]);
   // get the node type defaults
-  $node_type_default = variable_get('node_options_'. $edit['type'], array());
+  $node_type_default = variable_get('node_options_'. $edit['type'], array('status', 'promote'));
   $edit['uid'] = $user->uid;
   $edit['name'] = $user->name;
-  $edit['promote'] = $node_type_default['promote'];
+  $edit['promote'] = in_array('promote', $node_type_default);
   $edit['comment'] = variable_get('comment_'. $edit['type'], 2);
-  $edit['moderate'] = $node_type_default['moderate'];
-  $edit['revision'] = $node_type_default['revision'];
+  $edit['moderate'] = in_array('moderate', $node_type_default);
+  $edit['revision'] = in_array('revision', $node_type_default);
   $edit['format'] = FILTER_FORMAT_DEFAULT;
   $edit['status'] = $params[4];
 
-- 
GitLab