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.
Options

Saving Settings In Dashboard Throws Error; Permalink Issues - Vanilla v2.1a

edited March 2012 in Vanilla 2.0 - 2.8

Vanilla Version: 2.1a10p1
Theme: Bitter Sweet (comes pre-loaded with Vanilla 2.1)
My Forum: Link

ISSUE-1: When I save 'Banner' and 'Registration' settings in my Vanilla forum Dashboard, the page goes blank with this error (or at least something similar - - line number changes):

Fatal error: Call to undefined method Gdn_ConfigurationModel::FilterForm() in /home/xxxx/public_html/pages/library/core/class.form.php on line 1754

I haven't checked saving other settings - - but I am sure some will show errors like this.

ISSUE-2: The permalink to the most recent post in a category on the categories page is broken, but is fine elsewhere.

Every category's meta on the Categories index has this -- 'Most recent: POST TITLE HERE' -- right? The link to the post is broken (I mean, the URLs aren't pretty).

For example, it's like this:
example.com/discussion/1/Nerd%20Pages%20%E2%80%93%20How%20To's And Docs Test Page

When it's like this elsehere:
example.com/discussion/1/nerd-pages-how-tos-and-docs-test-page#Item_1

ISSUE-3: I have this in my config.php file:

$Configuration['Vanilla']['Comments']['AutoOffset'] = FALSE;

But the URLs to my discussions are still like this:
example.com/discussion/1/nerd-pages-how-tos-and-docs-test-page#Item_1

Best Answer

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    I've fixed that bug on the master branch. You can see the fix is:

    $Data = $this->FormValues();
    if (method_exists($this->_Model, 'FilterForm'))
        $Data = $this->_Model->FilterForm($this->FormValues());
    

Answers

  • Options

    oh boy... ok, I'll see if I can answer Issue 1 first...

    Call to undefined method Gdn_ConfigurationModel::FilterForm()

    What you need to do is find the configuration model. I don't know version 2.1 that well, but I can imagine it's in the libraries folder or in the 'models' folder of the Vanilla 2.1 installation.

    As soon as you've found the exact Gdn_ConfigurationModel class, figure out if there is a function called 'FilterForm' it might be something like 'FilterForms' or like 'Filter' (can't imagine why, but ok...). Then it is a typo in the public_html/pages/library/core/class.form.php file.

    In other cases open the file public_html/pages/library/core/class.form.php and see what kind of code is there on and around line 1754 (5 lines above, 5 lines under line 1754). Try to figure out what the 'logic' of the code is.

    There was an error rendering this rich post.

  • Options
    edited March 2012

    Thanks for chipping in,

    This is line 1754: $Data = $this->_Model->FilterForm($this->FormValues());

    I compared the 'class.form.php' in v2.1a with the one in the current stable release v2.0.18.4. I was able to fix it by copying over the changed code. ($Data is short for something, so that 'something'.)

    But this is not a long term solution. This is beyond any logic to me as I don't know PHP at all. But I am still trying to figure it out.

    EDIT: I tried changing 'FilterForm' to 'FilterForms'. That did not work. :(

    EDIT-2: This function (or whatever you call it):

    $Data = $this->_Model->FilterForm($this->FormValues());
    

    Is related to this line in the same file:

             $SaveResult = $this->_Model->Save($Data, $Args[0], $Args[1],
                $Args[2], $Args[3], $Args[4], $Args[5], $Args[6], $Args[7],
                $Args[8], $Args[9]);
    
  • Options
    edited March 2012

    I had no way, but to fix it like this...

    In '/vanilla-root/library/core/class.form.php'

    Remove this line

             $Data = $this->_Model->FilterForm($this->FormValues());
    

    In about line 1768, change this:

             $SaveResult = $this->_Model->Save($Data, $Args[0], $Args[1],
    

    to this:

             $SaveResult = $this->_Model->Save($this->FormValues(), $Args[0], $Args[1],
    

    @Todd : I really want to bring this to your notice (please read the first post in this topic - - all the issues are there). Also, please do let me know if it's best to report these on GitHub (Issues).

    Hope you can fix it the better way!

  • Options
    ToddTodd Chief Product Officer Vanilla Staff

    Please keep in mind that you are using an alpha version of Vanilla. There are going to be a lot of bugs in it. This code is bleeding, bleeding edge.

    You can feel free to report them on github, but definitely not on here.

  • Options
    edited March 2012

    @Todd : Now, what do you think about my fix? Is it okay? I made those changes by referring to class.form.php in the current stable release.

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    I've fixed that bug on the master branch. You can see the fix is:

    $Data = $this->FormValues();
    if (method_exists($this->_Model, 'FilterForm'))
        $Data = $this->_Model->FilterForm($this->FormValues());
    
  • Options
    edited March 2012

    Thanks! I hope the other two issues will be fixed soon. And by the way, I'm loving Vanilla Forums v2.1a better. :-)

Sign In or Register to comment.