Posted by nimzie on September 8, 2008 at 8:14pm
| Project: | Archive |
| Version: | 5.x-1.11 |
| Component: | Block |
| Category: | bug report |
| Priority: | normal |
| Assigned: | ajaysolutions |
| Status: | needs review |
Issue Summary
I've got the module plugged in.. It's only filtering blog postings, yet the count is showing me 92 documents.
How to fix?
Thanks,
Adam
Comments
#1
I'm not positive that the block filters out the content like the archive listing page does.
Is the count on the archive listing page correct?
#2
The count on the archive listing page looks OK. The Archive block does what I need (subnav for archived content) so I would like to be able to use this one.
I'm not sure what you mean by "I'm not positive that the block filters out the content like the archive listing page does." ... can it?
#3
What I meant was I don't think the blocks respect filters defined on the settings page, and that indeed appears to be the case. The blocks need to respect that setting.
#4
Any idea how to patch/fix this ?
#5
Not off the top of my head, I haven't looked at the code in a while. You'd just need to compare the database queries (calls to
db_query()) from the main page to the one used by the block and see what the problem is.#6
So - in theory, should the call to db_query in archive_month_list be the same as _archive_post_count or vice versa?
Thanks for your help.
Adam
#7
archive_month_listshould probably use the same code as_archive_post_count, though it might need to be tweaked because they do different things.archive_month_list()tries to find the post count per month for the last X months while_archive_post_count()only does that for months that are in this current calendar year.#8
Hmm, I've looked in to this and am not really comfortable with my understanding of how to alter things and not break them. Is there any chance you'd be able to have a look or at least let me know how to remove the count from the returned information so at least what I am seeing isn't inaccurate?
Thanks for your help either way.
#9
Change the line that looks like:
$links[] = l(t($data['month_name'] . ' ' . $year), 'archive/all/' . $year . '/' . $month, array('title' => format_plural($data['count'], '1 post', '@count posts')));to
$links[] = l(t($data['month_name'] . ' ' . $year), 'archive/all/' . $year . '/' . $month);#10
Thanks, that works just fine. If you decide to fix that, please drop me a line. It's a great module. Cheers.
#11
This will be fixed in the future at some point and it'll include a new release, so the status_update.module will alert you.
#12
#13
I'm having the same issue with the 6.x code but I think the fix above in #9 is for different code in 5.x - can anybody suggest a fix for 6.x also please?
#14
Here's a proposed fix for Archive in Drupal 5.x and 6.x I believe. I've created a patch for this in 6.x, or you can use the instructions below to fix your own module for your own version. I'm fairly certain this issue is a duplicate of #305676: Archive month listing block displays months with no nodes - this patch should fix both issues for Archive in Drupal 6.
If your issue is with 5.x or you aren't sure how to patch, you can apply this fix to your own archive.module file by replacing the following line (depending on version) with the following code:
Replace the entire line with this code (same for both versions):
$node_query = db_query(db_rewrite_sql('SELECT n.created FROM {node} n WHERE n.status = 1 AND n.type IN (\'' . implode("', '", variable_get('archive_type_filters', array())) . '\') AND DATE(FROM_UNIXTIME(n.created)) BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 MONTH) AND CURDATE() ORDER BY n.created DESC'));Can someone please test this patch for Archive 6.x-1.4 and confirm it works. If so can this patch be applied to the module? Thanks!
EDIT: Forgot to mention thanks to "michaek" for their original code suggestion which I used for this patch/post.
Al,