Jump to content

Service Detail Sidebar


twhiting9275

Recommended Posts

I've posted this a few places, but it seems like this hasn't made it to it's own thread, so heregoes.

 

Prior to WHMCS 6, there was a sidebar, which, when logged in, and on a client's specific service page, showed details for that specific service.

For whatever reason, WHMCS removed this in 6.

 

The following hook will replace that sidebar with a few more details. Save the code as a php file, add it to whmcs/includes/

 

<?php
use WHMCS\View\Menu\Item as MenuItem;
use Illuminate\Database\Capsule\Manager as Capsule;

/*

Add credentials to the end of all secondary sidebars.
From http://www.whmcsguru.com
*/
add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
/* Get the credentials. */
$service = Menu::context('service');
$username = "{$service->username}";
$serverid = "{$service->server}";
$domain = "{$service->domain}";
$password = "{$service->password}";
$server = Capsule::table('tblservers')->where('id', '=', $serverid)->pluck('hostname');
$ipaddress = Capsule::table('tblservers')->where('id', '=', $serverid)->pluck('ipaddress');
$name1 = Capsule::table('tblservers')->where('id', '=', $serverid)->pluck('nameserver1');
$name2 = Capsule::table('tblservers')->where('id', '=', $serverid)->pluck('nameserver2');
if (is_array($name2))
{
	$name2 = $name2['0'];
}
if (is_array($name1))
{
	$name1 = $name1['0'];
}
if (is_array($ipaddress))
{
	$ipaddress = $ipaddress['0'];
}
if (is_array($server))
{
	$server = $server['0'];
}
//do we want to display the password, or not?
$showpassword = TRUE;

$password = decrypt($password);
/* If the username isn't empty let's show them! */
if ($username != '') {
	/*
	Add a panel to the end of the secondary sidebar for credentials.
	Declare it with the name "credentials" so we can easily retrieve it
	later.
	*/

	$secondarySidebar->addChild('credentials', array(
	'label' => 'Service Information',
	'uri' => '#',
	'icon' => 'fa-desktop',
	));
	/* Retrieve the panel we just created. */
	$credentialPanel = $secondarySidebar->getChild('credentials');
	$credentialPanel->moveToBack();
	/* Show the username. */
	$credentialPanel->addChild('username', array(
	'label' => $username,
	'order' => 1,
	'icon' => 'fa-user',
	));
	if ($showpassword)
	{
		/* Show the password. */
		$credentialPanel->addChild('password', array(
		'label' => $password,
		'order' => 2,
		'icon' => 'fa-lock',
		));
	}
	/* Show the password. */
	$credentialPanel->addChild('domain', array(
	'label' => $domain,
	'order' => 3,
	'icon' => 'fa-globe',
	));
	/*show the server IP*/
	$credentialPanel->addChild('ip', array(
	'label' => $ipaddress,
	'order' => 4,
	'icon' => 'fa-info',
	));
	/*show the server name*/
	$credentialPanel->addChild('server', array(
	'label' => $server,
	'order' => 5,
	'icon' => 'fa-server',
	));

	/*NS1*/
	$credentialPanel->addChild('name1', array(
	'label' => $name1,
	'order' => 6,
	'icon' => 'fa-info-circle',
	));
	/*NS2*/
	$credentialPanel->addChild('name2', array(
	'label' => $name2,
	'order' => 7,
	'icon' => 'fa-info-circle',
	));
}
});

 

servicedetails.jpg

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