Author Topic: Joining SMF Gallery Pro to Smf Shop  (Read 8773 times)

olandir

  • Guest
Re: Joining SMF Gallery Pro to Smf Shop
« Reply #15 on: May 29, 2007, 01:51:49 am »
Hey, just a follow up.

It looks like you forgot an end parenthesis in that code

Code: [Select]
updateMemberData($context['user']['id'], array('money' => 'money + ' . $points);
It looks like it should be

Code: [Select]
updateMemberData($context['user']['id'], array('money' => 'money + ' . $points));
Also I decided to use:

Code: [Select]
updateMemberData($ID_MEMBER, array('money' => 'money + ' . $points));
is there a reason why you use the $context instead of $ID_MEMBER?  This is purely a curiousity question because I'm still learning SMF coding structure.

Offline vbgamer45

Re: Joining SMF Gallery Pro to Smf Shop
« Reply #16 on: May 31, 2007, 09:34:31 pm »
Okay, it's pretty simple actually.

All you have to do is edit Gallery.php in your sources directory. Because Gallery.php is added in its entirety by the smfgallery mod, you can edit it and it won't mess you up if you need to uninstall it. (Just remember to go back and make the edits again when you upgrade) because smfgallery will wipe out the changes on an upgrade.

1) Find the AddPicture2 function

2) Look for this piece of code (it's near the end of the function)

Code: [Select]
//Last recheck Image if it was resized

3) Add this code in before it

Code: [Select]
// BEGIN SMFShop New Version (Build 12) code
$points = 10;
// Give the user their points
$result_shop = db_query("
UPDATE {$db_prefix}members
SET money = money + {$points}
WHERE ID_MEMBER = {$ID_MEMBER}
LIMIT 1", __FILE__, __LINE__);

// END SMFShop


Note the $points = 10, that's what tells the script how many points to add. So you can set it to any number

-----
Also you need to do this one other place. It's the exact same process

1) Find the BulkAdd2 function

2) Look for this piece of code (it's near the end of the function)

Code: [Select]
//Last recheck Image if it was resized

3) Add this code in before it

Code: [Select]
// BEGIN SMFShop New Version (Build 12) code
$points = 10;
// Give the user their points
$result_shop = db_query("
UPDATE {$db_prefix}members
SET money = money + {$points}
WHERE ID_MEMBER = {$ID_MEMBER}
LIMIT 1", __FILE__, __LINE__);

// END SMFShop


-----

Now your users will get points whether they do a regular add or a bulk add. Like I said, if you upgrade the smfgallery mod, it will more than likely completely overwrite the gallery script, so you'll need to be sure to apply these changes whenever you do that. But it's pretty straight forward.

Hope this helps. Let me know if something doesn't work.

If you would use this by default. I can add a setting in Gallery Lite/Pro to increase points for each image uploaded and allow you to specify the points amount. I can also have it remove points if the image is deleted.
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store