Skip to main content
Temporary hooks listing/documentation Started by emanuele · · Read 76020 times 0 Members and 2 Guests are viewing this topic. previous topic - next topic

Re: Temporary hooks listing/documentation

Reply #45

Sorry, but yesterday I missed this topic because I was so sleepy I fell asleep in front of the computer... xD
Can you remind me if you are using 1.0 or 1.1?

Being the subaction an admin sub-action, it will probably look by default in ADMINDIR, so the controller in CONTROLLERDIR is overlooked.
Probably the require once is the only way, unless you define a namespace and a custom auto-loading path (to the addon dir, for example).

All off the top of my head and without checking (and while looking at a script running on the other computer).
Bugs creator.
Features destroyer.
Template killer.

Re: Temporary hooks listing/documentation

Reply #46

Quote from: emanuele – Can you remind me if you are using 1.0 or 1.1?
Both but let's say 1.1.

Anyway, the problem is I don't understand how to do this without a source mod. It's very simple with one:

Code: [Select]
		// Are we performing a check or report?
if ($this->_req->post->maction == 'spammers_check' || $this->_req->post->maction == 'spammers_report')
{
require_once(SOURCEDIR .'/addons/StopSpammer/StopSpammer.php');
checkreportMembers($members, $this->_req->post->maction == 'spammers_report');
}
I add that above "Are we performing a delete?" in ManageMembers.controller.php and it works.

Ideally of course I'd do it without a source mod, but I can't quite wrap my head around how I'd parse the form or anything with one of those controllers. Anyway, I'm ignoring the problem for now. A couple of minimal source mods is a lot better than the almost entirely source-mod-based approach that was required in SMF. :)

Re: Temporary hooks listing/documentation

Reply #47

If you added a new button, it's likely maction is "overwritten" by the select box, try using another name for the button, stopspam.
Bugs creator.
Features destroyer.
Template killer.

Re: Temporary hooks listing/documentation

Reply #48

Actually that's not a problem. All you need is something like this:

Code: [Select]
<input type="hidden" id="stop_spammer_maction_on_members">
<button name="maction" value="spammers_check" type="submit" onclick="$(\'#stop_spammer_maction_on_members\').attr(\'name\',\'maction_on_members\').attr(\'value\',true);">checkcheck</button>

My problem is entirely with the controller. It just doesn't seem to fire unless I perform one of the built-in actions. But anyway, like I said I'll fix up my stuff first so it's working (nearly there) and I'll worry about doing it right later. :)