Jump to content
  • 0

Preventing Certain Words in a domain name for placing an order




I've been looking to find a hook or a module in order to prevent domain names that contains a certain word for placing a hosting order.

Let's say, if the domain name is thexxl.com and if I restricted the word xxl, user get notified that the entered domain name cannot be used.

I would appreciate your insight on this.

thank you

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
  • WHMCS Technical Analyst II

Hello @artaweb,

A member of our team Josh made a post regarding blocking subdomains being used as existing domain names, using the ClientAreaFooterOutput hook and some client-side JavaScript https://developers.whmcs.com/hooks-reference/output/#clientareafooteroutput

You can read this here:

You could adapt this example to achieve what you desire here.

I hope this helps.

Link to comment
Share on other sites

  • 0
Posted (edited)

I do apologize ahead of time for reviving this post, however even now in 2023 is it valid and have been desperately trying to achieve this functionality.

I have succeeded with the following code snippet for a hook

 if (!defined('WHMCS'))
     die('You cannot access this file directly.');

add_hook('ShoppingCartValidateDomain', 1, function($vars) {
	$restricted_words = array("comma seperated keywords");
	foreach ($restricted_words as $banned) {
		if (strpos($vars['sld'], $banned) !== false) {
			return ["Hmm, we have a problem. ".$vars['sld'].$vars['tld']." is a restricted domain name and is not allowed on our network."];

This same concept can also be used to filter out TLD's by replace sld with tld

What I have not succeeded in doing is filter out the suggested names that will appear below the search block, for this I just deactivated the search feature in the domain lookup provider. So my site does not suggest other tld's for registration. Its a small price to pay.

I hope it helps someone

Edited by Linuxweb
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.

Answer this question...

×   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