Index: schema.php
===================================================================
--- schema.php	(revision 1077)
+++ schema.php	(working copy)
@@ -300,7 +301,8 @@
 		"rss.output.title"			=> array('Gregarius','Gregarius','string','Sets the title of this feedreader.',NULL),
 		"rss.config.ajaxparallelsize"			=> array('3','3','num','Sets the number of feeds to update in parallel. Remember to set rss.config.serverpush to false.',NULL),
 		"rss.config.ajaxbatchsize"			=> array('3','3','num','Sets the number of feeds in a batch when using the ajax updater. Remember to set rss.config.serverpush to false.',NULL),
-		"rss.config.defaultdashboard"	  		=> array('true','true','boolean','If the first page seen when entering the admin section should be the dashboard',NULL)
+		"rss.config.defaultdashboard"	  		=> array('true','true','boolean','If the first page seen when entering the admin section should be the dashboard',NULL),
+		"rss.output.tagsorting"	  		=> array('alphabetial,count,date,0','alphabetical,count,date,0','enum','How the tag listing should be sorted',NULL)
 	);
 	
 	
Index: cls/alltags.php
===================================================================
--- cls/alltags.php	(revision 1077)
+++ cls/alltags.php	(working copy)
@@ -72,26 +72,34 @@
 	 */
 	function populate() {
 		// the all tags weighted list
-		$sql = "select t.id, tag, count(*) as cnt from "
-			.getTable('metatag');
+		$sql = "select t.id, t.tag, count(*) as cnt from "
+			.getTable('metatag') . " m";
 		if($this -> type == 'channel'){
-			$sql .= " left join " . getTable('channels') . " c on (fid=c.id),"
-				.getTable('tag')." t "." where tid=t.id "
-				. " and ttype = 'channel'";
+			$sql .= " left join " . getTable('channels') . " c on (m.fid=c.id),"
+				.getTable('tag')." t "." where m.tid=t.id "
+				. " and m.ttype = 'channel'";
 		}else{
-			$sql .= " left join ".getTable('item')." i on (fid=i.id),"
-				.getTable('tag')." t "." where tid=t.id "
-				." and ttype = 'item'";
+			$sql .= " left join ".getTable('item')." i on (m.fid=i.id),"
+				.getTable('tag')." t "." where m.tid=t.id "
+				." and m.ttype = 'item'";
 		}
 
-
 		// Don't count tags of private items
 		if (hidePrivate()) {
 			$sql .= " and not(i.unread & ".FEED_MODE_PRIVATE_STATE.") ";
 		}
 		
-		$sql .= "group by tid order by tag";
+		$sql .= "group by m.tid";
 
+    switch(getConfig("rss.output.tagsorting")) {
+        case "date"         : $sql .= " order by m.tdate, t.tag";
+                              break;
+        case "count"        : $sql .= " order by cnt, t.tag";
+                              break;
+        case "alphabetical" : $sql .= " order by t.tag";
+        default             :
+                              break;
+    }
 		
 		$res = rss_query($sql);
 		$max = 0;
