| 5 blogapi.module | blogapi_status_error_check($node, $original_status) |
| 6 blogapi.module | blogapi_status_error_check($node, $original_status) |
Check that the user has permission to save the node with the chosen status.
Return value
TRUE if no error, or the blogapi_error().
2 calls to blogapi_status_error_check()
File
- modules/
blogapi/ blogapi.module, line 326 - Enable users to post using applications that support XML-RPC blog APIs.
Code
function blogapi_status_error_check($node, $original_status) {
$node = (object) $node;
$node_type_default = variable_get('node_options_' . $node->type, array('status', 'promote'));
// If we don't have the 'administer nodes' permission and the status is
// changing or for a new node the status is not the content type's default,
// then return an error.
if (!user_access('administer nodes') && (($node->status != $original_status) || (empty($node->nid) && $node->status != in_array('status', $node_type_default)))) {
if ($node->status) {
return blogapi_error(t('You do not have permission to publish this type of post. Please save it as a draft instead.'));
}
else {
return blogapi_error(t('You do not have permission to save this post as a draft. Please publish it instead.'));
}
}
return TRUE;
}
Login or register to post comments