blogapi_mt_publish_post

Versions
5 – 6
blogapi_mt_publish_post($postid, $username, $password)

Blogging API callback. Publishes the given node

Code

modules/blogapi/blogapi.module, line 606

<?php
function blogapi_mt_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.'));
  }

  // Nothing needs to be done if already published.
  if ($node->status) {
    return;
  }

  if (!node_access('update', $node) || !user_access('administer nodes')) {
    return blogapi_error(t('You do not have permission to update this post.'));
  }

  $node->status = 1;
  node_save($node);

  return TRUE;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.