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.
Using a Custom Event - plugin problem
Linc
Admin
So I added a custom event to the login function in class.usermodel.php:
Then I make a plugin (and enable it) that starts like this:
But nothing I put inside the function is firing at login. What am I doing wrong?
public function ValidateCredentials($Email = '', $ID = 0, $Password) {
$this->FireEvent('BeforeValidateCredentials');
Then I make a plugin (and enable it) that starts like this:
class VbulletinPassword implements Gdn_IPlugin {
public function UserModel_BeforeValidateCredentials_Handler(&$Sender) {
But nothing I put inside the function is firing at login. What am I doing wrong?
0
Comments
I changed my CallEventHandler function in class.pluginmanager.php to dump its calls to a raw text file (dirty I know!)...
Anyway, it appears that it'll try and call both:
gdn_usermodel_beforevalidatecredentials_handler base_beforevalidatecredentials_handler
So a function declared like:
public function Gdn_UserModel_BeforeValidateCredentials_Handler(&$Sender) { // ... }
Will get called... I'm not sure if this is expected functionality of having to include the Gdn_ prefix?
I found that when I tried to override the SearchModel I had to install it as two aliases, both Gdn_SearchModel and SearchModel as was used differently in different areas.
Hope this helps!
Cheers.
Ben
I've used mail() to debug so dumping to text file seems positively clean to me, haha.
I'm tempted to draft up a few bits to test various parts of the plugin architecture when I get a few minutes to spare. For instance I'm having to overwrite both SearchModel and Gdn_SearchModel in order to capture new items (posts/comments) from Vanilla, plus remain compatible with the search controller in garden as it gets called differently.