You are here

function blogap_mti_publish_post in Drupal 4

Blogging API callback. Publishes the given node

1 string reference to 'blogap_mti_publish_post'
blogapi_xmlrpc in modules/blogapi.module
Implementation of hook_xmlrpc().

File

modules/blogapi.module, line 487
Enable users to post using applications that support XML-RPC blog APIs.

Code

function blogap_mti_publish_post($postid, $username, $password) {
  $user = blogapi_validate_user($username, $password);
  if (!$user->uid) {
    return blogapi_error($user);
  }
  $node = node_load($postid);
  if (!$node) {
    return blogapi_error(t('Invalid post.'));
  }
  $node->status = 1;
  if (!node_access('update', $node)) {
    return blogapi_error(t('You do not have permission to update this post.'));
  }
  node_save($node);
  return true;
}