Same name and namespace in other branches
- 4.7.x modules/blogapi.module \blogap_mti_publish_post()
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 469 - 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(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;
}