zitu4life Posted July 29, 2019 Share Posted July 29, 2019 (edited) 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. Looking for: Edited July 29, 2019 by zitu4life 0 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted July 29, 2019 Author Share Posted July 29, 2019 (edited) PS: This hook should hide only when it finds named (No Domain), if there is domain.com there it should be there. Edited July 29, 2019 by zitu4life 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 29, 2019 Share Posted July 29, 2019 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. 1 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted July 29, 2019 Author Share Posted July 29, 2019 ok, it works once again! @brian! removing hyphen before - (No Domain) can be be removed by this hook too? Have tested editing your hook but do not work. if($product['domain'] == " - (No Domain)") Probably this hyphen comes before product domain name. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 29, 2019 Share Posted July 29, 2019 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. 🙂 1 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted July 29, 2019 Author Share Posted July 29, 2019 Many thanks! for pointing exactly where to look for. Very helpful 0 Quote Link to comment Share on other sites More sharing options...
zitu4life Posted August 16, 2019 Author Share Posted August 16, 2019 (edited) How we could change this hook to hide (No Domain) on http://beta.example.com/admin/index.php?rp=/admin/services/other 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 August 17, 2019 by WHMCS ChrisD Removed link at OP request 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted August 16, 2019 Share Posted August 16, 2019 You can directly use language variable. It's Lang::trans('yournodomainlangvariable'). I'm sorry but I can't provide the exact name of the variable (using phone). 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 16, 2019 Share Posted August 16, 2019 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. 1 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.