comment_access

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

modules/comment/comment.module, строка 661

Версии
5 – 6
comment_access($op, $comment)

This is *not* a hook_access() implementation. This function is called to determine whether the current user has access to a particular comment.

Authenticated users can edit their comments as long they have not been replied to. This prevents people from changing or revising their statements based on the replies to their posts.

Параметры

$op The operation that is to be performed on the comment. Only 'edit' is recognized now.

$comment The comment object.

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

TRUE if the current user has acces to the comment, FALSE otherwise.

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

comment_edit in modules/comment/comment.pages.inc
Конструктор формы; генерирует форму редактирования комментария.
comment_links in modules/comment/comment.module
Формирует управляющие ссылки для комментариев (редактировать, ответить, удалить) на основе прав доступа для текущего пользователя.

Код

<?php
function comment_access($op, $comment) {
  global $user;

  if ($op == 'edit') {
    return ($user->uid && $user->uid == $comment->uid && comment_num_replies($comment->cid) == 0) || user_access('administer comments');
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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