oops - returned too many items

This commit is contained in:
friendica 2013-07-02 21:19:12 -07:00
parent 08023eb099
commit b021c8e31e
2 changed files with 11 additions and 8 deletions

View File

@ -96,19 +96,22 @@ function format_term_for_display($term) {
// Tag cloud functions - need to be adpated to this database format // Tag cloud functions - need to be adpated to this database format
function tagadelic($uid, $count = 0, $type = TERM_HASHTAG) { function tagadelic($uid, $count = 0, $flags = 0, $type = TERM_HASHTAG) {
dbg(1);
if($flags)
$sql_options = " and (item_flags & " . intval($flags) . ") ";
// Fetch tags // Fetch tags
$r = q("select term, count(term) as total from term $r = q("select term, count(term) as total from term left join item on term.oid = item.id
where uid = %d and type = %d where term.uid = %d and term.type = %d
and otype = %d and otype = %d
$sql_options
group by term order by total desc %s", group by term order by total desc %s",
intval($uid), intval($uid),
intval($type), intval($type),
intval(TERM_OBJ_POST), intval(TERM_OBJ_POST),
((intval($count)) ? "limit $count" : '') ((intval($count)) ? "limit $count" : '')
); );
dbg(0);
if(! $r) if(! $r)
return array(); return array();
@ -145,10 +148,10 @@ function tags_sort($a,$b) {
} }
function tagblock($link,$uid,$count = 0,$type = TERM_HASHTAG) { function tagblock($link,$uid,$count = 0,$flags = 0,$type = TERM_HASHTAG) {
$o = ''; $o = '';
$tab = 0; $tab = 0;
$r = tagadelic($uid,$count,$type); $r = tagadelic($uid,$count,$flags,$type);
if($r) { if($r) {
$o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">'; $o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';

View File

@ -48,7 +48,7 @@ function channel_aside(&$a) {
$a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$cat)); $a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$cat));
} }
if(feature_enabled($a->profile['profile_uid'],'tagadelic')) if(feature_enabled($a->profile['profile_uid'],'tagadelic'))
$a->set_widget('tagcloud',tagblock('search',$a->profile['profile_uid'])); $a->set_widget('tagcloud',tagblock('search',$a->profile['profile_uid'],50,ITEM_WALL));
} }