Jump to content

Possible Hook to hide (No Domain)


zitu4life

Recommended Posts

Hello community 

How can we hide (No Domain) using hook or some TPL editing on admin client summary tab (preference for hook)?

How can we replace (No Domain) for some other word or test we want?

@brian! maybe you want look at this.

image.thumb.png.980a7c38329bb9c3b8f87916c19902d3.png

Looking for:

image.thumb.png.9ad03f0979adb210077a208aca5292a3.png 

 

Edited by zitu4life
Link to comment
Share on other sites

12 minutes ago, zitu4life said:

How can we hide (No Domain) using hook or some TPL editing on admin client summary tab (preference for hook)?

aah it's a pity you want a hook, it would just be one line of Smarty code in the clientsummary template. 😞

15 minutes ago, zitu4life said:

How can we replace (No Domain) for some other word or test we want?

it's going to be a variation on a hook that i've given you previously...

<?php

# Change No Domain String In Client Summary Page Hook
# Written by brian!

function client_summary_change_nodomain_hook($vars) {
	if ($vars['filename'] == 'clientssummary') {
		$productsummary = $vars['productsummary'];	
		foreach($productsummary as $key => $product) {
			if($product['domain'] == "(No Domain)") {
				$productsummary[$key]['domain'] = "something else";
			}
		}
		return array("productsummary" => $productsummary);
	}
}
add_hook("AdminAreaPage", 1, "client_summary_change_nodomain_hook");

realistically, if you're still using the first hook, then you should just need to add that if($product block of code above to it, but both hooks should work separately if they have to.

Link to comment
Share on other sites

2 minutes ago, zitu4life said:

ok, it works once again! @brian!

surprised? 😛

3 minutes ago, zitu4life said:

removing hyphen before  - (No Domain) can be be removed by this hook too?  Have tested editing your hook but do not work.

it won't - that hyphen is hardcoded in the template... 🙄

<td style="padding-left:5px;padding-right:5px">{$product.dpackage} - <a href="http://{$product.domain}" target="_blank">{$product.domain}</a></td>

so as I said, the easiest way is to just edit the template and remove it.. I suppose you could use a jQuery hook to remove it, but that gets complicated by WHMCS not having proper IDs in the tags... so you might as well just edit the template. 🙂

Link to comment
Share on other sites

  • 3 weeks later...

How we could change this hook to hide (No Domain) on http://beta.example.com/admin/index.php?rp=/admin/services/other

image.png.ce160159a59a124762ecffe472b525ac.png

On 30/07/2019 at 2:05 AM, brian! said:

<?php # Change No Domain String In Client Summary Page Hook # Written by brian! function client_summary_change_nodomain_hook($vars) { if ($vars['filename'] == 'clientssummary') { $productsummary = $vars['productsummary']; foreach($productsummary as $key => $product) { if($product['domain'] == "(No Domain)") { $productsummary[$key]['domain'] = "something else"; } } return array("productsummary" => $productsummary); } } add_hook("AdminAreaPage", 1, "client_summary_change_nodomain_hook");

Also, if we change language (No Domain) will be written different, so this hook will not hide if language change, so  guess I could add on same hook comma and translations to other language???
No Domain) >>>>english
(Sin dominio) >>>Spanish
(Aucun domaine)>> french

@brian!

 

On 30/07/2019 at 2:05 AM, brian! said:

foreach($productsummary as $key => $product) { if($product['domain'] == "(No Domain), (Sin dominio),(Aucun domaine)") { $productsummary[$key]['domain'] = "something else"; }

 

Edited by WHMCS ChrisD
Removed link at OP request
Link to comment
Share on other sites

to fix the original clientsummary hook to use the language string...

<?php

# Change No Domain String In Client Summary Page Hook
# Written by brian!

function client_summary_change_nodomain_hook($vars) {
    GLOBAL $_ADMINLANG;
	if ($vars['filename'] == 'clientssummary') {
		$productsummary = $vars['productsummary'];
		$nodomain = $_ADMINLANG['addons']['nodomain'];
		foreach($productsummary as $key => $product) {
			if($product['domain'] == '('.$nodomain.')') {
				$productsummary[$key]['domain'] = "something else";
			}
		}
		return array("productsummary" => $productsummary);
	}
}
add_hook("AdminAreaPage", 1, "client_summary_change_nodomain_hook");

if the output of what you're changing "No Domain" to has be in the client's language, then you'd replace "something else" with AdminLang::trans('some__language_string').

9 hours ago, zitu4life said:

Also, if we change language (No Domain) will be written different, so this hook will not hide if language change, so  guess I could add on same hook comma and translations to other language???

the hook works on the client summary page because it has a template to work with - you don't have that on the page you specify, so you'd need to use Language Overrides - I don't think the docs mention it, but you can use overrides in the admin languages too, you just need to know the specific string to change (or null) - and i've included that in the above hook... btw create the overrides folder in the admin /lang folder.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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