[drupal-devel] [feature] List of bloggers
igrcic
drupal-devel at drupal.org
Sat Jun 18 22:07:48 UTC 2005
Issue status update for http://drupal.org/node/17030
Project: Drupal
Version: cvs
Component: blog.module
Category: feature requests
Priority: normal
Assigned to: Anonymous
Reported by: Bèr Kessels
Updated by: igrcic
Status: patch
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
Previous comments:
------------------------------------------------------------------------
February 8, 2005 - 23:27 : Bèr Kessels
Attachment: http://drupal.org/files/issues/blog_bloggers_list.patch (1.66 KB)
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.
------------------------------------------------------------------------
February 8, 2005 - 23:31 : Bèr Kessels
Attachment: http://drupal.org/files/issues/blog_bloggers_list.png (4.02 KB)
Here is a small screeny that shows what this is about.
------------------------------------------------------------------------
February 8, 2005 - 23:34 : Bèr Kessels
Attachment: http://drupal.org/files/issues/list_bloggers_2.png (2.25 KB)
hmm. error in my png file. Here is a correct one.
------------------------------------------------------------------------
February 19, 2005 - 20:13 : Emiliano
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.
------------------------------------------------------------------------
March 17, 2005 - 22:17 : Bèr Kessels
Attachment: http://drupal.org/files/issues/blog_bloggers_list_2.patch (1.81 KB)
and here is the actual patch. (i think i really need some script that
tells me i did not attach a patch ;) )
------------------------------------------------------------------------
March 17, 2005 - 22:19 : Bèr Kessels
Attachment: http://drupal.org/files/issues/blog_bloggers_list_2_0.patch (1.71 KB)
sigh. something tells me i should stop working.... a silly "F" sneaked
into the previous patch.
------------------------------------------------------------------------
March 24, 2005 - 20:25 : Anonymous
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.
------------------------------------------------------------------------
March 24, 2005 - 20:53 : Bèr Kessels
look in the menu admin.
------------------------------------------------------------------------
May 18, 2005 - 13:38 : Bèr Kessels
Nearly two months since the patch. If there is no need for this I will
mark it won't fix.
------------------------------------------------------------------------
May 18, 2005 - 13:52 : tostinni
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 :
<?php
$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>';
?>
------------------------------------------------------------------------
May 18, 2005 - 16:06 : Chris Johnson
I think this is a useful feature. I've coded custom blocks in the past
to provide it on my sites.
------------------------------------------------------------------------
May 21, 2005 - 05:23 : Andrzej7
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?
------------------------------------------------------------------------
May 22, 2005 - 16:24 : Bèr Kessels
To avoid confusion: this patch ads no blocks, but shows the list inline:
as content!
More information about the drupal-devel
mailing list