This project is read-only.

Can Blog Module be Modified Easily?

Topics: Customizing Orchard, Writing modules
Mar 26, 2011 at 3:40 PM

Hi, I am just getting started with Orchard and want to create blog functionality that would give a blog to each user - they would be able to blog from their profile page, then the blog posts would appear with their profile but it would also appear on public pages like latest posts, etc.  Common stuff.  However, what is the best approach for me (remember just getting started with Orchard) - can the existing blog functionality be easily tweaked such that I can simply use that or should I build up the blog functionality from scratch (obviously cribbing from the existing code).  What is the best approach?


Mar 26, 2011 at 4:14 PM

The closest in the existing system is in the Users > Roles menu in the Dashboard, you can give permission to the "Authenticated" user to "Publish or unpublish own blog post". You can create a blog owned by that user, but I'm not sure if that would mean they can still post to any blog. The Blogs permissions perhaps need granularising a bit so there are "Publish to own blog" and "Publish to any blog" options.

To have it so a blog is automatically created for a user, or so they can create their own blog (but only 1 of) requires some modification. I was looking at doing a similar thing for a website I'm working on, but I'm not yet sure if it's required - I've looked into doing it but haven't started anything.

You could probably do either of these things by creating your own module rather than editing the existing blog module to avoid breakage as 1.1 approaches - although if you made a modification to Blogs itself you could try submitting it as a patch.

First you should play around with the existing blog and roles functionality to see what it does, and also the recent posts widget (which unfortunately will only display posts from one blog for each instance). I'm happy to point you in the direction of where to look for relevant code, but familiarise yourself with the system a bit first :)

There is also a Profiles module available which will give each user a profile page that will go part way to what you need.

Mar 26, 2011 at 4:22 PM

Thanks!  This is the exact type of info I was looking for - some guidance to point me in the right direction.  I'll take a look at your suggestions and see where it gets me.

Mar 26, 2011 at 9:54 PM

You should be able to reproduce some of what the blog module does to the blog and blogpost contents. Go through the ContentManager as much as possible.