ExpressionEngine® 3 User Guide

Legacy Documentation

You are using the documentation for version 3.5.17. Go here for the latest version or check here for your available upgrades to the latest version.

Comment Model Extension Hooks

before_comment_insert

before_comment_insert($comment, $values)

Called before the comment object is inserted. Changes made to the object will be saved automatically.

How it’s called:

ee()->extensions->call('before_comment_insert', $this, $this->getValues());
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_comment_insert

after_comment_insert($comment, $values)

Called after the comment object is inserted. Changes made to the object object will not be saved automatically. Saving the object may trigger the save and update hooks.

How it’s called:

ee()->extensions->call('after_comment_insert', $this, $this->getValues());
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

before_comment_update

before_comment_update($comment, $values, $modified)

Called before the comment object is updated. Changes made to the object will be saved automatically.

How it’s called:

ee()->extensions->call('before_comment_update', $this, $this->getValues(), $modified);
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
  • $modified (array) – An array of all the old values that were changed
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_comment_update

after_comment_update($comment, $values, $modified)

Called after the comment object is updated. Changes made to the object will not be saved automatically. Calling save may fire additional hooks.

How it’s called:

ee()->extensions->call('after_comment_update', $this, $this->getValues(), $modified);
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
  • $modified (array) – An array of all the old values that were changed
Returns:

void

Return type:

NULL

New in version 3.1.0.

before_comment_save

before_comment_save($comment, $values)

Called before the comment object is inserted or updated. Changes made to the object will be saved automatically.

How it’s called:

ee()->extensions->call('before_comment_save', $this, $this->getValues());
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_comment_save

after_comment_save($comment, $values)

Called after the comment object is inserted or updated. Changes made to the object will not be saved automatically. Calling save may fire additional hooks.

How it’s called:

ee()->extensions->call('after_comment_save', $this, $this->getValues());
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

before_comment_delete

before_comment_delete($comment, $values)

Called before the comment object is deleted. If you are conditionally deleting one of your own models, please consider creating an inverse relationship instead. This will provide better performance and strictly enforce data consistency.

How it’s called:

ee()->extensions->call('before_comment_delete', $this, $this->getValues());
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_comment_delete

after_comment_delete($comment, $values)

Called after the comment object is deleted. If you are conditionally deleting one of your own models, please consider creating an inverse relationship instead. This will provide better performance and strictly enforce data consistency.

How it’s called:

ee()->extensions->call('after_comment_delete', $this, $this->getValues());
Parameters:
  • $comment (object) – Current comment model object
  • $values (array) – The comment model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.