Jump to content
mino

Hide terminated products in client area?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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...

  • Like 1

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
<?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 thanks.png

  • Like 1

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Please @brian 

if you need hide other status ex: product cancel

Share this post


Link to post
Share on other sites
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 by string
Somehow the community code editor does not like me. Formats code strange.
  • Thanks 2

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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. 🙂

  • Thanks 1

Share this post


Link to post
Share on other sites
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;}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines