*/
$tags->selectAdd();
$tags->selectAdd('tag');
+ $tags->selectAdd('notice_id');
+ $tags->selectAdd('scope');
// Add the aggregated columns...
$tags->selectAdd('max(notice_id) as last_notice_id');
$cutoff = sprintf("notice_tag.created > '%s'",
common_sql_date(time() - common_config('tag', 'cutoff')));
$tags->selectAdd($calc . ' as weight');
+ $tags->joinAdd(array('notice_id', 'notice:id'));
$tags->whereAdd($cutoff);
$tags->groupBy('tag');
$tags->orderBy('weight DESC');
$tw = array();
$sum = 0;
while ($tags->fetch()) {
- $tw[$tags->tag] = $tags->weight;
- $sum += $tags->weight;
+ // Check scope:
+ if ($tags->isCurrentProfileInScope()) {
+ $tw[$tags->tag] = $tags->weight;
+ $sum += $tags->weight;
+ }
}
ksort($tw);