blogapi_mt_set_post_categories

Versions
4.6 – 6
blogapi_mt_set_post_categories($postid, $username, $password, $categories)

Blogging API callback. Assigns taxonomy terms to a particular node.

Code

modules/blogapi.module, line 443

<?php
function blogapi_mt_set_post_categories($postid, $username, $password, $categories) {
  $user = blogapi_validate_user($username, $password);
  if (!$user->uid) {
    return blogapi_error($user);
  }

  $node = node_load($postid);
  $node->taxonomy = array();
  foreach ($categories as $category) {
    $node->taxonomy[] = $category['categoryId'];
  }
  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.