Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Vanilla 2.1 blank page after accepting an answer

CristinaCristina New
edited May 2014 in Vanilla 2.0 - 2.8

When i eneble Q&A plugin for vanilla 2.1 it working fine.

****** But when i accept a answer, the whole discussion page disappear and only display empty page.

what is the wrong. please help. Thanx

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Hi there!

    Please enable debugging by adding $Configuration['Debug'] = TRUE; to your /conf/config.php file. Once that is done, visit the blank page and report back with the new error.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Thanx for the comment.. this is the error :(

    Fatal error: Invalid opcode 153/1/8. in *******/plugins/QnA/class.qna.plugin.php on line 415

  • your problem may be with eaccelerator and anonymous functions.

    in any event whatever the matter - you need to change the anonymous function.

    around line 415

    try changing this  -   I haven't test it though.
    
    $Comments = array_filter($Comments, function($Row) {
                return strcasecmp(GetValue('QnA', $Row), 'accepted');
             });
    
    
    to this:
    
    
            $AcceptRow = strcasecmp(GetValue('QnA', $Row), 'accepted');
           $Comments = array_filter($Comments, $AcceptRow);
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • oh my god. its working. Thanx @peregrine

  • peregrineperegrine MVP
    edited June 2014

    @Cristina said:
    oh my god. its working. Thanx peregrine

    yes but it may have broke something else.
    http://vanillaforums.org/discussion/27014/when-i-aprove-an-answer-other-answers-hidden-and-only-display-approved-answer#latest

    DON'T do the change above you could this.

    instead around line 410

    your code would look like this with CHANGES.

    what it will do is allow you to run the QNA because anonymous functions won't work in your setup
    so the code below comments out all the comment filtering.

    and it displays the best answers at the top,

    and it shows ALL the answers (rejected and accepted, etc) in chronological sequence.

    To me this is the best of both worlds.

    • Best answers at top and
    • all answers in chronological order,
    • there is some duplication of answers but it is easier to see the answer process with all answers in chronological order.

    This is my LAST attempt at messing with the QNA, but I wanted to get you out of a jam that I caused for you in the previous untested attempt above.

    If this solution is not satisfactory, you can seek help from others (not me).

          $Sender->SetData('Answers', $Answers);
    /*
          // Remove the accepted answers from the comments.
          if (isset($Sender->Data['Comments'])) {
             $Comments = $Sender->Data['Comments']->Result();
             $Comments = array_filter($Comments, function($Row) {
                return strcasecmp(GetValue('QnA', $Row), 'accepted');
             });
             $Sender->Data['Comments'] = new Gdn_DataSet(array_values($Comments));
          }
     */
      }
    
       /**
        * Write the accept/reject buttons.
        * @staticvar null $DiscussionModel
        * @staticvar boolean $InformMessage
        * @param type $Sender
        * @param type $Args
        * @return type
        */
       public function DiscussionController_AfterCommentBody_Handler($Sender, $Args) {
    

    cut and paste carefully and make sure your brackets are correct.

    I did test these changes and it works for me.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • My Problem is not solve yet. please help me ???

  • anyone ??

  • peregrineperegrine MVP
    edited June 2014

    disable exaccelerator if you have it and upgrade to php version 5.3 or higher

    OR


    follow the instructions in

    http://vanillaforums.org/discussion/comment/209192/#Comment_209192

    around line 415 or so. /plugins/QnA/class.qna.plugin.php

    you need to comment out entire routine either use /* */ to comment entire block or

    // if (isset($Sender->Data['Comments'])) {
    //$Comments = $Sender->Data['Comments']->Result();
    //$Comments = array_filter($Comments, function($Row) {
    //return strcasecmp(GetValue('QnA', $Row), 'accepted');
    //});
    //$Sender->Data['Comments'] = new Gdn_DataSet(array_values($Comments));
    // }
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.