Skip to main content
Topic: Adding Hooks!! (Read 930 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Adding Hooks!!

What's the general thought on adding or modifying hooks?  I'm looking at 1.1 and all the code edit mods I have to update and hoping new hooks would make it easier but not finding them.  First example I'm looking at right now is I add additional info in the function loadExistingMember which is called from action_login2.  Sure, I could hook onto the end of login2 except I actually check that information to make a yes/no decision on the login and doLogin would already be called. 

So a last hook before doLogin that would allow me to set a failure variable checked before doLogin was called as well as set $context['login_errors'] would be nice.

A lot of the other changes are still in Post and all the is_allowed type stuff.  I haven't checked, but have hooks been added to all those functions to modify their results?

Re: Adding Hooks!!

Reply #1
Hi @disputes and welcome to Elk.

Regarding the login, there is already:
* integrate_verify_user (that is probably the best place to check if you want a user to be logged in or not), and
* integrate_login (that is exactly at the beginning of doLogin, most likely the one you are looking for).

I'm all for way to extend the core without having to edit files, login is just one of the most... less straightforward parts of Elk, so I'm always a bit wary about touching it. lol
Bugs creator.
Features destroyer.
Template killer.

Re: Adding Hooks!!

Reply #2
Also we have the "generic" _before and _after hooks that get called via the dispatcher.  You can always turn on debug and then see the list off all hooks that were called to create a page.
Squish squish. squish, squish, squish.
Find a bug,
Make a wish.

 

Re: Adding Hooks!!

Reply #3
Yeah, the debugging functionality to see all hooks is really useful when writing mods.