Jump to content

How to auto disable domain badges if client do not have any domain registered


zitu4life

Recommended Posts

Hello there

I have a situation where most of my clients do not have domain or hosting services (some has, but they are few).

I know that WHMCS has in settings an options to disable domains, but I can not use it because I have clients with domain.

image.png.2348675f94d5fbc4c00de617e3332e3c.png

 

So, my idea is, if would be possible to get hidden domain badges if a client do not have domain, which means:

1 -normally we have this picture.

image.png.c900bf7a5ecda817595bbb5dd57c2908.png

But I am looking  to have it like this, considered that this client do not have DOMAINS

image.png.b2979fd90658d98a6c12e2a1cd2fe965.png

PS: I edit those pictures using windows paint.

Does anyone already think in such situation in the past, already has a hook for this?

Edited by zitu4life
Link to comment
Share on other sites

13 hours ago, zitu4life said:

Does anyone already think in such situation in the past, already has a hook for this?

the domains tile is already conditional and is shown if a) the client has domains or b) domain registration and/or transfer is enabled generally.

the quick fix would be to edit clientareahome and remove b) so that...

{if $clientsstats.numdomains || $registerdomainenabled || $transferdomainenabled}

becomes...

{if $clientsstats.numdomains}

I suppose if you wanted to do the equivalent as a hook, then it's...

<?php

function homepage_domains_badge_hook($vars) {
	
	if ($vars['templatefile'] == "clientareahome") {
		$client = Menu::context('client');
		$domains = $client->domains()->count;
		if (!$domains) {
			return array("registerdomainenabled" => null, "transferdomainenabled" => null);
		}
	}
}
add_hook("ClientAreaPageHome", 1, "homepage_domains_badge_hook");

if a client has domains, their count will be shown... if they don't, then that badge will show an affiliates count, or if client not an affiliate, a quotes count.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated