Qalekhani Posted October 21, 2018 Share Posted October 21, 2018 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. 0 Quote Link to comment Share on other sites More sharing options...
Eduardo G. Posted October 21, 2018 Share Posted October 21, 2018 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. 2 Quote Link to comment Share on other sites More sharing options...
Qalekhani Posted October 21, 2018 Author Share Posted October 21, 2018 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. 0 Quote Link to comment Share on other sites More sharing options...
Eduardo G. Posted October 22, 2018 Share Posted October 22, 2018 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 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 22, 2018 Share Posted October 22, 2018 just one minor tweak to what @egrueda says, though is mentioned in the docs link that he gave, but if you're using v7 (which I assume you are), it would use 'value' rather than 'pluck'... $clientName = Capsule::table('tblclients')->where('id',$ca->getUserID())->value('firstname'); 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.