Jump to content

Add "Upcoming Domain Renewals" to client area


RPS

Recommended Posts

  • 4 weeks later...
  • Replies 87
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • 5 weeks later...

Nikos, if you change the SQL query in the code to this:

 

mysql_query("SELECT *, DATE_FORMAT(expirydate, '%d/%m/%Y') AS fdate FROM tbldomains WHERE userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) ".$range." AND status='Active' ORDER BY `expirydate` ASC ");

 

Then where it outputs the result, change the date part to this:

 

'.$data['fdate'].'

 

This should the output the date in format you require. Alternatively you can change the SQL query part '%d/%m/%Y if you want to display it differently.

 

Changing the date in the WHMCS config page will make no difference to this date.

 

Hope this helps.

Link to comment
Share on other sites

  • 3 weeks later...
  • 5 weeks later...
  • 5 months later...

Check the line that reads: $date=$year."-".$month."-".$day;

 

Notice the variables? You can change the position of the variables, as well as change the dash - to a forwardslash /

 

You can also replace the word year with month, and month with year, so it will display as month - year - day. Any format you want.

Link to comment
Share on other sites

Check the line that reads: $date=$year."-".$month."-".$day;

 

Notice the variables? You can change the position of the variables, as well as change the dash - to a forwardslash /

 

You can also replace the word year with month, and month with year, so it will display as month - year - day. Any format you want.

 

sorted 8)

thank you

Link to comment
Share on other sites

sure can show but if you can see a better way as code is not my stong point.

just changed font size and colour and added image in this part of code.

<p><img src="images/domains.gif" border="0" hspace="5" align="absmiddle" alt="" /><font color="FF0000"><font size="4"><strong>Upcoming Domain Renewals</strong></font></font size></p>

 

Full working code

{php}
$display_domain=0;
$result = mysql_query("SELECT *, DATE_FORMAT(expirydate, '%d/%m/%Y') AS fdate FROM tbldomains WHERE userid='".$_SESSION['uid']."' AND DATEDIFF(expirydate, NOW()) ".$range." AND status='Active' ORDER BY `expirydate` ASC ");
while($data = mysql_fetch_array($result))
{
   $display_domain=1;
}

if($display_domain){
{/php}
<p><img src="images/domains.gif" border="0" hspace="5" align="absmiddle" alt="" /><font color="FF0000"><font size="4"><strong>Upcoming Domain Renewals</strong></font></font size></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 = $result = mysql_query("SELECT *, DATE_FORMAT(expirydate, '%d/%m/%Y') AS fdate 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['fdate'].'</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}

 

screen capture of client account added

domain.jpg

Link to comment
Share on other sites

I think there is something wrong with this.

As it doesn't show the message... "There are no upcoming domain renewals"

 

So the entire Table is ommitted.

 

p.s. is it meant to be:

 

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>';

 

or:

 

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>'; }

 

???

 

Thanks!

 

   {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 = "<= 28";

                   // 28 = 4 wks || 42 = 6 wks || 56 = 8wks.
                   //$range = "<= 42";
                   //$range = "<= 56";
                   //$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 Domain Names</a></td></tr>'; 

   {/php}
           </table>

       {php}
                   }
       {/php}

Link to comment
Share on other sites

  • 1 month later...
{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}
<h2>Upcoming Domain Renewals</h2>
<table width="100%" border="0" align="center" cellpadding="10" cellspacing="0" class="data">
<tr><th>Domain</th><th>Expiration Date</th><th></th></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><td colspan="2">No upcoming domain renewals</td><td><a href="clientarea.php?action=domains">View Domains</a></td></tr>';
{/php}
</table>
{php}
}
{/php}  

Link to comment
Share on other sites

  • 4 months later...
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}

 

This Code is absolutly EXCELLENT!!!!

 

Thank you very much.

 

I have no knowledge in coding at all, and my eyes are boggling at the moment at all of this, however I am trying to learn.

 

Can someone please help me out on the following???

 

  1. Can we change it to show domains from 90 days down to 30 days, with having the renew button there for people to renew the domain right now?
  2. Once 30 days comes, how can I setup WHMCS to automatically generate a new invoice for the domain for customers to pay?
  3. Once this 30 days has reached, is it possible for the Renew button to change to pay invoice, and then the invoice that was created in the above point, is brough up by clicking on the Pay Invoice?

 

I know I may be asking alot, but I am sure others would like this.

 

I am only new, and trying to learn, and in my code i even managed to put the little domain logo before the words Upcoming Domain Renewals, and I was impressed i got that right.

 

Thanks heaps guys, one day I hope I can help people like you do :):):):)

Link to comment
Share on other sites

 

  1. Once 30 days comes, how can I setup WHMCS to automatically generate a new invoice for the domain for customers to pay?
     

 

 

I believe this is 'Default Auto Renewal Setting' in the Domains tage of General Settings. Make sure it's switched on and an invoice will automatically be generated, if the client has set auto renew to on in their profile.

 

  1. Once this 30 days has reached, is it possible for the Renew button to change to pay invoice, and then the invoice that was created in the above point, is brough up by clicking on the Pay Invoice?

 

This would be an excellent addition. Currently if the invoice is already generated (ours generate 15 days before) it is still possible for a customer to renew. Perhaps a more simple mod would be to somehow disable the renew button if auto-renew is set, to avoid the likelyhood of someone renewing AND paying the auto generated invoice?

 

Fantastic script by the way, many thanks!

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.

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