Commit 777c2129 authored by Dries's avatar Dries

- Bugfix: made the bloggerapi respect the default promote setting. Patch by

  Remco.

  TODO: the same should be done for the fields "comment", "moderate" and so
  on.

- Improvement: made posts/updates through the Blogger API show up on the admin
  main page.  Modified patch from Remco.
parent 43fb74b9
......@@ -38,7 +38,7 @@ function bloggerapi_newPost($params) {
$nid = node_save($node);
if ($nid) {
watchdog("special", "$node->type: added '$node->title', via Blogger API");
watchdog("special", "$node->type: added '$node->title' using the Blogger API", l(t("view post"), "node/view/$nid"));
return new xmlrpcresp(new xmlrpcval("$nid", "string"));
}
else {
......@@ -58,7 +58,7 @@ function bloggerapi_editPost($params) {
if (!$node->error) {
$nid = node_save($node);
if ($nid) {
watchdog("special", "$node->type: updated '$node->title', via Blogger API");
watchdog("special", "$node->type: updated '$node->title' using the Blogger API", l(t("view post"), "node/view/$nid"));
return new xmlrpcresp(new xmlrpcval($nid, "string"));
}
else {
......@@ -144,17 +144,23 @@ function bloggerapi_driver($method, $params = 0, $error = 0) {
$title = bloggerapi_title($cparams[4]);
}
/*
** Check if we can set promote.
*/
$promote = variable_get("node_promote_blog", "0");
/*
** Maps params to node array or call another function
*/
switch ($method) {
case "newPost":
return array("type" => "blog", "uid" => $user->uid, "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0);
return array("type" => "blog", "uid" => $user->uid, "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => $promote, "revision" => 0);
case "editPost":
$node = node_load(array("nid" => $cparams[1]));
if ($node->uid == $user->uid) {
return array("nid" => $cparams[1], "uid" => $user->uid, "type" => "blog", "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0);
return array("nid" => $cparams[1], "uid" => $user->uid, "type" => "blog", "name" => $user->name, "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => $promote, "revision" => 0);
}
else {
return bloggerapi_error("Error updating node");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment