HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Anyone wants to get things appear there and there real quick? Here is a dirty solution
vorapoap
New
This is not recommended for novice user (hack core) and well.. but I am Vanilla newbie. so if anyone want to pierce me here it is ok. I just want something to get the job done quickly.
- Open /library/core|class.pluggable.php
- Find "public function FireEvent($EventName)"
Replace the whole function with this code....
public function FireEvent($EventName) { if (!$this->ClassName) { $RealClassName = get_class($this); throw new Exception("Event fired from pluggable class '{$RealClassName}', but Gdn_Pluggable::__construct() was never called."); } if ($_GET['DEBUGEVENT']) echo $EventName.'<br>'; if (function_exists("On".$EventName)) { call_user_func("On".$EventName, $this, $this->ClassName, $EventName); } // Look to the PluginManager to see if there are related event handlers and call them return Gdn::PluginManager()->CallEventHandlers($this, $this->ClassName, $EventName); }
^^^ sorry for bad indentation, I am not get used to this [C] button
- Now open /index.php
- Find "require_once(PATH_ROOT.'/bootstrap.php');" (should be on line 41)
- Insert this code one line after
require_once(PATH_ROOT.'/x-viewlib.php');
- Of course x-viewlib.php can be any name. In this file you will declare any OnXXXXX where XXXXX is the EventName
For this example, I do something like this
<?php function OnAfterComment() { static $render = 0; if ($render) return; PrintAdsense(true); $render = 1; }
So you wonder how to find out the event name you want?
Get to your forum URL and add ?DEBUGEVENT=1 at the end of URL (must before hashtag symbol '#') for example
http://www.yourforum.com/activity?DEBUGEVENT=1
So here.. you find out immediately what function name to declare.
2
Comments
Or just install Eventi: http://vanillaforums.org/addon/eventi-plugin ;-)
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
this is reinventing the wheel
you would use
DiscussionController_AfterComment_Handler
or simply
Base_AfterComment_Handler
hooks
Pleas read the docs how to write plugins or themehooks.
grep is your friend.
@vorapoap
perhaps "pierced", but interesting and creative. thx for the idea. Keep the ideas coming, don't let a minor piercing stop you.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@vorapoap
I agree with peregrine, very creative
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@x00
To do that I will have to create a class and register as a plugin? I may have done that when things are more settled on my side. But well.. I was moving some code out of the default.master.php .. so trying to do it real quick without plugin.
It is hardly more complicated that what you are doing.
I recommend themehooks too.
Modding the core is not the way to go unless it is a pull request, or you are maintaining a fork, you want something that is update friendly.
grep is your friend.