Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4219
Latest: Toddie
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 42850
Total Topics: 7463
Most Online Today: 96
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 48
Total: 49

Author Topic: How to - change daily downloads to monthly  (Read 5311 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: 16256
    • 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: 16256
    • 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
2995 Views
Last post February 20, 2008, 08:11:11 am
by akalsha
3 Replies
3346 Views
Last post September 15, 2011, 06:38:52 pm
by SMFHacks
2 Replies
3387 Views
Last post July 19, 2012, 03:07:36 pm
by SMFHacks
3 Replies
3068 Views
Last post January 11, 2016, 08:12:59 pm
by SMFHacks
2 Replies
203 Views
Last post November 20, 2022, 08:24:34 am
by Nicole

+- Recent Topics

Question on Completed Listing & Reserve Price by SMFHacks
May 31, 2023, 01:43:19 pm

[Mod]GDPR Helper by Nicole
May 29, 2023, 11:58:49 pm

RSS Feed Poster Database Error by SMFHacks
May 22, 2023, 06:26:18 pm

Errors With Older Version. by Ken.
May 09, 2023, 05:35:40 pm

Pretty Urls SEO Pro by SMFHacks
May 06, 2023, 03:30:11 pm

New Post Image Upload Error by Mike66
April 28, 2023, 07:30:28 am

Copyright Removal Key by SMFHacks
April 03, 2023, 02:44:28 pm

Converting from Aeva Media by sudhakar
April 02, 2023, 11:09:54 am

Using SMF's Built-in Search Algorithm by shuban
March 27, 2023, 09:15:10 am

Permissions query by davejo
March 26, 2023, 04:43:48 am

Powered by EzPortal