Small patch to show a list of bloggers. We all should know that blog.module is not meant for personal blogging, but that set aside, we do not have a way to show all bloggers, on a site as a list. This patch ads a few lines that will allow you to show that overview of blogging users. It ads a menu item, disabled by default that shows such a list.

Comments

Bèr Kessels’s picture

StatusFileSize
new4.02 KB

Here is a small screeny that shows what this is about.

Bèr Kessels’s picture

StatusFileSize
new2.25 KB

hmm. error in my png file. Here is a correct one.

Emiliano’s picture

Category: feature » bug

Hi Bèr Kessels!

Thanks for the patch! It's really useful! :-)

I just noticed what I think is a little mistake in this line:

$items[] = l($row->name, 'blog/'.$row->uid)." ".theme('xml_icon', url('blog/'.$row->uid.'/feed'), TRUE);

Which I believe should end like:

$items[] = l($row->name, 'blog/'.$row->uid)." ".theme('xml_icon', url('blog/feed/'.$row->uid), TRUE);

Ah, and BTW, "db_rewrite_sql" didn't work for me... I just cut it off... ;-)

Cheers,
Emiliano.

Anonymous’s picture

Bèr Kessels’s picture

Bèr Kessels’s picture

Bèr Kessels’s picture

StatusFileSize
new1.81 KB

and here is the actual patch. (i think i really need some script that tells me i did not attach a patch ;) )

Bèr Kessels’s picture

StatusFileSize
new1.71 KB

sigh. something tells me i should stop working.... a silly "F" sneaked into the previous patch.

Anonymous’s picture

Category: bug » support

I applied the patch, reuploaded the blog.module and then deactivated and reactivated it. I cannot see a difference. How do I access the blog users page?

Drupal 4.6rc

thanks for the help.

Bèr Kessels’s picture

look in the menu admin.

Bèr Kessels’s picture

Category: support » feature
Bèr Kessels’s picture

Nearly two months since the patch. If there is no need for this I will mark it won't fix.

tostinni’s picture

I made a custom block for this, but it still need a little improvment (add "read more" for example). So I don't know if it's usefull but if anyone care :

$result = db_query("SELECT u.uid, u.name, COUNT(0) AS num FROM {node} n LEFT JOIN {users} u ON u.uid = n.uid WHERE n.type = 'blog' GROUP BY u.uid, u.name ORDER BY u.name ASC");
while ($blog = db_fetch_object($result)) {
     $output .= '<li />'.l($blog->name. ' ('.$blog->num.')', 'blog/'.$blog->uid);
}
return '<ul>'.$output.'</ul>';
Chris Johnson’s picture

I think this is a useful feature. I've coded custom blocks in the past to provide it on my sites.

Andrzej7’s picture

I was a little afraid (poor PHP) to install the patch (March...), but I have made a block. And it's very nice.

One question only. All the bloggers are shown, but the Admin (user No 1) is on the list and he has no blogs.

What's that?

Bèr Kessels’s picture

To avoid confusion: this patch ads no blocks, but shows the list inline: as content!

igrcic’s picture

aaargh.....there is a problem when using PostgreSQL db. After I successfully patch blog.module and enable it in menu, click on it and following sql errors pop up:

warning: pg_query(): Query failed: ERROR:  function count(integer, character varying) does not exist
HINT:  No function matches the given name and argument types. You may need to add explicit type casts. in /web/www/htdocs/iaeste3/includes/database.pgsql.inc on line 45.

user error: 
query: SELECT COUNT(DISTINCT u.uid, u.name) FROM users u LEFT JOIN node n ON n.uid = u.uid WHERE n.type = 'blog' AND n.status =1 ORDER BY n.created DESC  in /web/www/htdocs/iaeste3/includes/database.pgsql.inc on line 62.
warning: pg_query(): Query failed: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list in /web/www/htdocs/iaeste3/includes/database.pgsql.inc on line 45.

user error: 
query: SELECT DISTINCT u.uid, u.name FROM users u LEFT JOIN node n ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC LIMIT 10 OFFSET 0 in /web/www/htdocs/iaeste3/includes/database.pgsql.inc on line 62

For first one its clear, there is no such fucntion in Postgresql, and second one is typical Postgresql/Mysql error, n.created isn't in select syntax. But if we put it in a select distinct syntax , it isn't DISTINCT anymore, so I get lots of lines with user and all of his blogs, with different time of course. So we must modify query a bit:

SELECT DISTINCT u.name, u.uid, MAX(n.created) as time FROM users u LEFT JOIN node n ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 GROUP BY u.name,u.uid ORDER BY time DESC

It works fine like this :)

Didn't look for first one yet... will when I catch some time.
Cheers!

igrcic’s picture

StatusFileSize
new1.75 KB

Sorry, here is a patch for a blog_bloggers_list_2_0.patch :)

Bèr Kessels’s picture

That doesz not seem a patch of a patch, but a regular patch.

Igrirc, please note that the SQL contains unbracketed tablenames. That is unacceptible. If you don't want to fix it, please report it back here, So I can fix it otherwise :)

Bèr Kessels’s picture

Status: Needs review » Needs work
Bèr Kessels’s picture

Status: Needs work » Needs review
StatusFileSize
new1.75 KB

Bingo! My own patch, brought to you by patchbingo!

essig’s picture

I think 'DISTINCT' can be removed from the query in blog_bloggers_list_1.patch. There is already a 'GROUP BY' clause over the same columns.

George Essig

Bèr Kessels’s picture

Thanks George, you are correct. I changed the query, it is now smaller and faster.

Bèr Kessels’s picture

I decided to take this out of the queue, for it is far too much work to get something into core. This will be placed insode userposts.module.

Bèr Kessels’s picture

Status: Needs review » Needs work

what is with those kind of issues that add consistency and usability. Those kind of issues that are made after often heard requests in the forulms and so?

Why did Dries or Steven not even spend time commenting on it. Even closing this issue would suffice.

This is one of these issues that someone (in this case me) spent a lot of time on, that all people are positive about, yet linger and linger and linger.

Is this another five hors (or so) of my life wasted? No really, this gets frustrating. Every day I stumble upon my issues tha go back ages yet are not closed nor applied. frustrating and demoralizing.

bonobo’s picture

I had just come onto the site to search for precisely this functionality -- this has some GREAT applications for a blog based class site -- I will be applying the patch to the blog module, and using the custom block created above -- I would love to see both a patch for 4.6.3, and this feature in core for 4.7

If you want patches on this tested, I'm happy to do it.

Thanks for your work on this.

bonobo

bonobo’s picture

Version: » 4.6.3
Assigned: Unassigned » bonobo
Status: Needs work » Closed (fixed)

Closing due to age of issue and the existence of the blogger module,