Jump to content

Pass Hook Result / Variable To Another Hook


willinit

Recommended Posts

I currently have a hook for ClientLogin that takes the userid value and pulls the corresponding e-mail address from the database.  What I'm trying to achieve next is to take that value and pass it to a javascript line in the Client Area page after successful login.  But from what I've read, the hooks have limited scopes in terms of creating a new template variable and creating a template variable wouldn't allow it to be access in a template file that doesn't correspond to ClientLogin.  Is it possible to take the returned value from the ClientLogin hook and pass it to another hook that (from my understanding) would have its own limited set of template files where the template variable would be accessible?

Link to comment
Share on other sites

12 hours ago, willinit said:

Is it possible to take the returned value from the ClientLogin hook and pass it to another hook that (from my understanding) would have its own limited set of template files where the template variable would be accessible?

I wouldn't have thought it necessary to pass a value from one hook to another - not least because once the user is logged in, then all the ClientAreaPage hooks will have access to the Smarty variables in that template via $vars... one of which will be $clientsdetails - so if you wanted to get the clients email address value in the hook...

$clientemail = $vars['clientsdetails']['email'];

there would be other ways to get it (e.g., you could get it via the class docs) - but if they're logged in, you shouldn't need to pull the value from another hook - or even query the database for it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated