Jump to content
garybarr

Turn off "Hide Inactive Clients" for good?

Recommended Posts

Update: I just changed it to a closure and it started working 🙂

<?php
//error_log(__FILE__);

add_hook('AdminAreaPage', 1, function ($vars)
{
//error_log(__METHOD__);

    $filename = $vars['filename'];
    $hiddenstatus = $_GET['show_hidden'];
    if ($filename == "clients" && $hiddenstatus != '1') {
        $url = 'clients.php?filter=1&show_hidden=1';
        header( 'Location: '.$url );
    }
});

Share this post


Link to post
Share on other sites

Totally agree. I have no idea or suggestions about downgrading. The code snippet I posted above almost solves the problem but it introduces another one when trying to page through clients... the code always forces the first page of results no matter where you try to page to... so it's useless as is. The WHMCS devs really really HAVE TO provide an option to disable this "feature". It's wasted so much of our time and does absolutely nothing to enhance the usability of the View/Search Clients page.

Share this post


Link to post
Share on other sites

Please try this updated code if you need support for pagination:

add_hook( 'AdminAreaPage', 1, function ( $vars ) {
	if ( $vars['filename'] == 'clients' && $_GET['show_hidden'] != '1' ) {
		$url_parts = parse_url(html_entity_decode($_SERVER['REQUEST_URI']));
		parse_str($url_parts['query'], $query_vars);
		$query_vars['show_hidden'] = 1;
		$url_parts['query'] = http_build_query($query_vars);
		$redirect_url = ((isset($url_parts['path']) ? "{$url_parts['path']}" : '') .
		                 (isset($url_parts['query']) ? "?{$url_parts['query']}" : '') .
		                 (isset($url_parts['fragment']) ? "#{$url_parts['fragment']}" : ''));
		header( 'Location: '.$redirect_url, true, 307 );
	}
} );

 

Also, if you have a more complex URL structure this longer version is for you:

add_hook('AdminAreaPage', 1, function($vars){
	if ($vars['filename'] == 'clients' && $_GET['show_hidden'] != '1'){
		$current_url = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http').'://'.$_SERVER['SERVER_NAME'].html_entity_decode($_SERVER['REQUEST_URI']);
		$url_parts = parse_url($current_url);
		parse_str($url_parts['query'], $query_vars);
		$query_vars['show_hidden'] = 1;
		$url_parts['query'] = http_build_query($query_vars);
		$redirect_url = ((isset($url_parts['scheme']) ? "{$url_parts['scheme']}:" : '').
			((isset($url_parts['user']) || isset($url_parts['host'])) ? '//' : '').
			(isset($url_parts['user']) ? "{$url_parts['user']}" : '').
			(isset($url_parts['pass']) ? ":{$url_parts['pass']}" : '').
			(isset($url_parts['user']) ? '@' : '').
			(isset($url_parts['host']) ? "{$url_parts['host']}" : '').
			(isset($url_parts['port']) ? ":{$url_parts['port']}" : '').
			(isset($url_parts['path']) ? "{$url_parts['path']}" : '').
			(isset($url_parts['query']) ? "?{$url_parts['query']}" : '').
			(isset($url_parts['fragment']) ? "#{$url_parts['fragment']}" : ''));
		header('Location: '.$redirect_url, true, 307);
	}
});

 

Share this post


Link to post
Share on other sites
On 6/18/2019 at 8:13 AM, WarpConduit Computing said:

Please try this updated code if you need support for pagination:


add_hook( 'AdminAreaPage', 1, function ( $vars ) {
	if ( $vars['filename'] == 'clients' && $_GET['show_hidden'] != '1' ) {
		$url_parts = parse_url(html_entity_decode($_SERVER['REQUEST_URI']));
		parse_str($url_parts['query'], $query_vars);
		$query_vars['show_hidden'] = 1;
		$url_parts['query'] = http_build_query($query_vars);
		$redirect_url = ((isset($url_parts['path']) ? "{$url_parts['path']}" : '') .
		                 (isset($url_parts['query']) ? "?{$url_parts['query']}" : '') .
		                 (isset($url_parts['fragment']) ? "#{$url_parts['fragment']}" : ''));
		header( 'Location: '.$redirect_url, true, 307 );
	}
} );

 

Also, if you have a more complex URL structure this longer version is for you:


add_hook('AdminAreaPage', 1, function($vars){
	if ($vars['filename'] == 'clients' && $_GET['show_hidden'] != '1'){
		$current_url = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http').'://'.$_SERVER['SERVER_NAME'].html_entity_decode($_SERVER['REQUEST_URI']);
		$url_parts = parse_url($current_url);
		parse_str($url_parts['query'], $query_vars);
		$query_vars['show_hidden'] = 1;
		$url_parts['query'] = http_build_query($query_vars);
		$redirect_url = ((isset($url_parts['scheme']) ? "{$url_parts['scheme']}:" : '').
			((isset($url_parts['user']) || isset($url_parts['host'])) ? '//' : '').
			(isset($url_parts['user']) ? "{$url_parts['user']}" : '').
			(isset($url_parts['pass']) ? ":{$url_parts['pass']}" : '').
			(isset($url_parts['user']) ? '@' : '').
			(isset($url_parts['host']) ? "{$url_parts['host']}" : '').
			(isset($url_parts['port']) ? ":{$url_parts['port']}" : '').
			(isset($url_parts['path']) ? "{$url_parts['path']}" : '').
			(isset($url_parts['query']) ? "?{$url_parts['query']}" : '').
			(isset($url_parts['fragment']) ? "#{$url_parts['fragment']}" : ''));
		header('Location: '.$redirect_url, true, 307);
	}
});

 

Has anyone tried this code?

Does it work?

I thought I could get use to the inactive clients being hidden but I just find it very annoying. The inactive clients aren't visible from the dropdown when looking at another client so I have to go back to the client screen, click to show the inactive clients, then click on the client I want to see. This has created too many unnecessary steps.

Share this post


Link to post
Share on other sites
5 minutes ago, N8Solutions said:

Has anyone tried this code? Does it work?

the first hook you quoted does - never tried the second... effectively, you can't turn "Hide Inactive" on with this hook running, so hidden clients are shown on the Client List page... it will have no impact on whether a hidden client is listed in the dropdown - they still won't be.

if this is "fixed" in v7.8, it will only have taken them the best part of 6 months. 🙄

Share this post


Link to post
Share on other sites

Let's stop trying, every solution is a bad hack that tampers with parameters. It gives at best a false sense of security that makes you more prone to errors when it fails.

If it's not removed in the next version I will seriously consider moving away from the platform.

Share this post


Link to post
Share on other sites

Marek, I totally agree. We got so fed up with this glitch we had to mark all users as active and make manual notes about who is really not active and hack the provisioning backend to take this into account. We would love to send WHMCS a bill for all the lost hours this has cost us! We have started testing an open source WordPress/Woocommerce solution for our specific needs!

Share this post


Link to post
Share on other sites

Stumbled across this thread while trying to figure out if there was a setting I was missing to disable this somewhere because I didn't want to resort to editing the template. 


We have a TON of "Inactive" users who are actively paying one-off invoices. Such a hassle to have to hit that button all the time to show the missing clients. WHMCS really needs to remove this "feature" or at least add a setting to completely disable it.

Share this post


Link to post
Share on other sites

Yes, it was one giant turd of an addition to the software... and it's made us look into a different route for the future and replacing WHMCS.   We have too many 1-invoice customers that we did a job for but don't have ongoing services.  So it caused us to start having tons of duplicate accounts for a customer, because people kept thinking they didn't have an account.

I really wonder what WHMCS was thinking (or wasn't thinking) with this completely stupid addition and with no way to turn it off.

Share this post


Link to post
Share on other sites
19 hours ago, garybarr said:

I really wonder what WHMCS was thinking (or wasn't thinking) with this completely stupid addition and with no way to turn it off.

about the only thing harder than getting WHMCS to add a feature (which is no small task in itself!), is after WHMCS have added it, is then getting them to fix it because what they originally did wasn't tested or developed to a sufficient standard... or increasingly more likely these days, wasn't even requested by their users in the first place. 🙄

Share this post


Link to post
Share on other sites
Posted (edited)

It's like they don't want us to use there system for customers who aren't "Active",  which if they aren't active, they don't get more money.  Odd how little "new features" like that happen and don't get fixed.  LOL

Edited by garybarr

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 and understand your posts will initially be pre-moderated