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

jhereg69 - December 21, 2007 - 23:28
Version:5.x-1.1» HEAD
Component:User interface» Code
Assigned to:Anonymous» jhereg69
Status:active» needs review

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

AttachmentSize
blog-option.patch 3.78 KB

#2

freephile - January 2, 2008 - 22:00

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

frjo - January 8, 2008 - 10:58
Category:bug report» feature request
Assigned to:jhereg69» frjo
Status:needs review» needs work

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

jhereg69 - January 8, 2008 - 17:57

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.

AttachmentSize
site_map_blog_options.patch 5.51 KB

#5

jhereg69 - January 10, 2008 - 18:23
Status:needs work» needs review

#6

jhereg69 - February 20, 2008 - 19:27
Category:feature request» bug report
Status:needs review» reviewed & tested by the community

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

jhereg69 - February 20, 2008 - 20:46
Title:Blogs by anonymous users display incorrectly» Display more blog authors and their total number of blog posts
Category:bug report» feature request
Status:reviewed & tested by the community» needs review

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

AttachmentSize
site_map_blog_options.patch 4.87 KB
 
 

Drupal is a registered trademark of Dries Buytaert.