diff --git a/interface/lib/classes/tools_sites.inc.php b/interface/lib/classes/tools_sites.inc.php
index b2881f57cc7e28a96554b8f585d17873100035fe..4ff2b4c75c142c19d450b756fcc6f49fd3ba24b9 100644
--- a/interface/lib/classes/tools_sites.inc.php
+++ b/interface/lib/classes/tools_sites.inc.php
@@ -145,9 +145,13 @@ class tools_sites {
}
/* TODO: rewrite SQL */
- function getDomainModuleDomains($not_used_in_table = null, $selected_domain = null) {
+ function getDomainModuleDomains($not_used_in_table = null, $selected_domain = '') {
global $app;
+ // Fix a null value passed in by the create new forms, which lack an id.
+ if ($selected_domain == null) {
+ $selected_domain = '';
+ }
$sql = "SELECT domain_id, domain FROM domain WHERE";
if ($not_used_in_table) {
if (strpos($not_used_in_table, 'dns') !== false) {
diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index 90e2fef1c46935ae47968f376d659b0a27cc90d5..defaad861804b49c988a6918c1a24bbd888df5dd 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -196,7 +196,7 @@ if ($domains_settings['use_domain_module'] == 'y') {
/*
* The domain-module is in use.
*/
- $domains = $app->tools_sites->getDomainModuleDomains("dns_soa", 'domain');
+ $domains = $app->tools_sites->getDomainModuleDomains("dns_soa");
$domain_select = "";
if(is_array($domains) && sizeof($domains) > 0) {
/* We have domains in the list, so create the drop-down-list */
diff --git a/interface/web/sites/web_childdomain_edit.php b/interface/web/sites/web_childdomain_edit.php
index 019057b3bead2028605db6bc077ee1d5cfb7fc8f..3f2726a040bc56476cc8362b553907e426843b64 100644
--- a/interface/web/sites/web_childdomain_edit.php
+++ b/interface/web/sites/web_childdomain_edit.php
@@ -105,7 +105,7 @@ class page_action extends tform_actions {
/*
* The domain-module is in use.
*/
- $domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain");
+ $domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord['domain']);
$domain_select = "";
$selected_domain = '';
if(is_array($domains) && sizeof($domains) > 0) {
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index 365582e9af521000402bda028a0a8199cebcc276..e9e1ef602e0d69dc1574064df5e1efc07e1a7a1f 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -694,7 +694,8 @@ class page_action extends tform_actions {
/*
* The domain-module is in use.
*/
- $domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain");
+ $domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord['domain']);
+
$domain_select = "";
$selected_domain = '';
if(is_array($domains) && sizeof($domains) > 0) {