AffordableDomainsCanada Posted January 12, 2017 Share Posted January 12, 2017 I am trying to add a Manage Subscriptions link under the Account nav bar, here is the hook so far but I am having some issues with the uri <?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', )); } } }); When I click on the link, it redirects to the right page but I get this error. Whoops! There seems to be a problem with the authentication token, please login to your clientarea to manage your subscriptions I found this in the module folder itself in the hook.php file I dont know if someone can use it to help me? $merge_fields['whmcs_subscriptions_link'] = '<a href="'.$CONFIG['SystemURL'].'/index.php?m=whmcs_subscriptions&id='.$clientid.'&token='.md5(ROOTDIR.$clientid).'">Manage Subscriptions</a>'; $merge_fields['whmcs_subscriptions_url'] = $CONFIG['SystemURL'].'/index.php?m=whmcs_subscriptions&id='.$clientid.'&token='.md5(ROOTDIR.$clientid); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 12, 2017 Share Posted January 12, 2017 normally, i'd have said go back to the original module author for help with a 3rd-party addon (though this addon is no longer mentioned on his site anyway)... but going from previous threads, I know he's gone AWOL. going from the code you posted from the hook.php file, which refers to the email templates, you might want to try the following and see if it works... <?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'].'&token='.md5($_SESSION['uid']), 'order' => '100', )); } } }); 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted January 13, 2017 Author Share Posted January 13, 2017 No that didnt work.. Whoops! There seems to be a problem with the authentication token, please login to your clientarea to manage your subscriptions It is weird cause I can use something like this in a tpl file <a href="{$whmcs_subscriptions_url}">test</a> and can use {$whmcs_subscriptions_url} in email templates but I cant add a link to the nav bar using {$whmcs_subscriptions_url} 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 13, 2017 Share Posted January 13, 2017 what about that: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { global $CONFIG; 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='.md5(ROOTDIR.$_SESSION['uid']), 'order' => '100', )); } } }); 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted January 18, 2017 Author Share Posted January 18, 2017 Yes that works! Is there any way of making it so it is only displayed to logged in users ? Its displaying even when logged out 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 18, 2017 Share Posted January 18, 2017 Yes that works! Is there any way of making it so it is only displayed to logged in users ? Its displaying even when logged out change it to: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { global $CONFIG; if (!is_null($secondaryNavbar->getChild('Account')) && $_SESSION['uid']) { $secondaryNavbar->getChild('Account') ->addChild('Manage Subscriptions', array( 'label' => 'Manage Subscriptions', 'uri' => $CONFIG['SystemURL'].'/index.php?m=whmcs_subscriptions&id='.$_SESSION['uid'].'&token='.md5(ROOTDIR.$_SESSION['uid']), 'order' => '100', )); } }); 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.