Index: modules/blogapi/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v retrieving revision 1.126 diff -u -p -r1.126 blogapi.module --- modules/blogapi/blogapi.module 17 Sep 2008 21:07:47 -0000 1.126 +++ modules/blogapi/blogapi.module 22 Sep 2008 19:50:19 -0000 @@ -223,6 +223,16 @@ function blogapi_blogger_new_post($appke node_invoke_nodeapi($edit, 'blogapi new'); + // If we don't have the 'administer nodes' permission and the publish setting for this story is not the content type's default, then return an error. + if (!user_access('administer nodes') && $edit['status'] != in_array('status', $node_type_default)) { + if ($publish == 1) { + return blogapi_error(t('You do not have permission to publish this type of post. Please save it as a draft instead.')); + } + else { + return blogapi_error(t('You do not have permission to save this post as a draft. Please publish it instead.')); + } + } + node_validate($edit); if ($errors = form_get_errors()) { return blogapi_error(implode("\n", $errors)); @@ -275,6 +285,18 @@ function blogapi_blogger_edit_post($appk node_invoke_nodeapi($node, 'blogapi edit'); + $node_type_default = variable_get('node_options_'. $node->type, array('status', 'promote')); + + // If we don't have the 'administer nodes' permission and the publish setting for this story is not the content type's default, then return an error. + if (!user_access('administer nodes') && $node->status != in_array('status', $node_type_default)) { + if ($publish == 1) { + return blogapi_error(t('You do not have permission to publish this type of post. Please save it as a draft instead.')); + } + else { + return blogapi_error(t('You do not have permission to save this post as a draft. Please publish it instead.')); + } + } + node_validate($node); if ($errors = form_get_errors()) { return blogapi_error(implode("\n", $errors));