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

CommentFileSizeAuthor
#14 archive_6.x-1.4.patch956 bytesajaysolutions

Comments

Susurrus’s picture

Status: Active » Postponed (maintainer needs more info)

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?

nimzie’s picture

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?

Susurrus’s picture

Status: Postponed (maintainer needs more info) » Active

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.

nimzie’s picture

Any idea how to patch/fix this ?

Susurrus’s picture

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.

nimzie’s picture

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

Susurrus’s picture

archive_month_list should 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.

nimzie’s picture

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.

Susurrus’s picture

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);

nimzie’s picture

Thanks, that works just fine. If you decide to fix that, please drop me a line. It's a great module. Cheers.

Susurrus’s picture

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.

R.Muilwijk’s picture

Category: support » bug
ajaysolutions’s picture

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?

ajaysolutions’s picture

Assigned: Unassigned » ajaysolutions
Status: Active » Needs review
StatusFileSize
new956 bytes

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:

  • For Drupal 5.x - line 493
  • For Drupal 6.x - line 212

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,