HomelessPanda Posted March 15, 2019 Share Posted March 15, 2019 Hey, i was wondering if someone can help me out. am new to whmcs and i want to learn how to customize a template but i can't seem to figure out how to add icons to the product detail sidebar in the client area. To add icons to the cpanel login and others in the list 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 16, 2019 Share Posted March 16, 2019 21 hours ago, HomelessPanda said: To add icons to the cpanel login and others in the list in order to do that, you would really need to use an action hook rather than edit any template... specifically you would use setIcon and would need to use either FontAwesome or Glyphicons for the icons (which icons would you want to use for those links?) https://developers.whmcs.com/themes/sidebars/ 0 Quote Link to comment Share on other sites More sharing options...
HomelessPanda Posted March 16, 2019 Author Share Posted March 16, 2019 i would like to add fas fa-sign-in-alt fa-fw to both cpanel and webmail login, fas fa-unlock fa-fw to the change password and fas fa-ban fa-fw to the Request Cancellation. I am also having some issues with my sidebar panel for some reason its pulling it to the left but i want it to the right and i cant seem to get it fixed. ive been trying for 2 days now with no success, please help 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 17, 2019 Share Posted March 17, 2019 On 16/03/2019 at 14:45, HomelessPanda said: i would like to add fas fa-sign-in-alt fa-fw to both cpanel and webmail login, fas fa-unlock fa-fw to the change password and fas fa-ban fa-fw to the Request Cancellation. then the hook would be along the lines of the code below - create a .php file in /includes/hooks and paste the code into it... <?php # Add Icons To Service Actions Sidebar Hook # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $ActionDetails = $primarySidebar->getChild("Service Details Actions"); if (empty($ActionDetails)) { return; } $ActionDetailsChildren = $ActionDetails->getChildren(); $kidsToIcon = ["Login to cPanel","Login to Webmail","Change Password","Cancel"]; foreach($ActionDetailsChildren as $key => $Action_details_child) { if (in_array($key, $kidsToIcon)) { if ($key === "Login to cPanel" || $key === "Login to Webmail"){$newicon = "fa-sign-in-alt";} elseif ($key === "Change Password"){$newicon = "fa-unlock";} elseif ($key === "Cancel"){$newicon = "fa-ban";} $ActionDetails->getChild($key)->setIcon($newicon." fa-fw"); } } }); you can ignore the Upgrade/Downgrade sidebar link if your products don't have upgrade options... if they do, you can easily update the hook to add an icon to it. <?php # Add Icons To Service Actions Sidebar Hook # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $ActionDetails = $primarySidebar->getChild("Service Details Actions"); if (empty($ActionDetails)) { return; } $ActionDetailsChildren = $ActionDetails->getChildren(); $kidsToIcon = ["Login to cPanel","Login to Webmail","Change Password","Upgrade/Downgrade","Cancel"]; foreach($ActionDetailsChildren as $key => $Action_details_child) { if (in_array($key, $kidsToIcon)) { if ($key === "Login to cPanel" || $key === "Login to Webmail"){$newicon = "fa-sign-in-alt";} elseif ($key === "Change Password"){$newicon = "fa-unlock";} elseif ($key === "Cancel"){$newicon = "fa-ban";} elseif ($key === "Upgrade/Downgrade"){$newicon = "fa-sort";} $ActionDetails->getChild($key)->setIcon($newicon." fa-fw"); } } }); On 16/03/2019 at 14:45, HomelessPanda said: I am also having some issues with my sidebar panel for some reason its pulling it to the left but i want it to the right and i cant seem to get it fixed. ive been trying for 2 days now with no success, please help take a look at the following post for a couple of solutions to this... 0 Quote Link to comment Share on other sites More sharing options...
HomelessPanda Posted March 17, 2019 Author Share Posted March 17, 2019 😁Thank you sooooooooo much you are a life saver. they all worked 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.