You are here

function blogapi_mt_set_post_categories in Drupal 5

Same name and namespace in other branches
  1. 4 modules/blogapi.module \blogapi_mt_set_post_categories()
  2. 6 modules/blogapi/blogapi.module \blogapi_mt_set_post_categories()

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

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

File

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

Code

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'];
  }
  $validated = blogapi_mt_validate_terms($node);
  if ($validated !== TRUE) {
    return $validated;
  }
  node_save($node);
  return TRUE;
}