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.
Custom plugin not firing on production server, but works on local??
pavsid
New
Hi all, just upgraded from 2.3 to 2.6, and everything is working fine on localhost. However, now that i've put it all live, the only thing that doesn't appear to be working is a custom plugin that I built a while back (it works fine on localhost still though).
I've put some debug code in each of the files, and nothing is firing at all.
It is enabled in the config file btw
Any ideas why?
Here is the plugin...
/ ActivityStream / views / activitystream.php / class.activitystreammodule.php / default.php
This is default.php..
// Define the plugin: $PluginInfo['ActivityStream'] = array( 'Name' => 'ActivityStream', 'Description' => "Display the ActivityStream.", 'Version' => '1.0' ); class ActivityStreamPlugin extends Gdn_Plugin { public function base_Render_Before(&$Sender) { if(!in_array(strtolower($Sender->ControllerName), [ 'messagescontroller', 'discussioncontroller', 'bestcontroller', 'categoriescontroller', 'discussionscontroller', 'profilecontroller', 'activitycontroller' ])) { //return; // I have commented this out for debug, but still not working }; require_once(PATH_PLUGINS.DS.'ActivityStream'.DS.'class.activitystreammodule.php'); $activityStreamModule = new ActivityStreamModule(); $Sender->addModule($activityStreamModule); } }
This is class.activitystreammodule.php
class ActivityStreamModule extends Gdn_Module { public function assetTarget() { return 'Panel'; } public function toString() { // Get activity stream via XHR $View = Gdn::controller()->fetchView('activitystream', '', 'plugins/ActivityStream'); return (string)$View; } }
This is activitystream.php
<script type="text/javascript"> $(function () { $.get('/xhr/activitystream', function (response) { if(response.html) { $('.activity-stream-placeholder').html(response.html); } }) }) </script> <div class="activity-stream-placeholder"></div>
0
Comments
At first side I see this
public function base_Render_Before(&$Sender)
: you have to remove the ampersand "&"This line
require_once(PATH_PLUGINS.DS.'ActivityStream'.DS.'class.activitystreammodule.php
shouldn't be needed at all.Delete it (or uncomment it) and delete /cache/addon.php
After making those two changes, that plugin should work, I'd say
And....you are absolutely correct
Many thanks