Display more blog authors and their total number of blog posts
jhereg69 - December 14, 2007 - 02:00
| Project: | Site map |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | frjo |
| Status: | needs review |
Description
If you have blog rendering enabled for the site map, and you have anonymous blog posts, the username display is "'s blog", as uid 0 (the anonymous account) has no name.
I can think of two ways to solve this: we hit the Drupal site info settings for the Anonymous account name, or we display blogs only if uid > 0 (we make the SQL query's WHERE clause "WHERE u.uid > 0 AND n.type = 'blog' AND n.status = 1").

#1
Fixed this bug by changing array("!s" => $account->name) to array("!s" => $account->name ? $account->name : variable_get("anonymous", t("Anonymous"))), which accounts for an anonymous blog. I fixed this in HEAD, but tested only on 5.x-1.1 (the blog code is identical across those two versions).
I then proceeded to add options to the blog settings: one to leave the anonymous blogs question to the user (whether or not to display the anonymous user blog is up to them) and another to add a more useful blog listing (sorted by most posts).
#2
I've seen this patch in action, and it does fix the anonymous user blog entry in the sitemap. Also, I like the ability it provides in the administration of the sitemap module.
#3
Interesting feature.
Can you please redo your patch against HEAD, I can not get it to apply cleanly and it's not in unified format (cvs diff -up).
http://drupal.org/patch/create
#4
Sorry about that. Here's the patch using cvs diff -up. The admin menu settings were still in the .module file in HEAD when I created the first patch, so I moved those changes to the new .inc file.
#5
#6
Boy, was I ever wrong about this. The problem nagged at me until I did more checking. It looks like this problem originates in the blog module; I've posted a question about how anonymous blogs should be handled there (http://drupal.org/node/224109).
So my bug report + fix is going away until I hear how they want to handle it in the blog module; I'll update my feature request, and post the updated patch soon.
#7
This patch adds the ability for the user to choose between displaying the first 10 blogs on a site (the original behavior) or display all blogs on a site, in descending order of total blog entries (total blog entries are displayed next to the blog name).