yeoman Posted December 19, 2017 Share Posted December 19, 2017 Hi, I'm very new to WHMCS and working email module, I'm trying to edit sidebar but SetURI won't accept any variable or direct $params. let me show you the code below $AccountURL = '/clientarea.php?action=productdetails&id='.$params["serviceid"].'&xeront=custom&page=mailboxes'; add_hook('ClientAreaPrimarySidebar', 0, function (MenuItem $primarySidebar) { // Primary_Sidebar-Service_Details_Actions-Cancel if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') // ->getChild('Cancel') // ->setLabel('Cancel ++') // ->setOrder(10) ->addChild('Accounts') ->setLabel('Accounts') ->setUri($AccountURL); // ->setOrder(20); // default menu items have orders 10, 20, 30, etc... } }); This hook exsits under Client area function as `modulename_ClientArea($params) {}`. Could you please help to get the URL dynamic with $params["serviceid"] because i won't know productid and i only obtains throu params as far as i understood. On the side note, I find the documentation very scattered so hard to extract information. Thank you Link to comment Share on other sites More sharing options...
yeoman Posted December 19, 2017 Author Share Posted December 19, 2017 16 minutes ago, yeoman said: Hi, I'm very new to WHMCS and working email module, I'm trying to edit sidebar but SetURI won't accept any variable or direct $params. let me show you the code below $AccountURL = '/clientarea.php?action=productdetails&id='.$params["serviceid"].'&xeront=custom&page=mailboxes'; add_hook('ClientAreaPrimarySidebar', 0, function (MenuItem $primarySidebar) { // Primary_Sidebar-Service_Details_Actions-Cancel if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') // ->getChild('Cancel') // ->setLabel('Cancel ++') // ->setOrder(10) ->addChild('Accounts') ->setLabel('Accounts') ->setUri($AccountURL); // ->setOrder(20); // default menu items have orders 10, 20, 30, etc... } }); This hook exsits under Client area function as `modulename_ClientArea($params) {}`. Could you please help to get the URL dynamic with $params["serviceid"] because i won't know productid and i only obtains throu params as far as i understood. On the side note, I find the documentation very scattered so hard to extract information. Thank you ps: I also tried to call $params inside hook, it seems inside hook function params are empty, additionally i tried to add $params as argument in hook fucntion like function (MenuItem $primarySidebar, $params). it didn't work as well. my only problem is get link with ID that i'm obtaining via params. Link to comment Share on other sites More sharing options...
yeoman Posted December 23, 2017 Author Share Posted December 23, 2017 solved by using making the ID global and then including it with string in variable. which later i was able to successfully call in setUri. Link to comment Share on other sites More sharing options...
sentq Posted December 25, 2017 Share Posted December 25, 2017 you could use $_GET['id'] or $_POST['id'] instead Link to comment Share on other sites More sharing options...
Recommended Posts