I have just fixed a bug that I noticed in the Article.module that was annoying me.
The latest articles box to the right lists updates to the site; however, it would list an article many times if you assigned more than one tag to it and fill up the list with duplicate links to the same article. This, obviously, is not happening anymore.
I simply put a DISTINCT in the SQL query that pulls the items. This keyword prevents duplication of articles and links.
A quick and dirty fix.
| Attachment | Size |
|---|---|
| article.module | 14.9 KB |
| article.old.module | 14.93 KB |
| patch.diff | 985 bytes |

Comments
I try to use the patch for this module at drupal official website, but for some reason, I upload the patch to mysql, it spit out mysql error.
I'm using phpmyadmin to upload the patch. So my article module at the moment is broken. Can you help me solve this problem? Since you fix your :).
******error proof***********
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unknown Punctuation String @ 197
STR: ==
SQL: --- article.module 2005-08-24 01:08:28.006502192 +0800
+++ oldarticle.module~ 2005-08-24 01:08:02.962309488 +0800
@@ -351,7 +351,7 @@ function article_select_nodes($tids = ar
if ($operator == 'or') {
$str_tids = implode(',', call_user_func_array('array_merge', $descendant_tids))
SQL query: Documentation
--- article.module 2005-08-24 01:08:28.006502192 +0800 +++ oldarticle.module~ 2005-08-24 01:08:02.962309488 +0800 @@ -351,7 +351,7 @@ function article_select_nodes($tids = ar if ($operator == 'or') { $str_tids = implode(',', call_user_func_array('array_merge', $descendant_tids))
MySQL said: Documentation
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '--- article.module 2005-08-24 01:08:28.006502192 +0800
********error end***********
I have attached the original article module (article.old.module) to this post as well as the diff between my post and the original.
You can patch the original by downloading both article.old.module and patch.diff to the same directory and then typing :
patch -p0 article.old.module patch.diffand you will get the same result as downloading article.module from this post
As a side note please ensure you are running Drupal 4.6.3 and mySQL 4.x. I don't know if this will work for other versions. It should but I haven't tested beyond my own setup.
Also, ensure that phpMyAdmin is not mangling the file on upload. I have not used it before so I can't comment on this.
Finally, this is a PHP code module, you should not be trying to upload this file into mySQL. If I am reading your post correctly.
You simply replace the article.module file in your Drupal installs' "modules" or "modules/article" directory. If you have tried to upload this file into mySQL I hope you made a backup of your database because I don't know what this may have done to you.
at the following location http://drupal.org/node/33985