mycred_parse_tags_comment

Codex / mycred/log / Filters / mycred_parse_tags_comment

Navigation:

  1. Description
  2. Used By
  3. Parameters
  4. Example

Description

This filter lets you add support for custom comment related template tags or override the default ones.

These template tags are only used in the “Points for Commenting” hook by default and contains template tags for the most commonly required comment details.

Used By

Parameters

  • content (string)
    The content containing template tags.
    Remember to always return the content once you are done!
  • comment (object)
    The comment object.
    Note! If the comment has been deleted you will only have access to $comment->comment_ID and $comment->comment_post_ID.
  • data (array|string)
    If parsing the myCRED Log, the data column is passed on here. Else it will contain an empty string.

Example

Add a new template tag %IP% which will return the IP address of the comment author.

add_filter( 'mycred_parse_tags_comment', 'my_custom_comment_template_tags', 10, 3 );
function my_custom_comment_template_tags( $content, $comment, $data )
{
	$content = str_replace( '%IP%', $comment->comment_author_IP, $content );
	return $content;
}

Add this code to your themes functions.php file

Last edited June 26, 2016