sparky Posted June 2, 2009 Share Posted June 2, 2009 Here's another quick one that will hide the renew button in the clientarea if the AU domain is not within the 90 day renewal period. Open clientareadomaindetails.tpl and find <tr> {if $renew} above it insert this {php} $autlds = array("asn.au","com.au","edu.au","org.au","net.au","id.au"); $result = mysql_query("SELECT * FROM tbldomains WHERE id='".$this->_tpl_vars['domainid']."' AND userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) >= 90 AND status='Active'"); while ($data = mysql_fetch_array($result)) { foreach ($autlds as $xx) { $audomain = strstr($data['domain'], $xx); if ($audomain) break; } if ($audomain) $this->assign("renew", '0'); } {/php} 0 Quote Link to comment Share on other sites More sharing options...
arhost Posted June 2, 2009 Share Posted June 2, 2009 Will this mod also work with the UK domain names? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted June 2, 2009 Author Share Posted June 2, 2009 What is the rule for the UK domains for renewals and I can add it in 0 Quote Link to comment Share on other sites More sharing options...
djpete Posted June 3, 2009 Share Posted June 3, 2009 another great one Sparky 0 Quote Link to comment Share on other sites More sharing options...
arhost Posted June 3, 2009 Share Posted June 3, 2009 What is the rule for the UK domains for renewals and I can add it in Nominet allow renewals to be made up to six months in advance of the actual renewal date. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted June 3, 2009 Author Share Posted June 3, 2009 Nominet allow renewals to be made up to six months in advance of the actual renewal date. I don't know about UK domains. Is nominet the governing body for UK domains like AuDa is for AU domains? 0 Quote Link to comment Share on other sites More sharing options...
arhost Posted June 3, 2009 Share Posted June 3, 2009 I don't know about UK domains.Is nominet the governing body for UK domains like AuDa is for AU domains? Yes Nominet is the Internet registry for .uk domain names. 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted June 3, 2009 Share Posted June 3, 2009 Implemented this within 5 minutes. (4 of which was fixing my missing {/if}). Big tick 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted June 4, 2009 Share Posted June 4, 2009 What is the rule for the UK domains for renewals and I can add it in Like the 3 month rule for .au the rule for .uk is 6 months so within the php block add after your code $uktlds = array(".co.uk",".org.uk",".me.uk",".ltd.uk",".plc.uk",".net.uk"); $result = mysql_query("SELECT * FROM tbldomains WHERE id='".$this->_tpl_vars['domainid']."' AND userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) >= 180 AND status='Active'"); while ($data = mysql_fetch_array($result)) { foreach ($uktlds as $xx) { $ukdomain = strstr($data['domain'], $xx); if ($ukdomain) break; } if ($ukdomain) $this->assign("renew", '0'); } 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted June 4, 2009 Author Share Posted June 4, 2009 Thanks Rob... 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted June 4, 2009 Share Posted June 4, 2009 Adding the "active" check is one i'd not thought of - stops people renewing domains you've set as fraud/cancelled etc IMHO no need to check user, as you have the actual ID of the domain cycling through the tlds works for some extensions where the CC in the ccTLD is not at the end, but quicker is to just do ... $result = mysql_query("SELECT * FROM tbldomains WHERE id='".$this->_tpl_vars['domainid']."' AND DATEDIFF(expirydate, NOW()) >= 90 AND status='Active' AND domain like '%.au'"); while ($data = mysql_fetch_array($result)) { $this->assign("renew", '0'); } 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted June 4, 2009 Share Posted June 4, 2009 oh, and while we're sharing .... {if $renew}<td align=right> {php} // get smarty variables $domain and $nextduedate $domain = $this->get_template_vars('domain'); $duedate = explode("/",$this->get_template_vars('nextduedate')); $duedate = array($duedate[2], $duedate[1], $duedate[0]); $nextduedate=implode("-", $duedate); // find in tblinvoiceitems to see if invoiced $invoicequery = "SELECT * FROM tblinvoiceitems WHERE type='Domain' AND duedate ='".$nextduedate."' AND description LIKE 'Domain Renewal - ".$domain." -%';"; $invoiceresult = mysql_query($invoicequery); $invoicedalready = mysql_num_rows($invoiceresult); $renewalinvoice = 0; if ($invoicedalready >= 1) { $renewalinvoice = 1; } $this->assign('renewalinvoice',$renewalinvoice); {/php} <form method="post" action="{$smarty.server.PHP_SELF}?action={if $renewalinvoice}invoices{else}domainrenew{/if}"> <input type="hidden" name="domainid" value="{$domainid}"> <input type="submit" value="{$LANG.domainrenew}" class="button"> </form> </td> {/if} instead of the existing if will divert them to the invoice if it exists for the renewal rather than letting them create another one 0 Quote Link to comment Share on other sites More sharing options...
Business Hosting Online Posted June 28, 2009 Share Posted June 28, 2009 Thanx Rob, will go ahead and install this to resolve my .co.uk domain renewal, from another post. 0 Quote Link to comment Share on other sites More sharing options...
Austdata Posted July 7, 2009 Share Posted July 7, 2009 G'day Sparky & Rob, Is the code I've got this code so far okay? <p><strong> » {$LANG.domainmanagementtools}</strong></p> <table align="center"><tr> {php} $autlds = array("asn.au","com.au","edu.au","org.au","net.au","id.au"); $result = mysql_query("SELECT * FROM tbldomains WHERE id='".$this->_tpl_vars['domainid']."' AND userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) >= 90 AND status='Active'"); while ($data = mysql_fetch_array($result)) { foreach ($autlds as $xx) { $audomain = strstr($data['domain'], $xx); if ($audomain) break; } if ($audomain) $this->assign("renew", '0'); } $uktlds = array(".co.uk",".org.uk",".me.uk",".ltd.uk",".plc.uk",".net.uk"); $result = mysql_query("SELECT * FROM tbldomains WHERE id='".$this->_tpl_vars['domainid']."' AND userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) >= 180 AND status='Active'"); while ($data = mysql_fetch_array($result)) { foreach ($uktlds as $xx) { $ukdomain = strstr($data['domain'], $xx); if ($ukdomain) break; } if ($ukdomain) $this->assign("renew", '0'); } {/php} {if $renew}<td> But don't understand Smarty, etc. well enough to work out where that last bit goes. 0 Quote Link to comment Share on other sites More sharing options...
xeqution Posted May 31, 2010 Share Posted May 31, 2010 The code provided only works if the client is renewing there domain name via the management section, otherwise if a client was to visit this link: domain.com/whmcs/cart.php?gid=renewals -> looks like a section of php code will also need to be added to this page from preventing users from renewing domain names which cannot be renewed before a X amount of days. 0 Quote Link to comment Share on other sites More sharing options...
downunder Posted August 25, 2010 Share Posted August 25, 2010 (edited) For the /cart.php?gid=renewalswrite something like this in domainrenewals.tpl {* Set 'cantrenew' for the domain if the .au domain cant be renewed *} <code> {php} $autlds = array("asn.au","com.au","edu.au","org.au","net.au","id.au"); $renewalArray = $this->_tpl_vars['renewals']; $renewalsCopy = $renewalArray; for ($i = 0; $i < count($renewalArray); $i++) { $sql = "SELECT * FROM tbldomains WHERE id=".$renewalArray[$i]['id']." AND userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) >= 90 AND status='Active'"; $result = mysql_query($sql); while ($data = mysql_fetch_array($result)) { foreach ($autlds as $xx) { $audomain = strstr($data['domain'], $xx); if ($audomain) break; } if ($audomain){ // Can't renew this .au domain name $renewalsCopy[$i][cantrenew] = '1'; $this->append('renewals', $renewalsCopy,TRUE); } } } //echo '<PRE>'.print_r( $this->get_template_vars(renewals),1 ).'</PRE>'; {/php} </code> Then lower down in template: {if !$renewal.pastgraceperiod AND !$renewal.cantrenew} etc etc Edited August 25, 2010 by downunder fix code layout 0 Quote Link to comment Share on other sites More sharing options...
xeqution Posted September 9, 2010 Share Posted September 9, 2010 downunder - thanks for that, can you post the rest of it Then lower down in template: {if !$renewal.pastgraceperiod AND !$renewal.cantrenew} etc etc 0 Quote Link to comment Share on other sites More sharing options...
JimJ Posted October 23, 2010 Share Posted October 23, 2010 oh, and while we're sharing .... {if $renew}<td align=right> {php} // get smarty variables $domain and $nextduedate $domain = $this->get_template_vars('domain'); $duedate = explode("/",$this->get_template_vars('nextduedate')); $duedate = array($duedate[2], $duedate[1], $duedate[0]); $nextduedate=implode("-", $duedate); // find in tblinvoiceitems to see if invoiced $invoicequery = "SELECT * FROM tblinvoiceitems WHERE type='Domain' AND duedate ='".$nextduedate."' AND description LIKE 'Domain Renewal - ".$domain." -%';"; $invoiceresult = mysql_query($invoicequery); $invoicedalready = mysql_num_rows($invoiceresult); $renewalinvoice = 0; if ($invoicedalready >= 1) { $renewalinvoice = 1; } $this->assign('renewalinvoice',$renewalinvoice); {/php} <form method="post" action="{$smarty.server.PHP_SELF}?action={if $renewalinvoice}invoices{else}domainrenew{/if}"> <input type="hidden" name="domainid" value="{$domainid}"> <input type="submit" value="{$LANG.domainrenew}" class="button"> </form> </td> {/if} instead of the existing if will divert them to the invoice if it exists for the renewal rather than letting them create another one Thanks for this, but tried it and the link is always for the invoices page (renewal link is never built)? Double checked no invoices exist for the domain under any accounts. Using latest 4.3.1 version. Any ideas? Thanks 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.