AffordableDomainsCanada Posted August 14, 2015 Share Posted August 14, 2015 (edited) I am trying to add a link under the Account section on the client nav bar (creating a hook). This link will only be displayed when users are logged in as only users will have access to this account function. Here is the code I have so far, but the link is NOT being displayed.. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { if (!is_null($secondaryNavbar->getChild('Account'))) { if (!is_null($client)) { $secondaryNavbar->getChild('Account') ->addChild('Manage Subscriptions', array( 'label' => 'Manage Subscriptions', 'uri' => '{$whmcs_subscriptions_url}', 'order' => '100', )); }} }); Any ideas ?? Edited August 14, 2015 by AffordableDomainsCanada 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 14, 2015 Share Posted August 14, 2015 <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { $_SESSION['uid'] = intval($_SESSION['uid']); if (!is_null($secondaryNavbar->getChild('Account'))) { if ($_SESSION['uid']!='') { $secondaryNavbar->getChild('Account') ->addChild('Manage Subscriptions', array( 'label' => 'Manage Subscriptions', 'uri' => '{$whmcs_subscriptions_url}', 'order' => '100', )); }} }); 1 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted August 14, 2015 Author Share Posted August 14, 2015 I got that code to work, the only problem is... 'uri' => '{$whmcs_subscriptions_url}', 3 is supposed to redirect to ---> http://www.affordabledomains.ca/index.php?m=whmcs_subscriptions&id=9&token=410fee786fe1180da21aa11b5e3830d0 but when I tried adding /index.php?m=whmcs_subscriptions it just redirects me to the home page, it doesnt take me to /index.php?m=whmcs_subscriptions Any ideas on how I can change that ?? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 14, 2015 Share Posted August 14, 2015 you need to specify "id" parameter in this URL: index.php?m=whmcs_subscriptions&id=xx <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { global $CONFIG; $_SESSION['uid'] = intval($_SESSION['uid']); if (!is_null($secondaryNavbar->getChild('Account'))) { if ($_SESSION['uid']!='0') { $secondaryNavbar->getChild('Account') ->addChild('Manage Subscriptions', array( 'label' => 'Manage Subscriptions', 'uri' => $CONFIG['SystemURL'].'/index.php?m=whmcs_subscriptions&id=xx', 'order' => '100', )); } } }); 1 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted August 14, 2015 Author Share Posted August 14, 2015 Will that id parameter be different for every user ? How and where do I get this id ?? I set the link up else where and when I visit the link my client id is 9, and there is also a token parameter.. Im sorry for asking so many times, but im not exactly sure what I am supposed to do, I put the code in the hooks folder and the link is coming up with the xx displayed in my url. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 14, 2015 Share Posted August 14, 2015 xx need to be replaced with the valid ID number. is "whmcs_subscriptions" addon module? 0 Quote Link to comment Share on other sites More sharing options...
mantapjaya Posted August 15, 2015 Share Posted August 15, 2015 Thank you very much 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted August 15, 2015 Author Share Posted August 15, 2015 yes it is an addon module from No Half Pixels. I contacted the author to get help creating the link in the client nav menu, but he directed me here to ask for help from WHMCS. Very poor support, especially when you have to pay for extended support and updates. Is there anyway when the user is logged in the id parameter is filled in ? Is that id number associated with a users account? There for every user will have a different id # ?? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 15, 2015 Share Posted August 15, 2015 Is there anyway when the user is logged in the id parameter is filled in ? Is that id number associated with a users account? There for every user will have a different id # ?? does it have DB tables? can you take screenshot from this tables structures? it will help to know if the ID comes from DB or client ID is the one used. 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted August 15, 2015 Author Share Posted August 15, 2015 it looks like its client id 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 15, 2015 Share Posted August 15, 2015 if it use client ID so it should look like <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { global $CONFIG; $_SESSION['uid'] = intval($_SESSION['uid']); if (!is_null($secondaryNavbar->getChild('Account'))) { if ($_SESSION['uid']!='0') { $secondaryNavbar->getChild('Account') ->addChild('Manage Subscriptions', array( 'label' => 'Manage Subscriptions', 'uri' => $CONFIG['SystemURL'].'/index.php?m=whmcs_subscriptions&id='.$_SESSION['uid'], 'order' => '100', )); } } }); 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted August 15, 2015 Author Share Posted August 15, 2015 your a genius! That worked, somewhat. Now I setup that link else where and this is where it takes me to. http://www.affordabledomains.ca/index.php?m=whmcs_subscriptions&id=9&token=410fee786fe1180da21aa11b5e3830d0'>http://www.affordabledomains.ca/index.php?m=whmcs_subscriptions&id=9&token=410fee786fe1180da21aa11b5e3830d0 so we have the id figured out, but there also needs to be a token, when I click on the link from the script you provided me, I get http://www.affordabledomains.ca/index.php?m=whmcs_subscriptions&id=9 There is NO token provided, how can we add a token ? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 15, 2015 Share Posted August 15, 2015 you don't need $token variable when you use GET method it's only need when you submit form, but here is how we can get it <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { global $CONFIG; global $smarty; $_SESSION['uid'] = intval($_SESSION['uid']); if (!is_null($secondaryNavbar->getChild('Account'))) { if ($_SESSION['uid']!='0') { $secondaryNavbar->getChild('Account') ->addChild('Manage Subscriptions', array( 'label' => 'Manage Subscriptions', 'uri' => $CONFIG['SystemURL'].'/index.php?m=whmcs_subscriptions&id='.$_SESSION['uid'].'&token='.$smarty->get_template_vars('token'), 'order' => '100', )); } } }); 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted August 15, 2015 Author Share Posted August 15, 2015 With out the token I was getting an error saying; even after updating the hook so the token is in the url, I still get the same error. Whoops! There seems to be a problem with the authentication token, please login to your clientarea to manage your subscriptions 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 15, 2015 Share Posted August 15, 2015 do you have demo account? PM it please 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted August 15, 2015 Author Share Posted August 15, 2015 I have sent you a private message! 0 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.