NH-Andrew Posted February 26, 2008 Share Posted February 26, 2008 Can we change the way the date of expiry is displayed? Currently it's in the form YYYY-MM-DD I'd prefer DD/MM/YYYY as that's how we have it in the rest of the client area. Thanks. 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted March 2, 2008 Share Posted March 2, 2008 To do 30 days and 60 days just change the function from "m"+1/2 to "d"+30/60 not showing domains already invoiced for the renewal of is a little trickier, but a worthwhile mod to this useful contribution 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted March 2, 2008 Share Posted March 2, 2008 actually if it used the date from the WHMCS config rather than coded to be 30 ... 0 Quote Link to comment Share on other sites More sharing options...
Si Posted March 2, 2008 Share Posted March 2, 2008 To do 30 days and 60 days just change the functionfrom "m"+1/2 to "d"+30/60 Hi, Intrigued by your post, but can't get it to work. Could you quote exactly what these 2 lines should be changed to for your suggestion to work please? $date30 = date("Ymd",mktime(0,0,0,date("m")+1,date("d"),date("Y"))); $date60 = date("Ymd",mktime(0,0,0,date("m")+2,date("d"),date("Y"))); I tried: $date30 = date("Ymd",mktime(0,0,0,date("d")+30,date("d"),date("Y"))); $date60 = date("Ymd",mktime(0,0,0,date("d")+60,date("d"),date("Y"))); with no success Thanks Si 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted March 2, 2008 Share Posted March 2, 2008 Oh I expected you to do a *liitle* of the work try ... $date30 = date("Ymd",mktime(0,0,0,date("m"),date("d")+30,date("Y"))); $date60 = date("Ymd",mktime(0,0,0,date("m"),date("d")+60,date("Y"))); 0 Quote Link to comment Share on other sites More sharing options...
Dominic Posted March 2, 2008 Share Posted March 2, 2008 Has nobody heard of the excellent MySQL date functions :( ...AND DATEDIFF(expirydate, NOW()) <= X Where X is the number of days 0 Quote Link to comment Share on other sites More sharing options...
ask21900 Posted March 3, 2008 Share Posted March 3, 2008 Has nobody heard of the excellent MySQL date functions :( ...AND DATEDIFF(expirydate, NOW()) <= X Where X is the number of days I'm pretty sure that is a sql date function (for sql datatypes). If you were using sql dates that would be great, but we are using php (unix) time. 0 Quote Link to comment Share on other sites More sharing options...
Dominic Posted March 3, 2008 Share Posted March 3, 2008 I'm pretty sure that is a sql date function (for sql datatypes). If you were using sql dates that would be great, but we are using php (unix) time. `expirydate` date default NULL mysql> select * from tbldomains where DATEDIFF(expirydate, NOW()) <= 45; ... 146 rows in set (0.00 sec) 0 Quote Link to comment Share on other sites More sharing options...
Dominic Posted March 3, 2008 Share Posted March 3, 2008 not showing domains already invoiced for the renewal of is a little trickier, but a worthwhile mod to this useful contribution SELECT * FROM tbldomains WHERE DATEDIFF(expirydate, NOW()) <= 45 AND id NOT IN (SELECT relid FROM tblinvoiceitems t1 INNER JOIN tblinvoices t2 ON t1.invoiceid = t2.id WHERE t1.type = 'Domain' AND t2.status != 'Paid') Briefly tested only but seems to do the job 0 Quote Link to comment Share on other sites More sharing options...
Dominic Posted March 3, 2008 Share Posted March 3, 2008 I'm not sure about returning within a certain date range (such as between 30 and 60 days). Maybe someone can post a modified version of the SQL to return domains within a specific range. select * from tbldomains where DATEDIFF(expirydate, NOW()) BETWEEN 30 AND 60; 0 Quote Link to comment Share on other sites More sharing options...
RPS Posted March 3, 2008 Author Share Posted March 3, 2008 Dominic, Thanks! Here's the new script using Dominic's code for the date. I have added comments that set the range variable. So if you want to use a range between 30 and 60, uncomment the line that says //$range = "BETWEEN 30 AND 60"; {php} $display_domain=0; $result = mysql_query("SELECT * FROM tbldomains WHERE userid = ".$_SESSION['uid']." AND status = 'Active' LIMIT 1"); while($data = mysql_fetch_array($result)) { $display_domain=1; } if($display_domain){ {/php} <p><strong>Upcoming Domain Renewals</strong></p> <table align="center" style="width:90%" class="clientareatable" cellspacing="1"> <tr class="clientareatableheading"><td>Domain</td><td>Expiration Date</td><td></td></tr> {php} $i=1; $range = "<= 30"; //$range = "<= 45"; //$range = "<= 60"; //$range = "BETWEEN 15 AND 60"; //$range = "BETWEEN 30 AND 60"; $result = mysql_query("SELECT * FROM tbldomains WHERE userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) ".$range." AND status='Active' ORDER BY `expirydate` ASC "); while($data = mysql_fetch_array($result)) { echo '<tr class="clientareatableactive"><td>'.$data['domain'].'</td><td>'.$data['expirydate'].'</td><td><form method="post" action="clientarea.php?action=domainrenew"><input name="domainid" value="'.$data['id'].'" type="hidden"><input value="Renew Domain" class="button" type="submit"></form></td></tr>'; $i=0; } if($i)echo '<tr class="clientareatableactive"><td colspan="2">No upcoming domain renewals</td><td><a href="clientarea.php?action=domains">View Domains</a></td></tr>'; {/php} </table> {php} } {/php} 0 Quote Link to comment Share on other sites More sharing options...
ask21900 Posted March 3, 2008 Share Posted March 3, 2008 `expirydate` date default NULL mysql> select * from tbldomains where DATEDIFF(expirydate, NOW()) <= 45; ... 146 rows in set (0.00 sec) I guess that is what I get for not looking at the DB... I was just going off the code that I originally modified... 0 Quote Link to comment Share on other sites More sharing options...
NH-Andrew Posted March 7, 2008 Share Posted March 7, 2008 Can we change the way the date of expiry is displayed? Currently it's in the form YYYY-MM-DD I'd prefer DD/MM/YYYY as that's how we have it in the rest of the client area. Thanks. No one? 0 Quote Link to comment Share on other sites More sharing options...
RPS Posted March 7, 2008 Author Share Posted March 7, 2008 This code will display the date correctly, as per the setting in WHMCS. {php} $display_domain=0; $result = mysql_query("SELECT * FROM tbldomains WHERE userid = ".$_SESSION['uid']." AND status = 'Active' LIMIT 1"); while($data = mysql_fetch_array($result)) { $display_domain=1; } if($display_domain){ {/php} <p><strong>Upcoming Domain Renewals</strong></p> <table align="center" style="width:90%" class="clientareatable" cellspacing="1"> <tr class="clientareatableheading"><td>Domain</td><td>Expiration Date</td><td></td></tr> {php} $i=1; $range = "<= 30"; //$range = "<= 45"; //$range = "<= 60"; //$range = "BETWEEN 15 AND 60"; //$range = "BETWEEN 30 AND 60"; $result = mysql_query("SELECT * FROM tbldomains WHERE userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) ".$range." AND status='Active' ORDER BY `expirydate` ASC "); while($data = mysql_fetch_array($result)) { echo '<tr class="clientareatableactive"><td>'.$data['domain'].'</td><td>'.fromMySQLDate($data['expirydate']).'</td><td><form method="post" action="clientarea.php?action=domainrenew"><input name="domainid" value="'.$data['id'].'" type="hidden"><input value="Renew Domain" class="button" type="submit"></form></td></tr>'; $i=0; } if($i)echo '<tr class="clientareatableactive"><td colspan="2">No upcoming domain renewals</td><td><a href="clientarea.php?action=domains">View Domains</a></td></tr>'; {/php} </table> {php} } {/php} 0 Quote Link to comment Share on other sites More sharing options...
HostRW Posted March 7, 2008 Share Posted March 7, 2008 Hello RPS an thank you for coming up with this great addition! Also thank you to the others that have contributed to it. I have added this to my template files and it seems to be working great and it looks really good. There is only one problem. Not sure if anyone thought of that... The text is in English only as it is not integrated into the language file. In other languages this box shows in English. RPS, could you suggest some way to add this into the language file? Not sure if that would have to be done in cooperation with Matt though to avoid later problems... 0 Quote Link to comment Share on other sites More sharing options...
RPS Posted March 7, 2008 Author Share Posted March 7, 2008 I think it is better leaving it out of the language file. If enough people use this, Matt will simply include it into WHMCS. You may want to submit a ticket into WHMCS and ask them how to add a language variable to a page on your template. Don't specifically mention this mod, just ask in general. 0 Quote Link to comment Share on other sites More sharing options...
ask21900 Posted March 7, 2008 Share Posted March 7, 2008 All you have to do is add another key->value to the array, and call it 0 Quote Link to comment Share on other sites More sharing options...
NH-Andrew Posted March 8, 2008 Share Posted March 8, 2008 This code will display the date correctly, as per the setting in WHMCS. {php} $display_domain=0; $result = mysql_query("SELECT * FROM tbldomains WHERE userid = ".$_SESSION['uid']." AND status = 'Active' LIMIT 1"); while($data = mysql_fetch_array($result)) { $display_domain=1; } if($display_domain){ {/php} <p><strong>Upcoming Domain Renewals</strong></p> <table align="center" style="width:90%" class="clientareatable" cellspacing="1"> <tr class="clientareatableheading"><td>Domain</td><td>Expiration Date</td><td></td></tr> {php} $i=1; $range = "<= 30"; //$range = "<= 45"; //$range = "<= 60"; //$range = "BETWEEN 15 AND 60"; //$range = "BETWEEN 30 AND 60"; $result = mysql_query("SELECT * FROM tbldomains WHERE userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) ".$range." AND status='Active' ORDER BY `expirydate` ASC "); while($data = mysql_fetch_array($result)) { echo '<tr class="clientareatableactive"><td>'.$data['domain'].'</td><td>'.fromMySQLDate($data['expirydate']).'</td><td><form method="post" action="clientarea.php?action=domainrenew"><input name="domainid" value="'.$data['id'].'" type="hidden"><input value="Renew Domain" class="button" type="submit"></form></td></tr>'; $i=0; } if($i)echo '<tr class="clientareatableactive"><td colspan="2">No upcoming domain renewals</td><td><a href="clientarea.php?action=domains">View Domains</a></td></tr>'; {/php} </table> {php} } {/php} Wonderful, thank you very much! 0 Quote Link to comment Share on other sites More sharing options...
vinbase Posted March 17, 2008 Share Posted March 17, 2008 Beautiful script! Thank You 0 Quote Link to comment Share on other sites More sharing options...
rldev Posted April 2, 2008 Share Posted April 2, 2008 Here's the problem.. When clients receive an e-mail to renew their domain (ours is set to e-mail 45 days prior to expiration), the link in the e-mail takes the client directly to the client area. The client then needs to navigate to the domain renewal button by clicking "My Domains" -> "View Details" next to the domain name -> Scroll down to bottom and click "Renew Domain" Pretty easy for someone who knows where they are looking, but incredibly frustrating for a client that barely knows how to login. The following code will display on the Client Area homepage, right below where the unpaid invoice section appears. Open: whmcs/templates/default/clientareahome.tpl whmcs/templates/portal/clientareahome.tpl At the end of the file, add: <p><strong>Upcoming Domain Renewals</strong></p> <table align="center" style="width:90%" class="clientareatable" cellspacing="1"> <tr class="clientareatableheading"><td>Domain</td><td>Expiration Date</td><td></td></tr> {php} $year=date("Y"); $month=date("m")+2; $day=date("d"); if($month>="12"){$month="02";$year+=1;} if($month!="12"){$month="0".$month;} $date=$year."-".$month."-".$day; $i=1; $result = mysql_query("SELECT * FROM tbldomains WHERE userid='".$_SESSION['uid']."' AND expirydate<'".$date."' AND status='Active' ORDER BY `expirydate` ASC "); while($data = mysql_fetch_array($result)) { echo '<tr class="clientareatableactive"><td>'.$data['domain'].'</td><td>'.$data['expirydate'].'</td><td><form method="post" action="clientarea.php?action=domainrenew"><input name="domainid" value="'.$data['id'].'" type="hidden"><input value="Renew Domain" class="button" type="submit"></form></td></tr>'; $i=0; } {/php} {php} if($i)echo '<tr class="clientareatableactive"><td colspan="2">No upcoming domain renewals</td><td><a href="clientarea.php?action=domains">View Domains</a></td></tr>'; {/php} </table> The script will return all domains that are due to expire within 2 months. Now when a client follows the link in their domain renewal email notice, they will be presented with a page that contains all of the domains that they can renew. Is this based on the domain expiration date or next due date? 0 Quote Link to comment Share on other sites More sharing options...
RPS Posted April 2, 2008 Author Share Posted April 2, 2008 Uses the expiry date. 0 Quote Link to comment Share on other sites More sharing options...
rldev Posted April 2, 2008 Share Posted April 2, 2008 It is a great addition. Thank you. 0 Quote Link to comment Share on other sites More sharing options...
iPwebGroup Posted May 10, 2008 Share Posted May 10, 2008 Thank you very much for your efforts. This mod is a great addition and much appreciated. Best regards to all. Andreas 0 Quote Link to comment Share on other sites More sharing options...
scarson Posted May 13, 2008 Share Posted May 13, 2008 Thanks for the fabulous contribution. What a life saver! 0 Quote Link to comment Share on other sites More sharing options...
pooprscooper Posted May 21, 2008 Share Posted May 21, 2008 Thank you RPS. 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.