Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

User blog system


Go to End


2 Posts   1378 Views

Avatar
Sam

Administrator, 690 Posts

27 April 2008 at 3:10pm

Someone was asking about developing a system where site users could have their own blogs. Rather than email them personally I thought it would be more useful to post here.

I would think that this could be built on top of the existing blog module; you would need to extend it in two ways:

1) Have some kind of facility for creating new blogs. This might be a registration form on the site, or your site administrator might just go into the CMS and do this manually.

The following actions would need to be performed:
- Create a BlogHolder Page - e.g. "Sam's Blog"
- Create a Group - e.g. "Sam's Blog Administrators"
- Add the relevant user to the "Sam's Blog Administrators" group
- In the access tab of the BlogHolder page, say that the "Sam's Blog Administrators" group is allowed to administer this page.

This multi-step process is a little unwieldy, so it would be better to write a script to do it. Ideally, you would build these scripts onto the blog model object themselves, rather than baking them into a specific controller. This will make it easier to re-use these scripts in other contexts.

$blog = new BlogHolder();
$blog->ParentID = XX;
$blog->write();
$blog->grantEditAccessTo(Member::currentUser());

2) Update the security checks on BlogManagementWidget class and BlogEntry::EditLink to perform a more sophisticated access check. You probably want to create a new permission code like "BLOG_EDIT", and check that the current user has that permission as well as having been given access to this specific blog.

Avatar
Blackdog

Community Member, 156 Posts

27 April 2008 at 3:24pm

It would probably be handy if Admin didn't have to setup a blog for user as it could create a lot of work for little reward.

Would be good if the user could activate the blog in their member profile.