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: 297
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 269
Total: 269

Author Topic: Issuing Monthly credits - possible with SQL  (Read 2779 times)

0 Members and 1 Guest are viewing this topic.

Offline Puppeteer

  • Member
  • *
  • Posts: 23
    • View Profile
    • Godlike Productions
Issuing Monthly credits - possible with SQL
« on: February 03, 2016, 09:27:07 pm »
Hi,

In our forum we two have main classes of members.  We have "VAST Subscribers" and "Regular Members". We also offer the ability for users to buy download credits in packs of 100.

What we want to do is on a monthly basis, fill regular members to 10 credits (if they have less than 10 credits) and to fill VAST Subscribers to 100 credits (if they have less than 100).

Firstly, is this possible by running SQL commands, and if so what would be those commands (sorry SQL is definitely not my strong suit)?

Secondly, is it possible to automate those commands so they run on the first of the month, through CRON or some other mechanism?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Issuing Monthly credits - possible with SQL
« Reply #1 on: February 03, 2016, 10:06:40 pm »
Here is the script to do
You must edit the vast group id number. Then copy to root of your forum.
Setup a cron job to run the 1st of every month.

Code: [Select]
<?PHP
global $ssi_guest_access;
$ssi_guest_access = 1;
require(dirname(__FILE__) . '/SSI.php');

$groupIDVastmembers = 0;


$smcFunc['db_query']('', "UPDATE {db_prefix}members SET downpro_credits = 10 WHERE ID_GROUP = 0 AND downpro_credits < 10");

$smcFunc['db_query']('', "UPDATE {db_prefix}members SET downpro_credits = 100 WHERE ID_GROUP = $groupIDVastmembers AND downpro_credits < 100");

?>
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 Puppeteer

  • Member
  • *
  • Posts: 23
    • View Profile
    • Godlike Productions
Re: Issuing Monthly credits - possible with SQL
« Reply #2 on: February 03, 2016, 10:24:55 pm »
Thanks so much.

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
3587 Views
Last post February 20, 2008, 08:11:11 am
by akalsha
2 Replies
4328 Views
Last post July 19, 2012, 03:07:36 pm
by SMFHacks
7 Replies
6045 Views
Last post October 09, 2013, 07:12:49 pm
by elbeer
8 Replies
4986 Views
Last post September 20, 2015, 09:08:44 pm
by SMFHacks
3 Replies
3724 Views
Last post January 11, 2016, 08:12:59 pm
by SMFHacks

+- 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