добавил возможность вывода облака тегов, отфильтрованный по имени/ID автора
Для этого в вызове {exp:simpletag:tagcloud}
можно (и нужно!) использовать параметры
username=”юзернейм автора”
author=“ID автора”
чтобы все заработало, в файле mod.simpletag.php
найдите функцию tagcloud() и замените её код на следующий
function tagcloud()
{
global $TMPL, $DB;
$output = "";
$weblog_sql = "";
$tags = array();
if ($weblog = $TMPL->fetch_param('weblog')) {
$weblog_sql = $this->weblog_sql($weblog);
if ( $weblog_sql === FALSE ) return;
}
$orderby = ( ! $TMPL->fetch_param('orderby')) ? '' : $TMPL->fetch_param('orderby');
$limit = ( ! $TMPL->fetch_param('limit')) ? '' : $TMPL->fetch_param('limit')+0;
$max_size = ( ! $TMPL->fetch_param('font_max')) ? '250' : $TMPL->fetch_param('font_max')+0;
$min_size = ( ! $TMPL->fetch_param('font_min')) ? '100' : $TMPL->fetch_param('font_min')+0;
$path = ( ! $TMPL->fetch_param('path')) ? '' : $TMPL->fetch_param('path');
$username = ( ! $TMPL->fetch_param('username')) ? '' : $TMPL->fetch_param('username');
$author = ( ! $TMPL->fetch_param('author')) ? '' : $TMPL->fetch_param('author');
if ($author!='') {
$sql = "SELECT st.realtag, COUNT(st.entry_id) AS quantity FROM exp_sz_simple_tags AS st, exp_weblog_titles AS t WHERE st.entry_id=t.entry_id AND t.author_id='$author' AND $weblog_sql GROUP BY tag ORDER BY tag ASC;";
if ( $limit > 0 ) $sql = "SELECT st.realtag, COUNT(st.entry_id) AS quantity FROM exp_sz_simple_tags AS st, exp_weblog_titles AS t WHERE st.entry_id=t.entry_id AND t.author_id='$author' AND $weblog_sql GROUP BY tag ORDER BY quantity DESC LIMIT $limit;";
} else if ($username!='') {
$sql = "SELECT st.realtag, COUNT(st.entry_id) AS quantity FROM exp_sz_simple_tags AS st, exp_weblog_titles AS t, exp_members AS m WHERE st.entry_id=t.entry_id AND t.author_id=m.member_id AND m.username='$username' AND $weblog_sql GROUP BY tag ORDER BY tag ASC;";
if ( $limit > 0 ) $sql = "SELECT st.realtag, COUNT(st.entry_id) AS quantity FROM exp_sz_simple_tags AS st, exp_weblog_titles AS t, exp_members AS m WHERE st.entry_id=t.entry_id AND t.author_id=m.member_id AND m.username='$username' AND $weblog_sql GROUP BY tag ORDER BY quantity DESC LIMIT $limit;";
} else {
$weblog_sql = " WHERE ".$weblog_sql;
$sql = "SELECT realtag, COUNT(entry_id) AS quantity FROM exp_sz_simple_tags st $weblog_sql GROUP BY tag ORDER BY tag ASC;";
if ( $limit > 0 ) $sql = "SELECT realtag, COUNT(entry_id) AS quantity FROM exp_sz_simple_tags st $weblog_sql GROUP BY tag ORDER BY quantity DESC LIMIT $limit;";
}
$query = $DB->query($sql);
foreach ($query->result as $row) {
$tags[$row['realtag']] = $row['quantity'];
}
if (count($tags)==0) return; // nothing to output
$output = $this->help_cloud ($tags, $path, $max_size, $min_size, $orderby);
return $output;
}