comment_access

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 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.

Übergabeparameter

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

$comment The comment object.

Rückgabewert

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

▾ 2 functions call comment_access()

comment_edit in modules/comment/comment.pages.inc
Form builder; generate a comment editing form.
comment_links in modules/comment/comment.module
Build command links for a comment (e.g.\ edit, reply, delete) with respect to the current user's access permissions.

Code

modules/comment/comment.module, line 662

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

  if ($op == 'edit') {
    return ($user->uid && $user->uid == $comment->uid && comment_num_replies($comment->cid) == 0 && $comment->status == COMMENT_PUBLISHED) || user_access('administer comments');
  }
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen