blogap_mti_publish_post

Versions
4.6 – 4.7
blogap_mti_publish_post($postid, $username, $password)

Blogging API callback. Publishes the given node

Code

modules/blogapi.module, line 469

<?php
function blogap_mti_publish_post($postid, $username, $password) {
  $user = blogapi_validate_user($username, $password);
  if (!$user->uid) {
    return blogapi_error($user);
  }
  $node = node_load(array('nid' => $postid));
  if (!$node) {
    return blogapi_error(t('Invalid post.'));
  }

  $node->status = 1;
  if (!node_access('update', $node)) {
    return blogapi_error(message_access());
  }

  $terms = module_invoke('taxonomy', 'node_get_terms', $node->nid, 'tid');
  foreach ($terms as $term) {
    $node->taxonomy[] = $term->tid;
  }
  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.