1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
hubzilla_ynh/sources/addon/wholikesme/wholikesme.php
2016-04-17 22:42:29 +05:30

38 lines
No EOL
881 B
PHP

<?php
/**
* Name: Who Likes me?
* Description: Find out who your biggest fans are (who "likes" your posts)
* Version: 1.0
* Author: Mike Macgirvin
* Maintainer: none
*/
function wholikesme_load() {}
function wholikesme_unload() {}
function wholikesme_module() {}
function wholikesme_content(&$a) {
if(! local_channel())
return;
$channel = App::get_channel();
$r = q("select count(mid) as total, author_xchan, xchan_name from item left join xchan on author_xchan = xchan_hash where uid = %d and verb = '%s' and owner_xchan = '%s' group by author_xchan order by total desc",
intval(local_channel()),
dbesc(ACTIVITY_LIKE),
dbesc($channel['xchan_hash'])
);
if($r) {
$o = '<h3>' . t('Who likes me?') . '</h3>';
$o .= '<ul>';
foreach($r as $rr) {
$o .= '<li>' . $rr['xchan_name'] . ' ' . $rr['total'] . '</li>';
};
$o .= '</ul>';
};
return $o;
}