Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Integrating Vanilla with news manager

edited November 2006 in Vanilla 1.0 Help
Hi,
I don't know whether this sort of question has been asked before, but my search criteria didn't match anything intresting for me.

On my website I use PHP News (http://newsphp.sourceforge.net/ - it's under GPL, so it's not spam) for managing my news, but I would like the comments to rather go into the Vanilla forum, instead than being listed on the news page. I would like therefore to have a link like "Post Comment" that redirects to a new discussion in the forum, its title being the title of the news, so that all the comments are arranged by news title.

I have little familiarity with PHP, so do you think it would be possible to achieve that? And if so, is there anyone that can point me to a solution?

Thanks very much for your time.

Comments

  • edited October 2006
    See this thread http://lussumo.com/community/discussion/4003/really-need-this-to-be-done-help-me/#Item_11 and this one http://lussumo.com/community/discussion/2968/rssatom-to-thread-creation-extension-fundraising-campaign-started/#Item_45
  • Thanks for your quick reply!
    To be honest I was thinking it would have been a quick and simple answer from some guru...
    I actually have seen something very similar to what I need on the Jamendo (www.jamendo.com - under Creative Commons, so not spam) forums, which uses Vanilla as well. When you want to post a comment on somebody else's review of one album, it sends you to the forum with a thread called "Reply to the review of ".
    Maybe I should ask info to the Jamendo team... who know, they might be kind enough...
  • let us know what you find. I know a lot of people would love somehthing like this.
  • The guy of jamendo.com forgot to put the links to lussumo and forgot to contribute to the community. I am sure the ajax login and registration form would be a nice extension.
  • Wow... Jamendo... wouldn't even have known that was Vanilla. Awesome integration.

    I was thinking you might have some luck with the add comments extension--just hard code some of the variables and place it in your article. Could be wrong though.
  • Anyone else notice that Jamendo begins with a J...?
  • Oh wait sorry the big secret begins with an F doesnt it. Damnit.
  • I've just posted my request in the Jamendo forum:
    Hi,
    I've noticed how well this Vanilla forum was integrated with the website, and I was particularly impressed by the integration of reviews with the forum.

    I would like to ask a question to the person (or the people) who has (have) done such a great job. I and the people at Vanilla would really appreciate if you could help us to do the same: integrating news' comments with the forum, so that when somebody posts a comment to a news item, s/he would be redirected to the forum. I'm not asking for instruction, but just: how did you manage to integrate the news with the forum?

    Any input will be appreciated by me and the numerous people at Vanilla.

    Thank you very much for your time!
    I hope everything is clear and convincing enough...
    Just have to wait now...
  • edited November 2006
    Yeah!
    People at Jamendo are wonderful! I've got a useful reply. I invite you to take part in the discussion and help me out, please, since I'm not very good at PHP.

    Here is the reply:

    Hi!

    I'm the man :p

    I made a series of patches to Vanilla... the hardest one was to make it really multi-language. It's a bit of a hack so I'm not really happy with it ;)

    The patch for the news/reviews is simple, I have one forum for each artist and I automatically open a topic in the forum when there is a reply to a review. I have a function that creates the topic :

    (all the VH_Kernel stuff is linked to jamendo's framework)


    function PostMessage($user,$title,$msg,$categid,$replyto=0,$format='Text',$time=0) {

    global $VH_Kernel;


    $this->Context->Configuration['DISCUSSION_POST_THRESHOLD'] = '9999999';
    $this->Context->Configuration['COMMENT_POST_THRESHOLD'] = '9999999';

    //oops ! todo
    $this->Context->Session->UserID=$user;


    $this->Context->Session->User->CountDiscussions=0;
    $this->Context->Session->User->CountComments=0;

    $this->Comment = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Comment');
    $this->Discussion = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Discussion');

    $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'CommentManager');
    $dm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'DiscussionManager');

    //Todo call delegates!


    // If saving a discussion
    if ($replyto==0) {
    $this->Discussion->Clear();



    $this->Discussion->DiscussionID = 0;
    $this->Discussion->CategoryID = $categid;
    $this->Discussion->Name = $title;
    $this->Discussion->UserDiscussionCount = 1;
    $this->Discussion->WhisperUsername = '';

    // Load the comment

    $this->Comment->Clear();
    $this->Comment->UserCommentCount = 1;
    $this->Comment->CommentID = 0;
    $this->Comment->DiscussionID = 0;
    $this->Comment->FormatType = $format;
    if (!in_array($this->Comment->FormatType, $this->Context->Configuration['FORMAT_TYPES'])) $this->Comment->FormatType = $this->Context->Configuration['DEFAULT_FORMAT_TYPE'];
    $this->Comment->Body = $msg;
    // ?$this->UserCommentCount = ForceIncomingInt('UserCommentCount', 0);
    $this->Comment->AuthUserID = $user;
    $this->Comment->WhisperUsername = '';

    $this->Discussion->Comment =& $this->Comment;



    $ResultDiscussion = $dm->SaveDiscussion($this->Discussion);

    if ($ResultDiscussion) {

    if ($time>0) {
    $VH_Kernel->db->query("UPDATE jamendo_punbb.LUM_Discussion_".$VH_Kernel->i18n->getLang()." SET DateCreated=?,DateLastActive=? WHERE DiscussionID=?",array(date("Y-m-d H:i:s",$time),date("Y-m-d H:i:s",$time),$dm->lastPostedDiscussionID));
    $VH_Kernel->db->query("UPDATE jamendo_punbb.LUM_Comment_".$VH_Kernel->i18n->getLang()." SET DateCreated=? WHERE DiscussionID=?",array(date("Y-m-d H:i:s",$time),$dm->lastPostedDiscussionID));
    }


    return array($dm->lastPostedDiscussionID,0);
    } else {
    return false;
    }


    // If saving a comment
    } else {

    $this->Comment->Clear();
    $this->Comment->CommentID = 0;
    $this->Comment->DiscussionID = $replyto;

    $this->Comment->FormatType = $format;
    if (!in_array($this->Comment->FormatType, $this->Context->Configuration['FORMAT_TYPES'])) $this->Comment->FormatType = $this->Context->Configuration['DEFAULT_FORMAT_TYPE'];
    $this->Comment->Body = $msg;
    $this->Comment->UserCommentCount = 1;
    $this->Comment->AuthUserID = $user;
    $this->Comment->WhisperUsername = '';


    $ResultComment = $cm->SaveComment($this->Comment);

    if ($ResultComment) {

    if ($time>0) {

    $VH_Kernel->db->query("UPDATE jamendo_punbb.LUM_Comment_".$VH_Kernel->i18n->getLang()." SET DateCreated=? WHERE CommentID=?",array(date("Y-m-d H:i:s",$time),$cm->lastPostedCommentID));
    $VH_Kernel->db->query("UPDATE jamendo_punbb.LUM_Discussion_".$VH_Kernel->i18n->getLang()." SET DateLastActive=? WHERE DiscussionID=?",array(date("Y-m-d H:i:s",$time),$replyto));
    }


    return array($replyto,$cm->lastPostedCommentID);
    } else {
    return false;
    }

    }

    }


    After creating the topic I just update my reviews table to keep track of the DiscussionID of the replies, so that I can count the replies with a query in vanillia's db.

    That's it I guess, feel free to ask more :) I had a great time integrating Vanilla. We were using punBB before and the codebase wasn't written so well :)

    cheers
    Hope this helps, please let me hear from you!
  • He sounds like a handy guy to have around the community... I hope all that code helps someone out though.
  • Ehm... where is everybody now? Now that we've got something to work on, everybody's gone... too bad...
  • StashStash
    edited November 2006
    That PHP means NOTHING to me, but it looks good :D

    Which PHP guru here could hack this into an Extension to work with various other things (like PHPNews for example)?

    BTW, that ajax login looks like the standard people login using thickbox...

    Edit: Yarrrrrrr, see here:<a href='http://www.jamendo.com/en/?p=login' class='thickbox'>Please login!</a>
This discussion has been closed.