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

Blog and Forum module integration


Go to End


3 Posts   2194 Views

Avatar
jorne

Community Member, 4 Posts

2 September 2008 at 7:41pm

Edited: 02/09/2008 7:42pm

This is my first post in this Forum.

I have been playing around with Silver Stripe and I really like this CMS but I have some questions.

1. I want to be able to have the members who sign up in the forum module to be able to comment in the Blog module as members.

2. I want to integrate Avatars in the comments and that the Avantar links back to their profile in the forum.

3. I want to be able to list Comments as well as Forum posts in the forum profile and be able to link back to the relevant post.

I been spending quite some time searching the forum for answers for question number 1 above. Maybe this is already implemented in Silverstripe but I can't figure out how to activate it?

Anyway I looking forward to a reply. It should be great if I could use SilverStripe for my project and I'm prepared to spend some time hacking it, and contribute with code.

Avatar
Willr

Forum Moderator, 5523 Posts

2 September 2008 at 10:26pm

Hi Jorne and welcome to the forum!

Everything you list there is very much doable in SilverStripe with a bit of tweaking!.

1) For example we did forum member / commenting syncing for a recent site - http://www.californiawomen.org/ - Only members of the forum could use comments so you can add this to your _config.php file - PageComment::set_comments_require_login(true); which will show a login button before they could post or there name prefilled if logged in.

2) Avatars in the comment I havent done before. But the 2 key files while editing comments are PageComment.php and PageCommentInterface.php in cms/code/sitefeatures/ and the templates (.ss files with the same names in cms/templates/) for the Avatar you could copy cms/templates/PageComment_singlecomment.ss to your themes templates directory (so your changes dont get lost when you upgrade and you can add this to it

<% if Author %>
$Avatar
<% end_if %>
I think that should get the authors avatar.

3) Again, I dont know your programming esp but its just 1 SQL query to get the latest comments. Eg define this method on forum/code/ForumMemberProfile.php in the ForumMemberProfile_Controller

function LatestComments() {
$member = Member::currentUser();
if(!$member) return false;
$comments = DataObject::get("PageComment", "AuthorID = '$member->ID'","Created DESC","",10);
return $comments;

Then in the template (ForumMemberProfile_show.ss) you can do

<% control LatestComments %>
$Comment
<% end_control %>

Which will output all the posts from our LatestComments method we defined in the step before

Avatar
jorne

Community Member, 4 Posts

2 September 2008 at 11:11pm

Thank you so much for this information!!