The default Blog module provides a list of blog entries (with the Blog title/link displayed beneath the post); however, I would like to create a page or block that just displays a list of all of the Blogs that exist on the site. The listing would consist of Blog Titles only. Clicking on a Blog Title would take the user to a page that displays the Blog Title and all entries/posts for that Blog (the same way that clicking on the Blog title for a recent blog post takes you to a page listing all of that Blog's entries). Is there a configuration option, or contributed module/hack that enables this kind of operation? If not, suggested PHP code snippets to accomplish this will be greatly appreciated. Thx,

Donovan.

Comments

Donovan@drupal.org’s picture

I am attempting to modify Kitt's excellent tutorial on creating modules to accomplish this. So far, I have been able to create a custom block that will list blog nodes using the following code:

function bloglist_block($op='list', $delta=0) { 

  // listing of blocks, such as on the admin/system/block page 
  if ($op == "list") { 
    $block[0]["info"] = t("Blog List"); 
    return $block; 
  } else { 
  // our block content 

    // content variable that will be returned for display 
    $block_content = ''; 

    // Get list of blogs 
    $query = "SELECT nid, title, created FROM " . 
             "{node} WHERE type = 'blog'"; 

    // get the links 
    $queryResult =  db_query($query); 
    while ($links = db_fetch_object($queryResult)) { 
      $block_content .= '< a href="'.url('node/view/'.$links->nid).'" >'. 
                        $links->title . '< /a>< br />'; 
    } 
	
    // set up the block 
    $block['subject'] = 'Blog List'; 
    $block['content'] = $block_content; 
    return $block; 
  } 
}

This is going in the direction that I would like, but it is not there yet: I want the block to list just the Blog Titles (i.e., the Parents of each blog node --not the titles of the nodes (i.e., blog entries) themselves.

Unfortunately, I am a PHP/Drupal newbie and don't know where to turn. Any guidance/pointers in the right direction is appreciated. Thx,

Donovan.

mason’s picture

This is definitely something may people would like for Drupal to provide.

mwnovak’s picture

I'm just starting out with Drupal... most of my questions have been answered by searching through the forums. This seems like a great community around here with less of the "ego" I'm used to finding in user-driven support forums.

That said, I'm looking for the exact functionality described above: under the typical "blogs" menu item, I want links to all users who have blogs on the site.

That is:

blogs
username1
username2
username3
my blog
create content
etc.

I can readily _add_ such links from administer > menus by creatng a new entry under blogs and pointing it at blog/3 (or whichever uid I want), but I'd rather that be the _default_ behavior for the blogs menu.

Has anyone found a solution for this?

--MW

Dublin Drupaller’s picture

Hi MW,

you might find a ready-to-paste snippet in the php snippets handbook page

Simple step-by-step instructions on how to use them are given..

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

stevryn’s picture

I would like a simple list of the users who have blogs...not even in the menu..I cant seem to find a snippet for that, and its probably very simple to do...Instead of seeing the title and the teaser, etc etc, the page would be like:

BLOGS
- User 1
latest blog entry title
- User 2
latest blog entry title

And so on. That way people could go directly to the person they want and see the blog instead of that LONG list ....

stevryn’s picture

Try this, needs "prettying" up but it was what I needed!

http://drupal.org/node/7414

It shows you a list like this...

User name (which is clickable to their whole blog)
blog node title of latest post (which is clickable to the whole post)

Next User name
blog node title of latest post

etc etc.....

It was meant for a block, but I created a page with it to use instead of the default blogs page. I also modified it, changing it to other types of content for the same type of display by user...very handy