Configuring multi-user blogging in drupal

I have configured the path to all blog entries published to be mysite/blog/[title-raw], from administer>site building>URL aliases>automated alias settings, concretely under” node path settings”-> Pattern for all Blog entry paths.” The path to each blog posters (each user with blog posting permissions) is defined as blog/[user-raw], under “pattern for blog page paths”. This sets the automatic paths, so that when creating content, if “automatic alias” is ticked drupal takes care of the established paths.

A new menu item under “primary links” with path “blog” allows to link to the blogs page from the main navigation menu.

In my case I wanted more control over what is displayed on the blog page, pretty much like my news page but outputting the picture of the blog entry author along the title of the blog entry, its teaser and a “read more” link to the node itself. This is achieved with a view, which displays in a page of path ´blog´ all content of type blog entries in a post date descending order. The “read more” link is a bit awkward but is achieved by outputting a node:link field with a blank label and a “Read more” string under “Text to display:”. The view also displays the name of the author of the blog entry, with a link to its corresponding own blog page, by using a replacement pattern of blog/[name] under “link path”.

I created a new user role called “blogger” with permissions to creating blog entries and editing only their own ones. Two new users fall into this category: Andrew and Stef.

With appropriate styling, now I can output the picture on the left hand side and the node teaser/title/etc. on the right, all within a border to separate each entry.

I also wanted to theme the comment count, to display a “No comments” string instead of the default “0 comment(s)”. This was done by overriding the view-view-field template, as suggested by devel module and theme:information in the view for the comment count field. I copied and pasted into my theme folder the view-view-field.tpl.php from the views module folder, and renamed it to “view-view-field–comment-count.tpl.php”, which automatically registers in drupal. The file contains php logic that allows to override the output in case that there is not comments yet, prompting the users to add their comment in a link instead of outputting an ugly “0 comments”.

The following link provided help: http://www.dailyillini.com/blogs/devblog/2009/01/29/using-views-templates-make-prettier-comment-counts

Advertisements

Posted on April 5, 2010, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: