Jump to content

Insert a custom URL  below the  Contacts/Sub-Accounts


Recommended Posts

17 hours ago, VirtualWorldGlobal said:

Can we insert a custom URL  below  the  Contacts/Sub-Accounts, I want to insert the Affiliate / Other page link (https://domainname.com/affiliates.php) here opening in the same or new window?

that's just a secondary navbar hook - and i'm assuming that you want to check that they're affiliates before adding the link...

<?php
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) {
	$client = Menu::context('client');
	$affiliate = $client->affiliate;
	if ($affiliate && !is_null($secondaryNavbar->getChild('Account'))) {
		$secondaryNavbar->getChild('Account')->addChild('affiliates', array('label' => Lang::trans('affiliatestitle'),'uri' => 'affiliates.php','order' => 25,))->setAttribute('target','_blank');
    }
});
Link to comment
Share on other sites

24 minutes ago, VirtualWorldGlobal said:

I think I am wrong somewhere as it is not working as expected. Unable to locate Affiliates here.

is the user you are logged in as an affiliate ? if not, it won't appear.

if you want it to appear for everyone, then just remove the affiliate part of the if statement.

if (!is_null($secondaryNavbar->getChild('Account'))) {
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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