Jump to content

Sidebar SetURI link


yeoman

Recommended Posts

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

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

Guest
This topic is now closed to further replies.
  • 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