Jump to content

Additional Domain Tickbox Fields in Admin


zstergios

Recommended Posts

A known bug in previous versions of WHMCS 5.2.x-6.1.1 (is solved on 6.2.2) is the Tickbox is not being un-ticked if was previously ticked.

 

Create a php hook file at /includes/hooks and place inside

 

<?php
if(!defined("WHMCS")) die("This file cannot be accessed directly");
/*
Fix the Additional Domain Field Tickbox UNCheck on Admin
Web-expert.gr
Stergios Zgouletas
*/
function fields_AdminClientDomainsTabFieldsSave($vars){
global $CONFIG;
	list($version,$release)=explode('-',$CONFIG['Version']);	
if(version_compare($version,'6.2.0')>=0) return;
list($sld,$tld)=explode('.',$vars['domain'],2);
require (ROOTDIR.'/includes/additionaldomainfields.php');
if(isset($additionaldomainfields[".".$tld])){
	foreach($additionaldomainfields[".".$tld] as $idx=>$field){
		if($field["Type"] == "tickbox" && !isset($vars['domainfield'][$idx])){
			$row=@mysql_fetch_array(mysql_query("SELECT id FROM `tbldomainsadditionalfields` WHERE domainid=".(int)$vars['id']." AND name='".$field['Name']."' LIMIT 0,1;"),MYSQL_ASSOC);
			mysql_query("UPDATE `tbldomainsadditionalfields` SET `value`='' WHERE `id`=".$row['id']." AND `domainid`=".(int)$vars['id'].";");
		}
	}
}
}
add_hook('AdminClientDomainsTabFieldsSave',99, 'fields_AdminClientDomainsTabFieldsSave');

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.

×
×
  • 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