Ads below are only shown to Non-Members. Join Today!
Non-Members viewing ads help a good cause!

I wanted to add the ability award poster points

Anything, almost anything at all
(even advertisement if it's decent, spammers will be banned)
Post Reply
User avatar
tim
Administrator
Posts: 1108
Joined: 25 Sep 2016, 17:16
Cash on hand: 609.84 GLP
Bank: 389.25 GLP
Gender: Guy
Location: Victoria, BC
Website: http://gimplearn.com
x 256
x 34
Contact:
Canada

#1 I wanted to add the ability award poster points

Post by tim » 1 week 1 day ago

In the Ultimate Points extension.
Users can pay a certain number of points for downloading but those points are just taken away and not stored anywhere.
I wanted to add those points to the attachment poster's account.
So this is what i did.
in ext/dmzx/ultimatepoints/event/listener.php file
I found a method called
public function download_file_send_to_browser_before($event)
I added the line

Code: Select all

$poster_id = (int) $event['attachment']['poster_id'];
in the beginning of method
Then right below

Code: Select all

$this->functions_points->substract_points($this->user->data['user_id'], $forum_cost);
I added the below code

Code: Select all

#added by Tin Tran to reward poster with points.
$this->functions_points->add_points($poster_id, $forum_cost);
So that's good I tested and it works.
0 x


aka Tin
bakon.ca - GIMP LEARN forum Where we can all learn from each other

User avatar
tim
Administrator
Posts: 1108
Joined: 25 Sep 2016, 17:16
Cash on hand: 609.84 GLP
Bank: 389.25 GLP
Gender: Guy
Location: Victoria, BC
Website: http://gimplearn.com
x 256
x 34
Contact:
Canada

#2 Re: I wanted to add the ability award poster points

Post by tim » 1 week 13 hours ago

I have changed this so that now
If you're logged in and have enough points it'll transfer 10 points to the poster (per download).
If you're not logged in or don't have enough points, you'll just download the file with no points transferred.
0 x


aka Tin
bakon.ca - GIMP LEARN forum Where we can all learn from each other

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests