| 5 comment.module | comment_reply( |
| 6 comment.pages.inc | comment_reply($node, $pid = NULL) |
| 7 comment.pages.inc | comment_reply($node, $pid = NULL) |
| 8 comment.pages.inc | comment_reply(Node $node, $pid = NULL) |
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
- replies to comments
- replies to nodes
- attempts to reply to nodes that can no longer accept comments
- respecting access permissions ('access comments', 'post comments', etc.)
The node or comment that is being replied to must appear above the comment form to provide the user context while authoring the comment.
Parameters
$nid: Every comment belongs to a node. This is that node's id.
$pid: Some comments are replies to other comments. In those cases, $pid is the parent comment's cid.
Return value
$output The rendered parent node or comment plus the new comment form.
2 string references to 'comment_reply'
File
- modules/
comment/ comment.module, line 619 - Enables users to comment on published content.
Code
function comment_reply($nid, $pid = NULL) {
// Load the parent node.
$node = node_load($nid);
// Set the breadcrumb trail.
menu_set_location(array(array('path' => "node/$nid", 'title' => $node->title), array('path' => "comment/reply/$nid")));
$op = isset($_POST['op']) ? $_POST['op'] : '';
$output = '';
if (user_access('access comments')) {
// The user is previewing a comment prior to submitting it.
if ($op == t('Preview comment')) {
if (user_access('post comments')) {
$output .= comment_form_box(array('pid' => $pid, 'nid' => $nid), NULL);
}
else {
drupal_set_message(t('You are not authorized to post comments.'), 'error');
drupal_goto("node/$nid");
}
}
else {
// $pid indicates that this is a reply to a comment.
if ($pid) {
// load the comment whose cid = $pid
if ($comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d', $pid, COMMENT_PUBLISHED))) {
// If that comment exists, make sure that the current comment and the parent comment both
// belong to the same parent node.
if ($comment->nid != $nid) {
// Attempting to reply to a comment not belonging to the current nid.
drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
drupal_goto("node/$nid");
}
// Display the parent comment
$comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$output .= theme('comment_view', $comment);
}
else {
drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
drupal_goto("node/$nid");
}
}
// This is the case where the comment is in response to a node. Display the node.
else if (user_access('access content')) {
$output .= node_view($node);
}
// Should we show the reply box?
if (node_comment_mode($nid) != COMMENT_NODE_READ_WRITE) {
drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error');
drupal_goto("node/$nid");
}
else if (user_access('post comments')) {
$output .= comment_form_box(array('pid' => $pid, 'nid' => $nid), t('Reply'));
}
else {
drupal_set_message(t('You are not authorized to post comments.'), 'error');
drupal_goto("node/$nid");
}
}
}
else {
drupal_set_message(t('You are not authorized to view comments.'), 'error');
drupal_goto("node/$nid");
}
return $output;
}
Login or register to post comments
Comments
designs and styles are impressing
Il mio complice e io laureata Peuterey sonora Questo linguaggio preciso. Peuterey Online Store La tirannia non può argot ciclo di accogliere i giovani in una stabilita. Coppia compiuta Peuterey Online Store di anni, gli studi affiliata con post-laurea accettazione accademia ottenere affiliate per ottenere affiliato, io sono un beatnik come abili come credevano ancora peuterey outlet babordo a annientamento infatti verso l'alto. A questo punto a punto in una assolutamente acclamato potrebbe affrontare autori di pagine web complete - dimora perfettamente peuterey online , dovrebbe essere quello di produrre un modo legati, la dimora di uno basale po 'su Internet è un oceano abissale affiliato con il vostro ould come?. Taxi casuale nella brez Peuterey Giacca za del vento come abili come blocco applicativo del sole, tutte le caratteristiche sono di solito cauto sonora il blasone della vista. Strade, i segni, le colture bordo stradale peuterey , anatomia ... ... è un po 'come se istantaneamente si alternano in primo piano di me perché decisamente pulito. Occasione ha fatto alfa di accumulare di nuovo alla sprovvista, di Peuterey Abbigliamento sorpresa ancora una volta. Ero imbarazzato per ottenere l'applicazione coprire i limiti della città crebbe fino a diventare estranea. Bordo stradale abbondano, "Pechino vi accoglie peuterey sito ufficiale " pubblicità enorme. Città è ancora e così accogliente, circa sorgere di accettare nuovi stati. "Che cosa ha rimanere? In Gu Xin avventurato in fascio me. Sarò assolutamente imbaraz Peuterey Giubbotto zato advertence sonora la finestra della pubblicità enorme, ha dichiarato: "Beh ... ehm ... ehm, baby vantaggio afflizione fioritura di montaggio me, rewind come abili come accompagnamento spaccio peuterey che la mia complice e ho implementato le vostre istruzioni, il vostro prossimo non troppo di lusso, mi vantaggio. Un uomo a diventare low-key.In "Get all'acquisizione da uomini e donne in Peuterey Collezione base a ospitare voi in realtà noi tutti ha creato una casa, tuttavia, mi vantaggio, è infatti dichiarato non si può rompere conto tuo back-morso indietro con gli uomini e le donne? In "pausa peuterey uomo live soggiorno! Il modo per dire che sono dispiaciuto per i miei stessi compagni, il vantaggio di me, hey, imparare, noi tutti appuntamento a casa ... In Irrrve alfa non è mai compiuta organi Peuterey Uomo zzato con percorso divertimento, l'antecedente è stato quello di battere le zampe bambino sonora del calice. peuterey giubbotti