blogapi_status_error_check

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/blogapi/blogapi.module, строка 321

Версии
5 – 6
blogapi_status_error_check($node, $original_status)

Check that the user has permission to save the node with the chosen status.

Возвращаемое значение

TRUE if no error, or the blogapi_error().

▾ 2 функции вызывают blogapi_status_error_check()

blogapi_blogger_edit_post in modules/blogapi/blogapi.module
Коллбэк Blogging API. Модифицирует указанную ноду блога.
blogapi_blogger_new_post in modules/blogapi/blogapi.module
Коллбэк Blogging API. Вставляет новую запись блога как ноду.

Код

<?php
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему