Index: modules/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi.module,v retrieving revision 1.34 diff -u -r1.34 blogapi.module --- modules/blogapi.module 23 Nov 2004 22:20:41 -0000 1.34 +++ modules/blogapi.module 27 Nov 2004 03:05:38 -0000 @@ -112,13 +112,14 @@ } $edit = array(); - $edit['type'] = 'blog'; + $type = variable_get('blogapi_nodetype', 'blog'); + $edit['type'] = $type; $edit['uid'] = $user->uid; $edit['name'] = $user->name; - $edit['promote'] = variable_get('node_promote_blog', 1); - $edit['comment'] = variable_get('node_comment_blog', 2); - $edit['moderate'] = variable_get('node_moderate_blog', 0); - $edit['revision'] = variable_get('node_revision_blog', 0); + $edit['promote'] = variable_get('node_promote_' . $type, 1); + $edit['comment'] = variable_get('node_comment_' . $type, 2); + $edit['moderate'] = variable_get('node_moderate_' . $type, 0); + $edit['revision'] = variable_get('node_revision_' . $type, 0); $edit['format'] = FILTER_FORMAT_DEFAULT; $edit['status'] = $params[4]; @@ -280,7 +281,7 @@ * associated with a blog node. */ function blogapi_get_category_list($req_params) { - $vocabularies = module_invoke('taxonomy', 'get_vocabularies', 'blog', 'vid'); + $vocabularies = module_invoke('taxonomy', 'get_vocabularies', variable_get('blogapi_nodetype', 'blog'), 'vid'); $categories = array(); if ($vocabularies) { foreach ($vocabularies as $vocabulary) { @@ -361,7 +362,7 @@ return blogapi_error($user); } - $result = db_query_range('SELECT n.nid, n.title,'. ($bodies ? ' n.body,' : '') ." n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = 'blog' AND n.uid = %d ORDER BY n.created DESC", $user->uid, 0, $params[3]); + $result = db_query_range('SELECT n.nid, n.title,'. ($bodies ? ' n.body,' : '') ." n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = '%s' AND n.uid = %d ORDER BY n.created DESC", variable_get('blogapi_nodetype', 'blog'), $user->uid, 0, $params[3]); while ($blog = db_fetch_object($result)) { $xmlrpcval = _blogapi_get_post($blog, $bodies); $blogs[] = $xmlrpcval; @@ -477,7 +478,20 @@ $user = user_authenticate($username, $password); if ($user->uid) { - if (user_access('edit own blog', $user)) { + switch (variable_get('blogapi_nodetype', 'blog')) { + case 'blog': + $type = 'blog'; + break; + case 'page': + $type = 'pages'; + break; + case 'story': + $type = 'stories'; + break; + default: + $type = 'blog'; + } + if (user_access('edit own ' . $type, $user)) { return $user; } else { @@ -505,6 +519,8 @@ function blogapi_settings() { $output = form_select(t('XML-RPC Engine'), 'blogapi_engine', variable_get('blogapi_engine', 0), array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'), t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')); + $types = array('blog' => 'blog', 'page' => 'page', 'story' => 'story'); + $output .= form_select(t('Node type for blogapi entries'), 'blogapi_nodetype', variable_get('blogapi_nodetype', 'blog'), $types, t('New nodes added through the blog api will be of this node type.')); return $output; }