Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 201
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 204
Total: 205

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

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

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

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal