Don't count unpublished posts

chrislb - March 24, 2009 - 07:41
Project:Tagadelic
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Description

Tagadelic currently includes unpublished posts which makes clouds appear bigger to users then their actual content is.

In line 209 change
$result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);

to

$result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid JOIN {node} o USING (nid) WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') AND o.status = 1 GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);

#1

javierreartes - September 24, 2009 - 21:43

this works for 6.x-1.2 too, the only difference is that it's in line 228

#2

HedgeMage - September 25, 2009 - 17:26

subscribe

#3

Frank Ralf - September 30, 2009 - 13:01
Version:5.x-1.0» 6.x-1.2
Status:patch (to be ported)» needs review

I applied this modification successfully to Tagadelic 6.x-1.2 and rolled it into a proper patch, might also work for 5 version.

Frank

AttachmentSize
tagadelic.411852.patch 1.48 KB

#4

HedgeMage - October 3, 2009 - 21:18
Status:needs review» reviewed & tested by the community

I've tested this on a couple of sites, and it is working beautifully! I suspect it should probably be against head or the dev version, but I'm not sure if the maintainers mind either way, so leaving as "needs review".

--Susan

#5

HedgeMage - October 3, 2009 - 21:18
Status:reviewed & tested by the community» needs review

Fixing the accidental RTBC above (see the non-matching comment).

#6

Bèr Kessels - October 5, 2009 - 09:19
Status:needs review» needs work

please remove the commented lines from the patch.

#7

Bèr Kessels - October 5, 2009 - 09:20
Version:6.x-1.2» 6.x-1.x-dev

work against dev please

#8

Frank Ralf - October 5, 2009 - 12:30

Will do. Just one question: Which CVS branch shall I use?

Tagadelic 6.x-1.x-dev is taken from CVS branch DRUPAL-6--1 (http://drupal.org/node/227507) but HEAD seems to be more current.

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/tagadelic/?...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/tagadelic/?...

tia
Frank

#9

Bèr Kessels - October 6, 2009 - 08:02

@Frank: if git suits you, you can fire against http://github.com/berkes/tagadelic
Else, you choose: 6.x-1.xdev, or 6.x-1.2 will both work. I will make sure a patch commits. And since I do that in git, merging and fiddling is rather easy :)

So: whatever suits you. My remark above was not for the patch, but for bugtracking. :)

#10

Frank Ralf - October 6, 2009 - 14:39

@Bèr
Thanks for the hint. There has been a lot of excitement around git lately but I'm busy enough to understand even one version control system sufficiently so I will stay with CVS for a while ;-)

I rolled the patch again against DRUPAL-6--1 from CVS. And while I was at it, I also ran the module through Coder and amended some minor glitches.

hth
Frank

AttachmentSize
tagadelic.411852.2.patch 4.61 KB

#11

Summit - October 29, 2009 - 10:43

Subscribing, greetings, Martijn

#12

jari - November 10, 2009 - 08:44

I've tried the modified SQL query part with 5.x-1.1 and seems to work without problems.

 
 

Drupal is a registered trademark of Dries Buytaert.