[3886] trunk/htdocs/system/classes/tag.php: Don' t match the tag rewrite if there are no published posts with that tag.

0 views
Skip to first unread message

svn-N...@habariproject.org

unread,
Dec 13, 2009, 9:33:53 PM12/13/09
to habar...@googlegroups.com
Revision
3886
Author
michaeltwofish
Date
2009-12-14 02:33:53 +0000 (Mon, 14 Dec 2009)

Log Message

Don't match the tag rewrite if there are no published posts with that tag.

Modified Paths

Diff

Modified: trunk/htdocs/system/classes/tag.php (3885 => 3886)


--- trunk/htdocs/system/classes/tag.php	2009-12-14 01:23:25 UTC (rev 3885)
+++ trunk/htdocs/system/classes/tag.php	2009-12-14 02:33:53 UTC (rev 3886)
@@ -72,14 +72,14 @@
 	}
 
 	/**
-	 * Check if a tag exists, to see if we should match this rewrite rule
+	 * Check if a tag exists on a published post, to see if we should match this rewrite rule.
 	 *
-	 * @return Boolean Whether the tag exists.
+	 * @return Boolean Whether the tag exists on a published post.
 	 **/
 	public static function rewrite_tag_exists($rule, $slug, $parameters)
 	{
 		$tag = Tag::get($rule->named_arg_values['tag']);
-		return $tag instanceOf Tag;
+		return ($tag instanceOf Tag && Posts::count_by_tag($tag->tag_text, Post::status('published')) > 0);
 	}
 
 	/**
Reply all
Reply to author
Forward
0 new messages