Hi everyone,

We have an intranet developped with drupal. We would like to have:

- A page automatically presenting all the users blogs
- A theme for users blog different (=Kubrick) from standard pages.

Any clue?

Denis

Comments

laura s’s picture

The first is www.yourdomain.com/blogs -- this will display in teaser format all of your recent blogs, paginated according to your settings. (If you want just a list of blogs, see the php snippets section of the handbook. Codes are there that you can paste into a node, sidebar block or front_page area.)

As for theme, there's a new contributed module that does this (I forget the title, but you can find it under "downloads"). Also, using phpTemplate, you can give just the blog nodes a different look (such as different colored links or background) by making a node-blog.tpl.php template file. There are other ways, such as placing a conditional at the top of your page.php.php that would direct blog posts to a different file (e.g., "blogpage.tpl.php").

A search on these topics will yield code and more, so you don't need to be a php wiz to do it.

===
Laura
pingV

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

sepeck’s picture

http://drupal.org/project/sections
Still in development.

-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

keithinstone’s picture

(If you want just a list of blogs, see the php snippets section of the handbook. Codes are there that you can paste into a node, sidebar block or front_page area.)

I looked thru the snippets - http://drupal.org/node/23220 and http://drupal.org/node/21867 - found several blog-related but did not find one that listed all blogs.

Please help me find it - or even point out the best starting point snippet to modify to list all blogs and/or all users.

Thanks.

Keith

jasonwhat’s picture

Yes this would be good to have. A hack could use global user function to display all user id's with the word "blog" before it in the url, but not all users have a blog. A blogroll of onsites blogs seems like a pretty necessary feature.

keithinstone’s picture

There is a blogroll module - http://drupal.org/project/blogroll - but I was thinking something much simpler - just a block that lists all users who have a blog, sorted alphabetically, for starters.

jasonwhat’s picture

This lets each users lists blogs or any links they like. I know you are talking about a blogroll for the site. I'm wondering how to do that as well. It seems like a simple and needed feature. Someone out there must know some code that accomplishes this.

venkat-rk’s picture

There is precisely such a block on www.ofbyandfor.org (look at the Bloggers block on the left), but I think it is a manually created menu.

Not sure if this is what you are looking for.

keithinstone’s picture

The Bloggers block at www.ofbyandfor.org is all that I was looking for. If I knew how to code my way out of a paper bag, I could come up with that custom code myself. I bet it is pretty simple. Alas, I can only borrow and hack. I will see if Zacker will share his snippet - or does someone else have it handy?

keithinstone’s picture

Here is some custom block code that appears to do the trick. Lists all accounts (alpha order) that have blog entries. Users without any blog entries are not shown. Each account in the list is a link to the blog for that user (and not a link to their user account).

<?php
$q = "SELECT DISTINCT(u.uid), u.name 
    FROM {users} u 
    INNER JOIN {node} n ON u.uid = n.uid 
    WHERE n.type = 'blog' AND n.status = 1
    ORDER BY name";
$result = db_query ($q);
while ( $account = db_fetch_object ( $result ) ) {
  $blogname = $account->name;
  $items[] = l($blogname, 'blog/'.$account->uid, array('title' => t("Go to the blog for $blogname.")));
}

print theme('user_list', $items);
?> 

Disclaimer: I am new to this, so I am sure this is not perfect code, but it seems to work for me. I bet there are some "access checks" and other good practices that are missing!

laura s’s picture

Why don't you add this to the php Snippets section of the handbook, where others can find it more easily?

(also, if you bracket your posts with ... instead of the < code > brackets, your php code will be color-themed for readability.)
===
Laura
pingV

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

keithinstone’s picture

I will post there - but since I am new to this, I would like someone who knows what they are doing to check it over first. I figured if I left the code sit here for a few days, somone would speak up if it was significantly wrong. If silence, then OK to post over there.

"You may post code ...<?php ... ?> (highlighted PHP) tags."

I see that in the formatting guidelines now, will do better next time, thanks.

laura s’s picture

The blog teaser display is www.yourdomain.com/blog (no 's').

===
Laura
pingV

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

frjo’s picture

For presenting blogs you can check out my modified version of site_map.module in my sandbox. The function that intrest you are "_site_map_blogs".

http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/frjo/

For special blog themes check out "Blog Theme" http://drupal.org/node/19248. A users blog will be presented with the theme that the user has chosen in his/her settings. I use it on my site and it works well.