Jump to content

How to hide or auto delete selected client area languages immediately after every WHMCS upgrade


zitu4life

Recommended Posts

Hello there

My WHMCS client area only uses 2 language's (English and Portuguese) and all pages have translation for those 2 specific languages.

image.png.e5799e01c0360da758ba0424a4966e90.png

But on every WHMCS upgrades it will overrides all languages again with 26 different languages, and sometimes I forgot to delete it again immediately, and it is not desired from my frontpage. 

image.png.36ba68f403e51a1a8e1a51e78610fe58.png

Future requests would take years and no guarantee that WHMCS will make it possible to define on WHMCS admin what language should be permanent hidden on client area.

A hook is possible in this situation or any cpanel cron that would auto delete those files?

PS: My client area is also my front-end website.

Thanks

Link to comment
Share on other sites

1 hour ago, zitu4life said:

Hi @brian! can we have a modified hook that would work for admin languages too to disable languages that never used? Sometimes I changed from 1 language to another, so basically i always use 2 languages, and my staff too. 

it's not as easy on the admin side as we don't have direct access to the variable, so you may need to turn to using JavaScript to remove the unwanted languages...

<?php

# Hide Admin Languages Hook
# Written by brian!

function hide_admin_languages_hook($vars) {
	
	if ($vars['filename'] == 'myaccount' || ($vars['filename'] == 'configadmins' && isset($_GET["action"]))) {
		$script = <<<HTML
		<script type="text/javascript">
		$(function() {
			var languages_to_remove = ['arabic','czech','dutch','farsi','french','hebrew','hungarian','italian','portugues-br','portugues','russian','spanish','turkish']
			for(var i in languages_to_remove) {
				$("[name=language] option[value=" + languages_to_remove[i] + "]").remove();
			}
		});
		</script>
HTML;
		return $script;
	}
}
add_hook("AdminAreaHeaderOutput", 1, "hide_admin_languages_hook");

I can only think of two places where an admin could change their language - on the myaccount or configadmins pages - if there are others, they can be added to the hook.

in the above hook, it's removing all languages apart from English - so if you want English & French as your available admin languages, just remove french from the above list.

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