HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Problem implementing /vanilla/views/discussion/discussion.php

R_JR_J Ex-FanboyMunich Admin

I've created a plugin and wanted to render a discussion with help of the standard discussion view. I'm using Vanilla 2.1, default theme and have disabled every plugin. But I always get only a part of the expected result.

This is the code I use:

public function PluginController_TestView_Create($Sender, $Args) {
  $DiscussionID = $Args[0];
  $DiscussionModel = new DiscussionModel();
  $Discussion = $DiscussionModel->GetID($DiscussionID);
  $Sender->SetData('Discussion', $Discussion);
  $Sender->Render($Sender->FetchViewLocation('discussion', 'Discussion', 'Vanilla'));

And that is the HTML I get in return

< div id="Discussion_2" class="Item ItemDiscussion">
   < div class="Discussion">
      < div class="Item-Header DiscussionHeader">
         < div class="AuthorWrap">
            < span class="Author">
               < a title="Moe" href="/forum/profile/4/Moe" class="PhotoWrap">< img src="http://wd.vanillicon.com/d355bc8c2ea95365ea9b23860e5ad39f_50.png" alt="Moe" class="ProfilePhoto ProfilePhotoMedium" />< /a>< a href="/forum/profile/4/Moe" class="Username">Moe< /a>

I've already tried DiscussionController instead of PluginController but that had no impact, the result has been the same.

Rendering seems to stop at echo FormatMeAction($Discussion); but I cannot find a reason for that. Does anyone has an idea what could be the problem here?


  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Tried to print out a comment:

          require_once $Sender->FetchViewLocation('helper_functions', 'Discussion', 'Vanilla');
          $CommentModel = new CommentModel();
          $Comment = $CommentModel->GetID($Args[0]);
          $Session = Gdn::Session();
          WriteComment($Comment, $this, $Session, 1);

    That was no problem at all...

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Solved my problem: FormatMeAction is defined in discussion helper_functions and I haven't included that before rendering discussion view. That's all...

Sign In or Register to comment.