DraGoNeTi 2 Posted February 15, 2018 Hello, i am really sorry if this is the wrong category to post. i came across this information on a hosting company... and i was wondering if i can add it to my site... i know i have seen it as a hook somewhere in here, but now i can't.. ! can someone help me ? whmcs v7 0 Share this post Link to post Share on other sites
twhiting9275 51 Posted February 16, 2018 (edited) Here you go... This will return the left sidebar of service information when the service page is displayed <?php use WHMCS\View\Menu\Item as MenuItem; use Illuminate\Database\Capsule\Manager as Capsule; /* Add credentials to the end of all secondary sidebars. */ 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'); $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', )); /* 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', )); } }); At some point, long, long ago, this was in there, but taken out. This will return it. Edited February 16, 2018 by twhiting9275 1 Share this post Link to post Share on other sites
brian! 3112 Posted February 16, 2018 23 hours ago, DraGoNeTi said: i came across this information on a hosting company... and i was wondering if i can add it to my site... i know i have seen it as a hook somewhere in here, but now i can't.. ! can someone help me ? it should be added automatically if the product requires a domain (and has a domain value within it). and if you wanted to use the sidebar hook to duplicate the information for v7.4, the credentials code should be changed to... /* 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)->value('hostname'); $ipaddress = Capsule::table('tblservers')->where('id', $serverid)->value('ipaddress'); $name1 = Capsule::table('tblservers')->where('id', $serverid)->value('nameserver1'); $name2 = Capsule::table('tblservers')->where('id', $serverid)->value('nameserver2'); 1 Share this post Link to post Share on other sites
twhiting9275 51 Posted February 17, 2018 Yeah, I guess that needed a bit of updating. Was written for 6x 0 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted February 17, 2018 thanks a lot guys ! 0 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted February 17, 2018 and what if i wanted to add titles and not icons ? 0 Share this post Link to post Share on other sites
Walas Lima 0 Posted March 30, 2018 On 15/02/2018 at 9:30 PM, twhiting9275 said: Here you go... This will return the left sidebar of service information when the service page is displayed <?php use WHMCS\View\Menu\Item as MenuItem; use Illuminate\Database\Capsule\Manager as Capsule; /* Add credentials to the end of all secondary sidebars. */ 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'); $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', )); /* 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', )); } }); At some point, long, long ago, this was in there, but taken out. This will return it. - Hello, I added this hook in my whmcs however when I tried to access the part of the services the use of the cpu of the account that this installed the whmcs goes in 100% could I help to solve this question? Version used of whmcs is 7.4.2x 0 Share this post Link to post Share on other sites
brian! 3112 Posted March 31, 2018 17 hours ago, Walas Lima said: Hello, I added this hook in my whmcs however when I tried to access the part of the services the use of the cpu of the account that this installed the whmcs goes in 100% could I help to solve this question? Version used of whmcs is 7.4.2x if you're using v7.4.2, did you change references of 'pluck' to 'value' ? 0 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted March 31, 2018 On 17/2/2018 at 8:47 AM, DraGoNeTi said: and what if i wanted to add titles and not icons ? guys.... !!! 0 Share this post Link to post Share on other sites
brian! 3112 Posted March 31, 2018 in the sidebar? just remove the icon lines from the hook. 0 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted March 31, 2018 7 minutes ago, brian! said: in the sidebar? just remove the icon lines from the hook. yes, but i want it to say: (icon) Password: blablabla 0 Share this post Link to post Share on other sites
brian! 3112 Posted March 31, 2018 9 minutes ago, DraGoNeTi said: yes, but i want it to say: (icon) Password: blablabla if this is v7.4.2, then the icons are on the right... that will be defined in sidebar.tpl, so your options would be to either edit the template to move them to the left... or in the hook, remove the icons as I said above, but add them manually to the label value as you would with any fontawesome icon. 0 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted March 31, 2018 and how about if the service is a whmsonic/centova product, show the admin password as well as the radio port and some extra info ( let's say, the listeners limit, the kbps limit etc etc ) 0 Share this post Link to post Share on other sites
brian! 3112 Posted March 31, 2018 4 minutes ago, DraGoNeTi said: and how about if the service is a whmsonic/centova product, show the admin password as well as the radio port and some extra info ( let's say, the listeners limit, the kbps limit etc etc ) then it's a case of locating the information required, e.g can you get it via the class docs; is it available as Smarty variables or do you need to query the db ? 0 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted March 31, 2018 (edited) i think we could query the db... but ! as i can remember, the whmsonic is under root account so we couldn't query it Edited March 31, 2018 by DraGoNeTi 0 Share this post Link to post Share on other sites
Walas Lima 0 Posted March 31, 2018 3 hours ago, brian! said: if you're using v7.4.2, did you change references of 'pluck' to 'value' ? Hello, Can not I do this? 0 Share this post Link to post Share on other sites
brian! 3112 Posted April 1, 2018 21 hours ago, Walas Lima said: Hello, Can not I do this? if you're using v7.4.2, you will need to edit the hook file to make it work. 0 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted April 26, 2018 @brian! you forgot me.. ! When you can and you have time... 0 Share this post Link to post Share on other sites
brian! 3112 Posted April 27, 2018 14 hours ago, DraGoNeTi said: @brian! you forgot me.. ! When you can and you have time... forgive me but I can't see which question I haven't answered! 0 Share this post Link to post Share on other sites
twhiting9275 51 Posted April 29, 2018 This will work with either 6.x or 7.x . Sorry, it's been a while since I played around on the WHMCS forums, but here's an updated version. No more editing necessary <?php use WHMCS\View\Menu\Item as MenuItem; use Illuminate\Database\Capsule\Manager as Capsule; /* Add credentials to the end of all secondary sidebars. */ 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']; } $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', )); /* 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', )); } }); 1 Share this post Link to post Share on other sites
DraGoNeTi 2 Posted May 6, 2018 @twhiting9275 hey man, thanks for the update. What if the product is a whmsonic radio? i wanted it to say package name, ip, port, dj port(if autodj enabled), password, admin password, listeners... is it easy to do ? 0 Share this post Link to post Share on other sites
twhiting9275 51 Posted May 6, 2018 That's likely possible, but not something you'll likely find here for free . The idea with this was to provide a basic example of how to do this. For more one on one customization, you'll need to work with a dev on that 0 Share this post Link to post Share on other sites
brian! 3112 Posted May 7, 2018 13 hours ago, twhiting9275 said: That's likely possible, but not something you'll likely find here for free. a tempting invitation, but even I can't be bothered to do that on a sunny public holiday here in the UK! 21 hours ago, DraGoNeTi said: What if the product is a whmsonic radio? i wanted it to say package name, ip, port, dj port(if autodj enabled), password, admin password, listeners... is it easy to do ? it's just going to be a variation on the theme of the sample hook above... you'll be able to get all that info from a combination of the class docs and/or querying the database... e.g name will probably be... $service->product->name listeners... $service->product->moduleConfigOption2 bitrate... $service->product->moduleConfigOption3 autodj status... $service->product->moduleConfigOption4 and so on... then if you need to query the db, it will be tblproducts for product details, tblservers for server details and tblhosting for any specifics about the specific service... the info is out there somewhere! 0 Share this post Link to post Share on other sites