DiscussionPolls PHP error on 2.0.18.10
I added and activated DiscussionPolls 1.2.3 on Vanilla 2.0.18.10 and received this error when I click on Start a new Discussion or when I click on Attach Poll on an existing discussion:
Fatal Error in DiscussionPolls.PostController_DiscussionFormOptions_Handler();
Undefined property: PostController::$Discussion
The error occurred on or near: /var/www/forums/plugins/DiscussionPolls/class.discussionpolls.plugin.php
268: // render check box
269: $Sender->EventArguments['Options'] .= '<li>' . $Sender->Form->CheckBox('DP_Attach', T('Attach Poll'), array('value' => '1', 'checked' => TRUE)) . '</li>';
270:
271: // Load up existing poll data
272: if($Sender->Discussion->DiscussionID != NULL) {
273: $DPModel = new DiscussionPollsModel();
274: $DiscussionPoll = $DPModel->GetByDiscussionID($Sender->Discussion->DiscussionID);
275: }
276:
.....
Additional information for support personnel:
Application: Vanilla
Application Version: 2.0.18.10
PHP Version: 5.3.3
Operating System: Linux
Server Software: Apache/2.2.15 (CentOS)
Referer: http://forums.crushlivepoker.com/categories/your-feedback
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14
Request Uri: /post/discussion/7
Controller: DiscussionPolls
Method: PostController_DiscussionFormOptions_Handler
0
Comments
Backtrace:
[/var/www/forums/plugins/DiscussionPolls/class.discussionpolls.plugin.php:272] PHP::Gdn_ErrorHandler();
[/var/www/forums/library/core/class.pluginmanager.php:648] DiscussionPolls->PostController_DiscussionFormOptions_Handler();
[/var/www/forums/library/core/class.pluginmanager.php:590] Gdn_PluginManager->CallEventHandler();
[/var/www/forums/library/core/class.pluggable.php:127] Gdn_PluginManager->CallEventHandlers();
[/var/www/forums/applications/vanilla/views/post/discussion.php:44] Gdn_Pluggable->FireEvent();
[/var/www/forums/library/core/class.controller.php:659] PHP::include();
[/var/www/forums/library/core/class.controller.php:1073] Gdn_Controller->FetchView();
[/var/www/forums/library/core/class.pluggable.php:193] Gdn_Controller->xRender();
[/var/www/forums/applications/vanilla/controllers/class.postcontroller.php:225] Gdn_Pluggable->__call();
[/var/www/forums/applications/vanilla/controllers/class.postcontroller.php:225] PostController->Render();
[/var/www/forums/applications/vanilla/controllers/class.postcontroller.php:225] PostController->Discussion();
[/var/www/forums/library/core/class.dispatcher.php:322] PHP::call_user_func_array();
[/var/www/forums/index.php:53] Gdn_Dispatcher->Dispatch();
This needs to be reported on the github page
https://github.com/hgtonight/DiscussionPolls/issues
The solution should be something like
if(GetValueR('Discussion.DiscussionID',$Sender)) { ...instead of
if($Sender->Discussion->DiscussionID != NULL) { ...Thanks for the heads up, I just updated the github version with @x00's fix. Could you (@khalwat) test it out and let me know if that fixes your issue?
https://github.com/hgtonight/Plugin-DiscussionPolls