weba Posted March 18, 2021 Share Posted March 18, 2021 Hi, I want to be able to accept subdomains with 'use your own domain' for ordering a hosting product. But it appears that its not possible, domain invalid. Any idea how to skip this validation ? thx Michel 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 18, 2021 Share Posted March 18, 2021 10 minutes ago, weba said: I want to be able to accept subdomains with 'use your own domain' for ordering a hosting product. https://requests.whmcs.com/topic/create-products-for-subdomains-through-use-existing-domain-option-in-cart 1 hour ago, weba said: But it appears that its not possible, domain invalid. Any idea how to skip this validation ? i'm tempted to say to use an older version of WHMCS! 🙂 the least coding solution would probably be to use a customfield to ask for it any potential sub a later stage.... 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted March 20, 2021 Share Posted March 20, 2021 Well, technically, use your own domain means "domain", not subdomain. If you need to activate a product with a subdomain, then using the form that checks for a valid domain is probably incorrect anyway, as you are now using a hostname which is not a valid qualified domain name. You would need to create a product that does not require a domain on the ordering process and then allow customers to enter the subdomain or hostname by creating that field for them to enter. If you mark the option to require a domain name with a product, then WHMCS is correctly not allowing subdomains as you cannot register, transfer a subdomain. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 20, 2021 Share Posted March 20, 2021 Using a custom field is clunky when WHMCS should not care about the domain when using the "use existing domain" since it isn't going to manage that domain. It obviously doesn't care about subs being in the domain field considering that is where they are stored when setting up a product with sub domains. Using a custom field would break any built-in server modules since it would expect the domain field to be filled for creating accounts. With that said a checkout hook could probably be used to copy the custom field value over . It is a shame that DomainValidation or ShoppingCartValidateDomain hooks can't be used for this but alas that isn't the case. DomainValidation runs for that but doesn't accept any returns -- missed opportunity by the devs. ShoppingCartValidateDomain is only for registering / transferring domains, which makes sense. @weba Just to confirm you want them to be able to use their own domain or do you want them to use a sub on your domain? If you wanted to use your domain for them, you can set that up via the Sub domain option in the product config page -> Other tab. 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted March 21, 2021 Share Posted March 21, 2021 10 hours ago, steven99 said: Using a custom field is clunky when WHMCS should not care about the domain when using the "use existing domain" since it isn't going to manage that domain. It obviously doesn't care about subs being in the domain field considering that is where they are stored when setting up a product with sub domains. Using a custom field would break any built-in server modules since it would expect the domain field to be filled for creating accounts. With that said a checkout hook could probably be used to copy the custom field value over . It is a shame that DomainValidation or ShoppingCartValidateDomain hooks can't be used for this but alas that isn't the case. DomainValidation runs for that but doesn't accept any returns -- missed opportunity by the devs. ShoppingCartValidateDomain is only for registering / transferring domains, which makes sense. @weba Just to confirm you want them to be able to use their own domain or do you want them to use a sub on your domain? If you wanted to use your domain for them, you can set that up via the Sub domain option in the product config page -> Other tab. I'm not sure if I follow. If the domain field accepted subdomains this would cause tons of problems for people that need domains registered with the product since a subdomain would be invalid. People will just type invalid names in the input and the process will fail. Like I said, a subdomain IS NOT a domain. It's not valid. If what someone wants is a subdomain you first need to register the domain name. There is a hook to verify a subdomain that you can use with orders, here: https://developers.whmcs.com/hooks-reference/shopping-cart/ CartSubdomainValidation Executes when Cart Subdomain Validation is occurring. If someone needs a valid domain + subdomain, I don't think any cart system does that. What I would do in that case is just require a domain, then when request the subdomain separately, like in the product order and then try to automated it someway so that its properly created. Now, if someone just wants a subdomain without a domain, then using the domain cart option is clearly wrong since that is designed for fully qualified domain names, which a subdomain is not. I can imagine scenarios that require a subdomain, example, a server, a fully qualified hostname like server.domain.com, or just any service that is designed for people that already have a domain and they need to activate it for a section of their sites, in all those cases, using the domain cart is just wrong, since you don't want a domain name here, but a subdomain. What exactly are people looking here? Make sure a subdomain is valid? Or make sure a subdomain belongs to an existing domain already in WHMCS? Both cases could be achieved with hooks or extra code, WHMCS will not do this since its not that easy to validate a subdomain, people can literally just enter anything. I assume what people are asking here is for WHMCS to have some subdomain validation build in? That maybe checks if the domain exists in WHMCS or maybe checks if the domain is valid in terms of extension? You could also build that with hooks. It would require to load a list of valid extensions and then some regex making sure that people are using proper subdomains, then again what would someone consider the subdomain to be valid? Because something like this is also a valid subdomain: name.subdomain.name.example.com How much nesting would you allow? Would to check the extension? If yes, what about people using subdomain as hostnames for server which might not require a valid domain name like host.local You see the issue? Its not as simple as some might suggest. Since everyone requires different things. As for WHMCS not allowing subdomains in the domain ordering process. I think that is correct, in the past they allowed this and it was wrong, people that tried to register domains could not and WHMCS customers complained that the cart allowed to input invalid domains. Now it seems they fixed this. If you go Godaddy or any domain registrar they will not let you enter a subdomain either. The domain order cart is designed for domains and as such is properly checking if a domain format is valid. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 21, 2021 Share Posted March 21, 2021 12 hours ago, steven99 said: With that said a checkout hook could probably be used to copy the custom field value over . well der, that was the point - it would be simpler (than any alternative I could think of) to get the information from the user and then adjust the values post validation. 12 hours ago, steven99 said: ShoppingCartValidateDomain is only for registering / transferring domains, which makes sense. i've posted using that hook point to check for owndomain validation too... so the owndomain is not the issue, it's suppressing/bypassing WHMCS' own validation. 2 hours ago, yggdrasil said: I'm not sure if I follow. If the domain field accepted subdomains this would cause tons of problems for people that need domains registered with the product since a subdomain would be invalid. People will just type invalid names in the input and the process will fail. I expect what Steven is describing is that if you're ordering a product with a reg/tran/own or sub, the value is stored in the domain field of tblhosting - regardless of which of the four types it is. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 22, 2021 Share Posted March 22, 2021 (edited) On 3/21/2021 at 6:10 AM, yggdrasil said: I'm not sure if I follow. If the domain field accepted subdomains this would cause tons of problems for people that need domains registered with the product since a subdomain would be invalid. People will just type invalid names in the input and the process will fail. But who said anything about registering a sub domain? There are the options to do domain transfers and registrations, correct? So the validation for those would go off just a the domain requirements. On 3/21/2021 at 6:10 AM, yggdrasil said: Now, if someone just wants a subdomain without a domain, then using the domain cart option is clearly wrong since that is designed for fully qualified domain names, which a subdomain is not. A fully qualified domain name, FQDN, is not just a domain but any hostname, domain, subdomain or basically an address that identifies a host. With that in mind, a FQDN isn't a domain as it requires both the host part and the domain part. Please see https://en.wikipedia.org/wiki/Fully_qualified_domain_name and https://kb.iu.edu/d/aiuv and https://techterms.com/definition/fqdn . On 3/21/2021 at 6:10 AM, yggdrasil said: What exactly are people looking here? Make sure a subdomain is valid? Or make sure a subdomain belongs to an existing domain already in WHMCS? Both cases could be achieved with hooks or extra code, WHMCS will not do this since its not that easy to validate a subdomain, people can literally just enter anything. I assume what people are asking here is for WHMCS to have some subdomain validation build in? That maybe checks if the domain exists in WHMCS or maybe checks if the domain is valid in terms of extension? You could also build that with hooks. It would require to load a list of valid extensions and then some regex making sure that people are using proper subdomains, then again what would someone consider the subdomain to be valid? Because something like this is also a valid subdomain: WHMCS doesn't need to validate a subdomain, why would it? It should not care if bob.example.com exists, doesn't exist, etc. The only thing perhaps is that the person signing up / setting up for that sub domain is the owner of the domain and that can be done with DNS verification like some services do. One reason to use a sub domain is if you're testing out a host or want to use a sub domain on one host, while you keep the domain at another host. On 3/21/2021 at 6:10 AM, yggdrasil said: How much nesting would you allow? Would to check the extension? If yes, what about people using subdomain as hostnames for server which might not require a valid domain name like host.local Why should it matter to the host what a sub domain is? Again as long as validation is done that the person signing up is the owner of that domain it is not a concern. Sub zoning in DNS can be an issue and so that is why that validation of ownership would be done. As for .local, then have a list blocking what TLD can be used. On 3/21/2021 at 9:19 AM, brian! said: well der, that was the point - it would be simpler (than any alternative I could think of) to get the information from the user and then adjust the values post validation. If that was the point then why was I the only one suggesting it? EDIT: My main point though is WHMCS should have a hook that overrides WHMCS"s domain validation. Edited March 22, 2021 by steven99 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted March 22, 2021 Share Posted March 22, 2021 1 hour ago, steven99 said: But who said anything about registering a sub domain? There are the options to do domain transfers and registrations, correct? So the validation for those would go off just a the domain requirements. A fully qualified domain name, FQDN, is not just a domain but any hostname, domain, subdomain or basically an address that identifies a host. With that in mind, a FQDN isn't a domain as it requires both the host part and the domain part. Please see https://en.wikipedia.org/wiki/Fully_qualified_domain_name and https://kb.iu.edu/d/aiuv and https://techterms.com/definition/fqdn . WHMCS doesn't need to validate a subdomain, why would it? It should not care if bob.example.com exists, doesn't exist, etc. The only thing perhaps is that the person signing up / setting up for that sub domain is the owner of the domain and that can be done with DNS verification like some services do. One reason to use a sub domain is if you're testing out a host or want to use a sub domain on one host, while you keep the domain at another host. Why should it matter to the host what a sub domain is? Again as long as validation is done that the person signing up is the owner of that domain it is not a concern. Sub zoning in DNS can be an issue and so that is why that validation of ownership would be done. As for .local, then have a list blocking what TLD can be used. If that was the point then why was I the only one suggesting it? EDIT: My main point though is WHMCS should have a hook that overrides WHMCS"s domain validation. FQDN is not a domain. Exactly !!! This is precisely what I said in my post. So why would you allow someone to enter it on the domain order form? They are completely different things. Should I let someone enter the domain order form something like? hostname.hostname.hostname.com For a server, absolutely. For a domain registration? No !!! Please take a look at what the original OP asked here: Quote want to be able to accept subdomains with 'use your own domain' for ordering a hosting product. You can already use subdomains for ordering hosting with WHMCS. But trying WHMCS to let people input invalid names in a domain order form is just wrong. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 22, 2021 Share Posted March 22, 2021 2 minutes ago, yggdrasil said: FQDN is not a domain. Exactly !!! This is precisely what I said in my post. So why would you allow someone to enter it on the domain order form? They are completely different things. Uh, you said an FQDN is a domain and WHMCS domain order forms are designed for that: On 3/21/2021 at 6:10 AM, yggdrasil said: Now, if someone just wants a subdomain without a domain, then using the domain cart option is clearly wrong since that is designed for fully qualified domain names, which a subdomain is not. Again, I am not talking about ordering a domain -- as in registering or transferring. If a person that owns example.com wants to use any.example.com on my service as their service "domain" while keeping example.com at another service, why should I care as long as they own that domain and it can be verified as such. Unlike some hosts, I don't require domain's to be registered with me or even have their nameservers pointed to mine as long as the DNS records are . But again my point to all of this is that WHMCS should allow hosts to override their validation if they wanted without having to have a custom field and duplicating info. 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted March 22, 2021 Share Posted March 22, 2021 (edited) You read it wrong. I was saying, the opposite this why I wrote in plural domain names. I was not referring to FQDN in that phrase but just domains as someone registering/transferring domain extensions. If we want to be that picky, a domain can mean anything, even in non technology, but I understand how someone would read that wording as FQDN which is not what I was stating, I use that term so much that I wrote fully qualified, and I see how its confusing maybe I should have rephrased differently like valid domain...I was stating that domain names are not hostnames or not FQDN's names. What is the problem you experience right now with using FQDN on ordering hosting or server products with WHMCS? This is absolutely possible today. You just need to uncheck the "Require Domain" on the product, and it will not ask for a domain name. Then just create a custom field to input the hostname, subdomain, FQDN, etc... You can even use regex in case you need to validate some input. If what you want is also letting them order a domain name, why not create the product without that option, create the custom field for the subdomain and then create a bundle and add the domain options? Users should be able to order with our without a domain name, and you can link directly to the bundle. And it also lets them order with a subdomain or hostname. The domain ordering is differently from hosting ordering. They are not tight together unless you check that option in your product configuration. Edited March 22, 2021 by yggdrasil 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 22, 2021 Share Posted March 22, 2021 38 minutes ago, yggdrasil said: Then just create a custom field to input the hostname, subdomain, FQDN, etc... We're going in a loop here and I'll just stop replying to this thread. 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted March 23, 2021 Share Posted March 23, 2021 (edited) 1 hour ago, steven99 said: We're going in a loop here and I'll just stop replying to this thread. Well good luck then. I have no problems doing orders with subdomains or hostnames. And I have no problems with people that want to order a domain with a hosting server or without one, or even ordering without a domain at all. I can even check if the subdomain belongs to a specific domain already if I want. You must be the only person with these issues since selling hosting with subdomains is something people do for ages with WHMCS. How else would they even sell VPS, cloud servers, etc... Edited March 23, 2021 by yggdrasil 0 Quote Link to comment Share on other sites More sharing options...
weba Posted March 23, 2021 Author Share Posted March 23, 2021 Thx for all thoughts and replies. Its clear to me there is not out-of-the-box validation 😉 I think I have to add another question like 'Use of subdomain of yourself' with the proper validation (check if it resolves and only give a warning in my case). 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted March 23, 2021 Share Posted March 23, 2021 (edited) 5 hours ago, weba said: Thx for all thoughts and replies. Its clear to me there is not out-of-the-box validation 😉 I think I have to add another question like 'Use of subdomain of yourself' with the proper validation (check if it resolves and only give a warning in my case). Not out of the box, but you can use regex in a custom field to validate a subdomain. One example: [A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])? If you need to use one that is already in the shopping cart of in the user account, I guess a hook could do that. But yes, it would require some changes and coding. Edited March 23, 2021 by yggdrasil 0 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.