prepare_comments_backend

Extends or modifies data of comments displayed in backend.

Blog

Input (passed by reference)

$params array Comments data array.
… your plugin code …

Output

Blog

Plugin code example

PHP

public function prepareCommentsBackend(&$params)
{
    waLog::log(print_r($params, true), 'blog/myplugin/prepare-comments-backend.log');
    //add user country name to each comment
    $countries = array();
    foreach ($params as &$comment) {
        if (!isset($countries[$comment['ip']])) {
            $countries[$comment['ip']] = blogMyPluginHelper::getCountryByIp($comment['ip']);
        }
        $comment['country'] = $countries[$comment['ip']];
    }
}