ExpressionEngine® User Guide

Legacy Documentation

You are using the documentation for version 4.3.8. Go here for the latest version.

Comment Module Extension Hooks

Control Panel Hooks (mcp.comment.php)

delete_comment_additional

delete_comment_additional($comment_ids)

Allows additional processing after a comment is deleted.

How it’s called:

ee()->extensions->call('delete_comment_additional', $comment_ids);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $comment_ids (array) – Comment IDs being deleted
Return type:

Void

New in version 1.4.0.

update_comment_additional

update_comment_additional($comment_id, $data)

Allows additional processing when a comment is updated, executed after the comment is updated.

How it’s called:

ee()->extensions->call('update_comment_additional', $comment_id, $data);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $comment_id (int) – ID of the comment being modified
  • $data (array) – Comment data
Return type:

Void

New in version 1.4.0.

Frontend Comment Hooks (mod.comment.php)

comment_entries_query_result

comment_entries_query_result($results)

Take the result of the query that gathers the data to display in the Comment Entries tag and modify it.

How it’s called:

$results = ee()->extensions->call('comment_entries_query_result', $results);
if (ee()->extensions->end_script === TRUE) return ee()->TMPL->tagdata;
Parameters:
  • $results (array) – Database result array
Returns:

Modified $results

Return type:

Array

New in version 3.1.0.

comment_entries_comment_ids_query

comment_entries_comment_ids_query($db)

Take the database query object that is building the query to gather IDs for comments to be shown via the Comment Entries tag and manipulate it with your own ->where() clauses. No need to return the object after use.

How it’s called:

ee()->extensions->call('comment_entries_comment_ids_query', ee()->db);
if (ee()->extensions->end_script === TRUE) return ee()->TMPL->tagdata;
Parameters:
  • object $db (Database) – Query builder instance for the comment IDs query
Return type:

Void

New in version 3.1.0.

comment_entries_comment_format

comment_entries_comment_format($row)

Do whatever you want to the comment variable

How it’s called:

$comment = ee()->extensions->call('comment_entries_comment_format', $row);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $row (array) – Data for current comment
Returns:

Rendered comment

Return type:

String

New in version 1.4.0.

comment_entries_tagdata

comment_entries_tagdata($tagdata, $row)

Modify and play with the comment entries tagdata before everyone else.

How it’s called:

$tagdata = ee()->extensions->call('comment_entries_tagdata', $tagdata, $row);
if (ee()->extensions->end_script === TRUE) return $tagdata;
Parameters:
  • $tagdata (string) – Tagdata within comment entries tag
  • $row (array) – Data for current comment
Returns:

Modified $tagdata

Return type:

String

New in version 1.4.0.

comment_form_end

comment_form_end($res)

Modify, add, etc. something to the comment form at end of processing.

How it’s called:

$res = ee()->extensions->call('comment_form_end', $res);
if (ee()->extensions->end_script === TRUE) return $res;
Parameters:
  • $res (string) – Current tagdata for form
Returns:

Modified $res (tagdata)

Return type:

String

New in version 1.5.2.

comment_form_hidden_fields

comment_form_hidden_fields($hidden_fields)

Add/Remove Hidden Fields for Comment Form.

How it’s called:

$hidden_fields = ee()->extensions->call('comment_form_hidden_fields', $hidden_fields);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $hidden_fields (array) – Current hidden fields for the comment form
Returns:

Modified $hidden_fields

Return type:

Array

New in version 1.4.0.

comment_form_tagdata

comment_form_tagdata($tagdata)

Modify, add, replace anything in the Comment Form tag.

How it’s called:

$tagdata = ee()->extensions->call('comment_form_tagdata', $tagdata);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $tagdata (string) – Comment form tagdata
Returns:

Modified $tagdata

Return type:

String

New in version 1.4.0.

comment_preview_comment_format

comment_preview_comment_format($row)

Play with the tagdata contents of the comment preview.

How it’s called:

$data = ee()->extensions->call('comment_preview_comment_format', $query->row());
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $row (array) – Data for the comment being previewed
Returns:

Rendered comment preview

Return type:

String

New in version 1.4.0.

comment_preview_tagdata

comment_preview_tagdata($tagdata)

Play with the tagdata contents of the comment preview.

How it’s called:

$tagdata = ee()->extensions->call('comment_preview_tagdata', $tagdata);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $tagdata (string) – Comment preview tagdata
Returns:

Modified $tagdata

Return type:

String

New in version 1.4.0.

insert_comment_start

insert_comment_start()

Allows complete rewrite of comment submission routine, or could be used to modify the POST data before processing.

How it’s called:

ee()->extensions->call('insert_comment_start');
if (ee()->extensions->end_script === TRUE) return;
Return type:Void

New in version 1.4.0.

insert_comment_end

insert_comment_end($data, $comment_moderate, $comment_id)

More emails, more processing, different redirect at the end of the comment inserting routine.

How it’s called:

ee()->extensions->call('insert_comment_end', $data, $comment_moderate, $comment_id);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $data (array) – Data for the new comment
  • $comment_moderate (boolean) – TRUE if the comment is going to be moderated
  • $comment_id (int) – ID of comment
Return type:

Void

New in version 1.6.1.

insert_comment_insert_array

insert_comment_insert_array($data)

Modify any of the soon to be inserted values for a new comment.

How it’s called:

$data = ee()->extensions->call('insert_comment_insert_array', $data);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $data (array) – Data for the new comment
Returns:

Modified $data

Return type:

Array

New in version 1.5.0.

insert_comment_preferences_sql

insert_comment_preferences_sql($sql)

Rewrite or add to the comment preference sql query - Could be handy for comment/weblog restrictions.

How it’s called:

$sql = ee()->extensions->call('insert_comment_preferences_sql', $sql);
if (ee()->extensions->end_script === TRUE) return;
Parameters:
  • $sql (string) – Current query to return preferences for a comment insert
Returns:

Modified $sql

Return type:

String

New in version 1.4.0.