1
0
Fork 0
mirror of https://github.com/Findus23/plugin-ProfileAvatar.git synced 2024-09-19 15:23:45 +02:00
plugin-ProfileAvatar/ProfileAvatar.php

29 lines
740 B
PHP
Raw Permalink Normal View History

2020-05-20 10:41:04 +02:00
<?php
namespace Piwik\Plugins\ProfileAvatar;
use Piwik\DataTable\Row;
2020-05-20 10:41:04 +02:00
use Piwik\Plugin;
class ProfileAvatar extends Plugin
{
public function registerEvents()
{
return array(
'Live.renderVisitorDetails' => 'addImageToTemplate',
);
}
2020-05-20 10:41:04 +02:00
public function addImageToTemplate(string &$outString, Row $visit)
{
$settings = new UserSettings();
if (!$settings->showInVisitorLog->getValue()) {
return;
}
$visitorID = $visit->getColumn("visitorId");
$hash = hash("sha256", $visitorID);
$outString .= "<img width='32' height='32' alt='user profile' src='?module=ProfileAvatar&action=getProfileAvatar&hash=$hash' aria-hidden='true'>";
}
2020-05-20 10:41:04 +02:00
}