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.

"HowTo: Vanilla Page" and Vanilla 2.3

Using @R_J 's very approachable plugin to learn the ins and outs of Vanilla. But when clicking on a discussion in order to view it I get Fatal Error in DiscussionController.__get();.

It's a brand new, clean install of v2.3 with no other plugins enabled. The plugin code has not been edited. Using the +Baseline theme.

I've tried cleaning the cache to no avail.
I've tried using xdebug to trace the execution but don't (yet) understand Vanilla enough to have that be very effective.

The plugin adds a menu item as designed and the "extra" page displays and works just fine.

The error reason displayed is ** DiscussionController->masterView not found** which makes no sense to me as DiscussionController extends VanillaController, which extends Gdn_Controller. Gdn_Controller clearly has a masterView method.

So, what am I missing here that my lack of understanding about Vanilla keeps hidden from me? Is it possible that the plugin is not compatible with v2.3?

Here's a grab of the error screen.

Tagged:

Comments

  • R_JR_J Admin

    @TheRider said:
    The error reason displayed is ** DiscussionController->masterView not found** which makes no sense to me as DiscussionController extends VanillaController, which extends Gdn_Controller. Gdn_Controller clearly has a masterView method.

    It has a masterView() method, but I tried to use a property... :(

    @TheRider said:
    Is it possible that the plugin is not compatible with v2.3?

    Looking at it, I think there are some ugly errors in ther which might make it possible that it never really worked at all. But I fixed them right now and can promise that the current version will run even with 2.4!

    The new version is already on GitHub, I'll upload it here in a minute...

  • R_JR_J Admin

    By the way: I've changed the spelling of the folder (from HowTo... to howTo...). So basically it would be better to deactivate the old one, delete it, upload the new on, enable it.

  • R_JR_J Admin

    Oh, I've messed something up! Your discussion isn't attached to the plugin anymore and I can't fix it... :(

  • I learned about the folder rename when the view could not be found. =)

    After all the disabling, deleting, re-uploading and enabling it seems to work well except, as you mentioned, for the missing **Categories ** box. The rest of the panel is there. If you find a fix let me know.

    I truly appreciate your time in updating the plugin. Your "HowTo" plugins have given me a lot of insight. Thanks.

  • @R_J said:
    It has a masterView() method, but I tried to use a property... :(

    While debugging I probably looked at that line 50 times and didn't notice the property call either. O.o

    Good job catching it so quickly.

  • R_JR_J Admin

    I do not remember having mentioned anything categories related. If it was in the plugin: I wrote it two years ago =)

    But I assume the categories box like it could be seen here on the left is missing? I tell you how you can add it:

    Do a right click on the box and inspect it with your web inspector tools (do it!). You will see that it has a class "BoxCategories". Now do a full text search in your Vanilla folder for "BoxCategories".
    You will find it in "/applications/vanilla/views/modules/categories.php". Now, guess the name of the module! It could be found in "/applications/vanilla/modules". I leave it up to you to find it's name.

    Remember that peice of code in my plugin?

            // There is a list of which modules to add to the panel for a standard
            // Vanilla page. We will add all of them, just to be sure our new page
            // looks familiar to the users.
            foreach (c('Modules.Vanilla.Panel') as $module) {
                // We have to exclude the MeModule here, because it is already added
                // by the template and it would appear twice otherwise.
                if ($module != 'MeModule') {
                    $sender->addModule($module);
                }
            }
    

    I wouldn't do it that way again. There should never be a function call inside the foreach condition. I would do it that way today:

    // Get all modules which are most likely to be shown and
    // remove the MeModule because it shouldn't be displayed twice.
    $modules = array_diff(
        c('Modules.Vanilla.Panel', []), // first get all modules
        ['MeModule'] // then strip the MeModule
    );
    
    // Append whatever module...
    $modules[] = 'WhateverModule';
    
    // Attach all modules.
    foreach ($modules as $module) {
        $sender->addModule($module);
    }
    
  • R_JR_J Admin

    Oh and if you are unsure which modules you would like to see, simply take a look a t which modules Vanilla adds. You can always add your modules one by one and don't need to do that in a foreach loop:

    https://github.com/vanilla/vanilla/blob/release/2.3/applications/vanilla/controllers/class.discussionscontroller.php#L113-L117

  • TheRiderTheRider New
    edited April 2017

    While you were making the last two posts I was in the process of exploring those very modules. Your latest posts have been a big help in understanding what I'm looking at. Between yours posts, the documentation, and your howto plugins I'm starting to have a vague idea of how the pieces fit together. The bottom of the learning curve is a hard place to be.

    Thanks for sharing your knowledge base!

Sign In or Register to comment.