Jump to content

hook point for custom pages


Qalekhani

Recommended Posts

Hi

According to this documentation (https://developers.whmcs.com/themes/php/), each WHMCS page has a hook point that allows us to defined template variables.

How about custom pages? I can't find hook point for these pages in the hook index: https://developers.whmcs.com/hooks/hook-index/

I want to write a hook to retrieve promotion codes from tblpromotions and show them on custom page.

Link to comment
Share on other sites

If you are creating a custom page, why do you need a hook?
Why don't you simply get the promotions data you need directly from the code of the custom page?

Otherwise you can use the ClientAreaPage hook and check if the current page is the one you want, but I think there's no need fot that in a custom page.

Link to comment
Share on other sites

10 hours ago, egrueda said:

If you are creating a custom page, why do you need a hook?
Why don't you simply get the promotions data you need directly from the code of the custom page?

Otherwise you can use the ClientAreaPage hook and check if the current page is the one you want, but I think there's no need fot that in a custom page.

Hi

Thank you @egrueda

I think I am really noob. Would you please describe how to interact with database tables in custom pages? I'm not that expert in Laravel and its syntax.

Link to comment
Share on other sites

You cau use this sample as starting point:

https://developers.whmcs.com/advanced/creating-pages/

See how it interacts with table tblclients:

$clientName = Capsule::table('tblclients')
	->where('id', '=', $ca->getUserID())->pluck('firstname');

And how it assigns values to template variables:

$ca->assign('clientname', $clientName);

Just use the table you need

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