Trying to write a plugin for 2.2.1 and it's a blank white page
Hi, I've recently upgraded my old, old, old Vanilla 1 site which had custom software for a family fantasy-like football league I run. I'm trying to rewrite it in the Vanilla 2 framework, and even with $Configuration['Debug'] = true in my config.php, the only thing that happens when I try to display something in my plugin is a blank white page.
I'm just starting with the absolute basics here, trying to put a hello world on screen at my plugin path. The Custom Pages plugin is no help because it appears to be broken as well.
Here's what my super minimal class.ffff.plugin.php file looks like (skipping the plugin registration bit):
class FFFFPlugin extends Gdn_Plugin {
public function __construct() {
parent::__construct();
}
public function base_render_before($Sender) {
if ($Sender->Menu && Gdn::session()->isValid()) {
$Sender->Menu->addLink('FFFF', '4F HQ', '/plugin/ffff');
}
}
public function pluginController_ffff_Create(&$Sender) {
die("here");
$Sender->render();
$this->dispatch($Sender, $Sender->RequestArgs);
}
}
The addLink works fine on the main page, but when I go to mysite.com/plugin/ffff, where, from all I've read, the pluginController function should kick in, I get nothing. Just empty page. No debug information of any kind. Each of those three lines is an attempt to display something, anything.
Can anyone give me some pointers on what might be going wrong? It's rather imperative I get this sorted out before football season starts. :P
edit: The ` code markup doesn't appear to work.
Comments
The registration bit can also be important, an error there can cause a blank page.
Try removing the ampersand
public function pluginController_ffff_Create($Sender) {
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Wow, the ampersand was it, thank you so much! I would not have gotten that for a while.
Yea that is no longer used in 2.2 Glad that solved it.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@saladyears
You might find this helpful so you can fix other plugins that may have become incompatible with 2.2 , most of the changes started with 2.1 so the tutorial is still relevant today.
https://vanillaforums.org/discussion/25534/how-to-modify-an-old-plugin-for-2-1
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌