Author Topic: Shop idea: staff gets paid  (Read 4750 times)

Offline Celdric

Shop idea: staff gets paid
« on: April 08, 2006, 12:55:46 am »
Well, may be someone requested it already. Actually only posting gets paid. Would be nice if staff members could earn a kind of weekly salary. I mean it's really a problem to find good staff, and may be that such a salary feature would be a help.  :)

Offline Basil Beard

Re: Shop idea: staff gets paid
« Reply #1 on: April 08, 2006, 01:01:22 am »
The way I have seen this done on other forums is to give each staff an item which can only be used once per day/once per week/however long want them to get their money. When they use the item, it gives them their salary but doesn't disappear.(You have to make a few changes to the shop.php code, namly removing the code that deletes the items after each use in order to do this. Of couse, when you do that you need to reinsert that same code at the end of all your other items that are supposed to be one. You also need another database column on the smf_shop_inventory to count when the item was last used.).

A cron job would be the other way, but im not experienced there. Plus making it item based encourages mods to be active. The mod can't go away for a month and add up loads of credits during their absence.
Arrrrr!

Offline Daniel15

Re: Shop idea: staff gets paid
« Reply #2 on: April 08, 2006, 09:07:57 am »
Quote
(You have to make a few changes to the shop.php code, namly removing the code that deletes the items after each use in order to do this.
Well, you don't really need to do that. See the 'Download a file' item for an example. This basically uses
Code: [Select]
die(); at the end of the onUse() function, which stops the Shop.php code to remove the item from running.

Although, if you still want to do it your way, here's the code to remove the item from the inventory:
Code: [Select]
            $result = db_query("DELETE FROM {$db_prefix}shop_inventory
                        WHERE id = {$_GET['id']}",
                        __FILE__, __LINE__); 

Quote
You also need another database column on the smf_shop_inventory to count when the item was last used
I'd suggest to put this field in the smf_members table, as it's unique to that member. Putting it in the smf_shop_inventory table might cause problems if I ever decide to change that table.

Quote
A cron job would be the other way, but im not experienced there. Plus making it item based encourages mods to be active. The mod can't go away for a month and add up loads of credits during their absence.
A cron job would be really easy to do (see the dointerest.php file for example), but I agree that they could go away for a month and get lots of credits.

Maybe, the cron job could add the credits only if they've logged in within the last 24 hours?

Offline Basil Beard

Re: Shop idea: staff gets paid
« Reply #3 on: April 08, 2006, 11:11:52 am »
We aren't supposed to change the smf_shop_inventory table around? Oops... I've added like three columns onto it already. Hopefully it wont cause any problems. =). Putting it in the smf_members table sounds like a good idea, but doesn't allow you to code other types of once per day items.

Also thanks for the information about the die() function. Seems alot better considering that most of my items are one use anyways.
Arrrrr!

Offline Daniel15

Re: Shop idea: staff gets paid
« Reply #4 on: April 08, 2006, 11:49:33 am »
Don't worry, you can change the smf_shop_inventory table, it hasn't changed since the first release of SMFShop back in December 2004, and probably never will :P

Maybe multiple-use items should be a new feature?

Offline Basil Beard

Re: Shop idea: staff gets paid
« Reply #5 on: April 09, 2006, 09:54:56 am »
That would be pretty cool. =).

As I said above, you can simply use the date() function after each use, saving it into dateused part of the smf_shop_inventory database. If you wanted to make it an offical feature, you could also have a "time period" which the user enters at the creation of the item(to allow for once per day, or once per hour, or items like that). It wouldn't be that hard to store the date() after each use, and then run an if date() - (dateused) > (time period) before the use of then item. That way it would be build into the smf_shop code itself instead of adding extra junky lines to the item codes.
Arrrrr!