mino Posted January 26, 2019 Share Posted January 26, 2019 Is it possible to hide terminated products from the client in the client area? with hook or other methode ? I want them to still be visible in the admin area but not the client area. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 26, 2019 Share Posted January 26, 2019 10 minutes ago, mino said: Is it possible to hide terminated products from the client in the client area? with hook or other methode ? I want them to still be visible in the admin area but not the client area. on the My Products & Services table ? I would have thought it would just need a hook to unset terminated products from the $services array... 1 Quote Link to comment Share on other sites More sharing options...
mino Posted January 26, 2019 Author Share Posted January 26, 2019 4 minutes ago, brian! said: on the My Products & Services table ? I would have thought it would just need a hook to unset terminated products from the $services array... please its possible hook 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 26, 2019 Share Posted January 26, 2019 <?php # Remove Terminated Products From Services Array Hook # Written by brian! function clients_services_remove_terminated_hook($vars) { $services = $vars['services']; foreach($services as $key => $service) { if ($service['status'] == "Terminated") { unset($services[$key]); } } return array("services" => $services); } add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook"); ?> you might need another hook to remove the Terminated link from the sidebar if you're showing that sidebar on your site... or even simpler, you should be able to hide it using custom.css 3 Quote Link to comment Share on other sites More sharing options...
mino Posted January 26, 2019 Author Share Posted January 26, 2019 2 minutes ago, brian! said: <?php # Remove Terminated Products From Services Array Hook # Written by brian! function clients_services_remove_terminated_hook($vars) { $services = $vars['services']; foreach($services as $key => $service) { if ($service['status'] == "Terminated") { unset($services[$key]); } } return array("services" => $services); } add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook"); ?> you might need another hook to remove the Terminated link from the sidebar if you're showing that sidebar on your site. just in table need to hide, im test its work fine thank you brian 0 Quote Link to comment Share on other sites More sharing options...
mino Posted January 26, 2019 Author Share Posted January 26, 2019 6 minutes ago, brian! said: <?php # Remove Terminated Products From Services Array Hook # Written by brian! function clients_services_remove_terminated_hook($vars) { $services = $vars['services']; foreach($services as $key => $service) { if ($service['status'] == "Terminated") { unset($services[$key]); } } return array("services" => $services); } add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook"); ?> you might need another hook to remove the Terminated link from the sidebar if you're showing that sidebar on your site. if you need hide other status ex: product cancel how to add please 0 Quote Link to comment Share on other sites More sharing options...
mino Posted January 26, 2019 Author Share Posted January 26, 2019 Please @brian if you need hide other status ex: product cancel 0 Quote Link to comment Share on other sites More sharing options...
mino Posted January 26, 2019 Author Share Posted January 26, 2019 Spoiler Please @brian! if you need hide other status ex: product cancel 0 Quote Link to comment Share on other sites More sharing options...
string Posted January 26, 2019 Share Posted January 26, 2019 (edited) 1 hour ago, mino said: Please @brian! if you need hide other status ex: product cancel See the following modification <?php # Remove Products From Services Array Hook # Written by brian! function clients_services_remove_terminated_hook($vars) { $hideStatus = array ('Terminated', 'Cancelled'); // add status which you want to hide here.. $services = $vars['services']; foreach($services as $key => $service) { if (in_array($service['status'], $hideStatus)) { unset($services[$key]); } } return array("services" => $services); } add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook"); Edited January 26, 2019 by string Somehow the community code editor does not like me. Formats code strange. 2 Quote Link to comment Share on other sites More sharing options...
mino Posted January 27, 2019 Author Share Posted January 27, 2019 9 hours ago, string said: See the following modification <?php # Remove Products From Services Array Hook # Written by brian! function clients_services_remove_terminated_hook($vars) { $hideStatus = array ('Terminated', 'Cancelled'); // add status which you want to hide here.. $services = $vars['services']; foreach($services as $key => $service) { if (in_array($service['status'], $hideStatus)) { unset($services[$key]); } } return array("services" => $services); } add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook"); Thank you @string 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 27, 2019 Share Posted January 27, 2019 many thanks @string - I was on my way out when I replied to the thread (it was Saturday night after all!) so didn't see the further questions from @mino until this morning... in case anyone else uses this hook in the future, if you wanted to hide the "Terminated" & "Cancelled" filters in the sidebar using css, you should only need to use.. #Primary_Sidebar-My_Services_Status_Filter-Terminated, #Primary_Sidebar-My_Services_Status_Filter-Cancelled {display: none;} ... i'm sure most will find that simpler than writing another hook. 🙂 2 Quote Link to comment Share on other sites More sharing options...
mino Posted January 27, 2019 Author Share Posted January 27, 2019 Big Thank's @brian! 0 Quote Link to comment Share on other sites More sharing options...
web2008 Posted February 16, 2019 Share Posted February 16, 2019 Is it possible to do the same with Cancelled Domains? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 16, 2019 Share Posted February 16, 2019 1 hour ago, web2008 said: Is it possible to do the same with Cancelled Domains? yes - similar hook, you just have to change the array used and the hook point called... <?php # Remove Cancelled Domains From Array Hook # Written by brian! function clients_domains_hide_cancelled_hook($vars) { $hideStatus = array ('Cancelled'); $domains = $vars['domains']; foreach($domains as $key => $domain) { if (in_array($domain['status'], $hideStatus)) { unset($domains[$key]); } } return array("domains" => $domains); } add_hook("ClientAreaPageDomains", 1, "clients_domains_hide_cancelled_hook"); and then to hide the cancelled filter, you could remove it with another hook or hide it with css.. #Primary_Sidebar-My_Domains_Status_Filter-clientareacancelled {display: none;} 0 Quote Link to comment Share on other sites More sharing options...
web2008 Posted February 16, 2019 Share Posted February 16, 2019 Thank you very much, just what I needed! 0 Quote Link to comment Share on other sites More sharing options...
plusplushosting Posted February 23, 2019 Share Posted February 23, 2019 This is a great addon to whmcs as most of the addons Brian provide here in the community...just wondering if is possible add a button in the client side where clients can hide/show the terminated/cancelled products/domains? Or that is something cant be done with hooks? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 24, 2019 Share Posted February 24, 2019 17 hours ago, plusplushosting said: .just wondering if is possible add a button in the client side where clients can hide/show the terminated/cancelled products/domains? Or that is something cant be done with hooks? don't the sidebar filters effectively do this already? e.g if I only want to see terminated products, I can click on the "Terminated" filter link; similarly for cancelled... or are you thinking of some toggle setting on the sidebar ? if so, I guess that could be done as the hook could pull the current toggle value from the sidebar; adjust the array as required and refresh the page... 0 Quote Link to comment Share on other sites More sharing options...
plusplushosting Posted February 24, 2019 Share Posted February 24, 2019 14 minutes ago, brian! said: don't the sidebar filters effectively do this already? e.g if I only want to see terminated products, I can click on the "Terminated" filter link; similarly for cancelled... yes, im an idiot :-)...ok then...is there any way that on any area, i mean (domains, invoices, services) by default when load the page show the (active, unpaid and active) domains, invoices and services? 0 Quote Link to comment Share on other sites More sharing options...
championc Posted March 5, 2019 Share Posted March 5, 2019 Could this same method be used to allow all Custom Client Fields to be displayed using clientareaproductdetails.tpl ? At present, all Admin Only fields are ommitted whereas I want to include them. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 6, 2019 Share Posted March 6, 2019 18 hours ago, championc said: Could this same method be used to allow all Custom Client Fields to be displayed using clientareaproductdetails.tpl ? At present, all Admin Only fields are omitted whereas I want to include them. not specifically this type of hook, but you could use a hook to do this if you had to (though I don't think that you need too) - see your other thread on this. 0 Quote Link to comment Share on other sites More sharing options...
upalm Posted December 20, 2019 Share Posted December 20, 2019 @brian! Hello, first of thanks for this amazing script. But is there a way to hide the expired products under 'Submit Ticket's' too? As the expired products just clutters the 'submitticket.php' 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 20, 2019 Share Posted December 20, 2019 1 hour ago, upalm said: But is there a way to hide the expired products under 'Submit Ticket's' too? As the expired products just clutters the 'submitticket.php' are you talking about the related services dropdown? if so, I posted a hook a year ago in the thread below than can be used to hide specific statuses (and optionally sort their order so that the active services are shown first)... in your case, you would just change the line below in the hook to include all of the statuses that you want to hide... $cancelled = array('Cancelled','Terminated','Expired','Grace Period (Expired)'); 1 Quote Link to comment Share on other sites More sharing options...
upalm Posted December 21, 2019 Share Posted December 21, 2019 @brian! Thank you so much for the quick reply and contributing to the work on the amazing hook 🙂 You are amazing ^^ 0 Quote Link to comment Share on other sites More sharing options...
upalm Posted January 3, 2020 Share Posted January 3, 2020 (edited) Edit: Oops my bad, I had chosen terminated by mistake. All fine here. Great work on the hook! Edited January 3, 2020 by upalm 0 Quote Link to comment Share on other sites More sharing options...
SeanP Posted March 11, 2021 Share Posted March 11, 2021 Thanks for sharing these hooks, Brian! Is there a way to not show the "Terminated" and "Cancelled" services in the default unfiltered list of all services (no filters checked), BUT still allow the client to click the "Terminated" or "Cancelled" filters and still view those statuses? That way, the client still has the option to see the terminated and cancelled services, if they wish. 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.