Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43293
Total Topics: 7522
Most Online Today: 79
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 82
Total: 82

Author Topic: How to - change daily downloads to monthly  (Read 6075 times)

0 Members and 1 Guest are viewing this topic.

Offline elbeer

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 111
    • View Profile
How to - change daily downloads to monthly
« on: July 20, 2013, 05:07:13 am »
Hi guys, Great mod.

Is there any way I can change the quota of the downloads from 1 per day to say 1 per month or 2 per month.

Thanks.

Elbeer

Offline elbeer

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 111
    • View Profile
Re: How to - change daily downloads to monthly
« Reply #1 on: July 20, 2013, 05:36:51 am »
At a guess:


Change:

$last24hourstime = $currenttime  -  (1* 24 * 60 * 60);

to

$last24hourstime = $currenttime  -  (30* 24 * 60 * 60);

for 30 days

Offline elbeer

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 111
    • View Profile
Re: How to - change daily downloads to monthly
« Reply #2 on: July 20, 2013, 05:58:43 am »
Just to confirm that worked.

In Source/Downloads2.php

Change the above for monthly allowances.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16451
    • View Profile
Re: How to - change daily downloads to monthly
« Reply #3 on: July 20, 2013, 07:54:50 am »
Nice tip will be helpful for users looking for the same thing.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline elbeer

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 111
    • View Profile
Re: How to - change daily downloads to monthly
« Reply #4 on: October 08, 2013, 06:07:13 am »
Dont forget to update your file again if you upgrade to new system.


Offline elbeer

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 111
    • View Profile
Re: How to - change daily downloads to monthly
« Reply #5 on: October 09, 2013, 03:14:29 pm »
How can I change this $last24hourstime = $currenttime  -  (1* 24 * 60 * 60);

to be 30 days from the end date of the paypal subscription.

So if the end date was 30th november they can download x amount between 30th october and 30th november.


Table: smf_log_subscribed
end_time

Any help will be appreciated.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16451
    • View Profile
Re: How to - change daily downloads to monthly
« Reply #6 on: October 09, 2013, 03:16:51 pm »
This is one day right now
 $last24hourstime = $currenttime  -  (1* 24 * 60 * 60);

To 30 change to
 $last24hourstime = $currenttime  -  (30* 24 * 60 * 60);
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline elbeer

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 111
    • View Profile
Re: How to - change daily downloads to monthly
« Reply #7 on: October 09, 2013, 07:12:49 pm »
What I was trying to do was integrate it between paid subscription end date and 30 days before that.

This is what I came up with -

   // Get the end date of the subscription
global $smcFunc, $user_info;



$request = $smcFunc['db_query']('', '
  SELECT end_time
  FROM {db_prefix}log_subscribed
  WHERE id_member = {int:member}',
  array(
    'member' => $user_info['id'],
  )
);
if ($smcFunc['db_num_rows']($request) != 0)
{
  list ($result) = $smcFunc['db_fetch_row']($request);
}
else
  $result = false;
$smcFunc['db_free_result']($request);

$enddate=$result;


   // Find total downloads for the last 24 hours
   $currenttime = time();
   
   //$last24hourstime = $currenttime  -  (30* 24 * 60 * 60);

$last24hourstime= $enddate - (30*24*60 *60);


So if the subscription ends on 1st november it should in theory check the download count 30 days before this date.

I did have a conflict where someone had 2 subscriptions. I am not sure if the above will work can you confirm.

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
3596 Views
Last post February 20, 2008, 08:11:11 am
by akalsha
3 Replies
4178 Views
Last post September 15, 2011, 06:38:52 pm
by SMFHacks
2 Replies
4338 Views
Last post July 19, 2012, 03:07:36 pm
by SMFHacks
3 Replies
3762 Views
Last post January 11, 2016, 08:12:59 pm
by SMFHacks
2 Replies
991 Views
Last post November 20, 2022, 08:24:34 am
by Nicole

+- Recent Topics

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

Powered by EzPortal