Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Blog and Forum module integration

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

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

Page: 1
Go to End
Author Topic: 1661 Views
  • jorne
    Community Member
    4 Posts

    Blog and Forum module integration Link to this post

    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.

  • Willr
    Forum Moderator
    5511 Posts

    Re: Blog and Forum module integration Link to this post

    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 %>
    <% 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 %>
    <% end_control %>

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

  • jorne
    Community Member
    4 Posts

    Re: Blog and Forum module integration Link to this post

    Thank you so much for this information!!

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.