PDA

View Full Version : [Addon]Download Credit System with uCash


Deaths
03-28-2005, 10:00 PM
Requested by some people, so here it is!
Basicly the name says it, its an addon for tnguy3n's hack "Download Credit System".

There was a small typo in the install file, if you downloaded before 4-5-2005, please redownload, and redo the edits to attachment.php and newattachment.php!
The install file contains all the info you need.

Stats:

0 Queries executed
4 File edits.
1 template edit.


Enjoy!

Download Credit System may be found here: https://vborg.vbsupport.ru/showthread.php?goto=newpost&t=78953

An addon to this addon can be found here: HACK MODIFICATION - "PAY" POINTS IN SPECIFIC FORUMS INSTEAD OF PLAIN SUBTRACTION (https://vborg.vbsupport.ru/showthread.php?p=650271#post650271)

moley
03-29-2005, 12:05 PM
thanks alot for this.

Deaths
03-29-2005, 12:20 PM
No problem ;)

BigIke
03-29-2005, 07:31 PM
Deaths does it again. Thanks for the addon

Stifler
03-30-2005, 01:23 AM
very nice Deaths Thanks!

This addon requires uCash, but does it also require the download credit thing already installed? or is this just a modified version of it? thanks again!

Deaths
03-30-2005, 06:53 AM
My pleasure everyone :).

This hack requires the download credit hack aswell, as this is just an addon.

PixelFx
03-30-2005, 07:31 AM
This looks great my only concern is that the image links for attachment images didn't work on the other forum. The ucash addon looks great though.

Deaths
03-30-2005, 07:43 AM
Ok, I'll look into the images now :).

Please click install if you use this hack btw :D

VBUsers
04-04-2005, 09:42 AM
ok thanks death this is a great add on but for some reason it doesnt subtract the points from the member once i download something. if you can try and test it for me on my forum ide appreciate it.

www.lowandloud.com

name: test

pass: testing

i did all the changes in your install zip so i dont see the issue. thank ahead of time for your help

Deaths
04-04-2005, 09:56 AM
Hmm, very strange.

Did it work without my hack?

PS Your skin isn't showing up correctly in firefox ;)

VBUsers
04-04-2005, 10:01 AM
Hmm, very strange.

Did it work without my hack?

PS Your skin isn't showing up correctly in firefox ;)

i really didnt check to see if it was working . i installed it cause of your add on. i have ucash/ushop and only wanted it for that intergration. so as soon as i installed it i did your add on. everything else works just the subtraction part of the hack is off.

oh and im not sure how to fix the firefox issue. sorry not there yet lol

Deaths
04-04-2005, 10:03 AM
Try checking if you haven't made a mistake in the configuration.

VBUsers
04-04-2005, 10:07 AM
Try checking if you haven't made a mistake in the configuration.

Download Credit System mode ON

Credit Per Thread 2
Credit(s) user earns for a new thread?
Credits Per Post 1
Credit(s) user earns per post
Credit Per Attachment 3
Credits user earns for each attachment/upload.
Attachment Download Cost 4
How many credits each attachment download costs?
Cost For Owning Pet 100
How many credits does a pet cost? (Only works if you have pet system installed your board)


everything else is blank

lasto
04-04-2005, 10:14 AM
u using ushop aint ya ?

try using it without this addon m8 as it does work.

VBUsers
04-04-2005, 10:18 AM
u using ushop aint ya ?

try using it without this addon m8 as it does work.

so the hack works with out this addon ?? with ushop???

lasto
04-04-2005, 10:20 AM
yeah the hack works fine (just needs a little tyding up by the author but u can update it when he releases v2)

VBUsers
04-04-2005, 10:39 AM
yeah the hack works fine (just needs a little tyding up by the author but u can update it when he releases v2)


well i did the hack and now in my test account which i have 23 points. i tried to download a 4 point download and it told me i didnt have enough points.lol either way it doesnt work lol deaths was the closest one. can you guys just tell me what code subtracts from the points that i curently have when i download an item?

lasto
04-04-2005, 10:42 AM
well afraid to tell you then the problem lies on your side as when the hack was released i tested it on a blank board and never had a problem like that.
Th hack always takes the points and the only problem i had was it actually charged the user who uploaded the attachment to download his own attachment.

Deaths
04-04-2005, 10:57 AM
This addon is tested and confirmed working aswell, I guess it just doesnt work on some boards oO.

VBUsers
04-04-2005, 07:11 PM
ok i guess ill try to figure it out on my own ... thanks for the testing guys

VBUsers
04-04-2005, 07:25 PM
this is what i have for the attatchment.php edit. at the bottom is the only similar code that i have to the one you say i have to edit. is this correct?



// Begin Download Credit System
if($vboptions['credit_mode'])
{
// quick check for exceptional groups not restricted by this credit system
if(!in_array($bbuserinfo['usergroupid'], explode(',', $vboptions['credit_noapplied'])))
{
if($bbuserinfo['userid'] != $attachmentinfo['userid'])
{
$usercredits = $bbuserinfo['credits'];
$cost = $vboptions['credit_cost'];
if(($usercredits < $vboptions['credit_cost']))
{
eval(print_standard_error('error_notenuffcredits') );
}
else
{
$DB_site->query_first("UPDATE " . TABLE_PREFIX . "user
SET credits = credits - $cost
WHERE userid = $bbuserinfo[userid]
");
}
}
}
}
// End Download Credit System
if ($attachment['postid'] == 0 AND $bbuserinfo['userid'] == $attachmentinfo['userid'])

VBUsers
04-04-2005, 07:28 PM
and this one is for the newattatchemnt.php im not sure if this is correct either. if theres anything you can help me with ide appreciate it. or is it that this addon isnt going to work for my obard?


eval('$parentattach .= "' . fetch_template('newpost_attachmentbit', 0, 0) . '";');
// Begin Download Credit System
if($vboptions['credit_mode'])
{
// check if the system apply to only certain forums
if(empty($vboptions['credit_sysapplied']) OR in_array($foruminfo['forumid'], explode(',', $vboptions['credit_sysapplied'])))
{
$totalcredits = $attachcount * $vboptions['credit_perattach'];
$DB_site->query_first("UPDATE " . TABLE_PREFIX . "user
SET credits = credits + $totalcredits
WHERE userid = $bbuserinfo[userid]
");
}
}
// End Download Credit System

}
}

Deaths
04-05-2005, 07:51 AM
Sorry, I've made a little typo.

Redownload the zip, and redo the edits to attachment.php and newattachnent.php.

VBUsers
04-05-2005, 08:00 AM
Sorry, I've made a little typo.

Redownload the zip, and redo the edits to attachment.php and newattachnent.php.


ok im going to do this now. thanks

VBUsers
04-05-2005, 08:24 AM
ok hell of a job deaths. this is a great hack and now it works. what ever you changed was my issue. it works fine i tested it every way and i thank you for your time and effort. cant wait for your next projects. now that i know a little more ill try to help you out on the questions.

And everyone make sure to click install! very important

Deaths
04-05-2005, 08:37 AM
Glad to hear you got it to work :).

Lionel
04-20-2005, 11:30 AM
Is me who did a bad install or if member does not have enough points, thumb shows as broken?

Lionel
04-20-2005, 01:43 PM
Deaths, quick question: In order to encourage uploads, can this be made that portion of points taken from downloading member is given to member who uploaded? If yes, I could setup a forum like a mp3 portal.

Deaths
04-20-2005, 02:57 PM
That would be very complicated, as you'd probably have to create a new table for that.

This is simply an addon, and what you are asking is changing a rather simple hack into a major addition.

I'm currently very busy, but when I find some time, I'll try creating it for you. (Can take a couple of weeks, though)

VBUsers
04-27-2005, 05:01 PM
i fixed that issue-----
but

how can i make it so that when i get a new registered user he automatically gets 45 points in his account with out me having to give him points so he can download stuff. that would be an excellent add on for me. cause now i have to give each one points and its a hassle. thanks deaths your the man!

VBUsers
05-02-2005, 04:46 AM
i fixed that issue-----
but


how can i make it so that when i get a new registered user he automatically gets 45 points in his account with out me having to give him points so he can download stuff. that would be an excellent add on for me. cause now i have to give each one points and its a hassle. thanks deaths your the man!


i really need a bump to this request. who can help me out?

Deaths
05-02-2005, 02:30 PM
I must've missed this, sorry guys :).

This can easily be done using phpMyAdmin.
Go to your forums DB, edit the "user" table, and find the "uttpoints" row.
Edit it, and set the 'default' field to whatever you want (40 in your case).

If you want to do this for the Credit system, just edit the 'credits' row :)

VBUsers
05-02-2005, 05:09 PM
I must've missed this, sorry guys :).

This can easily be done using phpMyAdmin.
Go to your forums DB, edit the "user" table, and find the "uttpoints" row.
Edit it, and set the 'default' field to whatever you want (40 in your case).

If you want to do this for the Credit system, just edit the 'credits' row :)


ok i will try this right now and edit this post when it works. thanks deaths your the man!


yup it worked like a charm. i tested it and everything. thanks deaths!

Deaths
05-02-2005, 06:40 PM
No problem, glad I could be of help :)

MixMakers
05-05-2005, 02:24 AM
Great hack! I was wondering if it'd be possible to give the points the attatchment costs to the uploader of the file. So if 10 people download a 10pt attatchment, the uploader would receive 100 pts. I think that would be a great addition.

Also, does the credits received per attatchment option work? If so, mine does not work and I have no idea why.

Deaths
05-05-2005, 06:24 AM
That has been requested before, but unfortunately I'm not the person to ask this to ;).
I simply coded this addon to make it work with uCash, if you want that addition you'll need to ask in the actuall hack's thread (https://vborg.vbsupport.ru/showthread.php?t=78953).

EDIT: Don't have a clue why that is... is anyone having this problem?

VBUsers
05-05-2005, 07:03 AM
hey mix you probably skipped a step. as long as you follow the steps you should be good.

MixMakers
05-06-2005, 08:00 PM
Just checked it over again and everything seems fine...Help please!

Also, not sure if it's meant to be this way or not, but when a user posts a thread or reply, he will get points from the uCash hack, and also points from the credit system hack.

Just giving you a heads up.

Lionel
05-06-2005, 10:51 PM
Great hack! I was wondering if it'd be possible to give the points the attatchment costs to the uploader of the file. So if 10 people download a 10pt attatchment, the uploader would receive 100 pts. I think that would be a great addition.

Also, does the credits received per attatchment option work? If so, mine does not work and I have no idea why.

Dark Visor did it for me. Here is the code, with his blessings.
In attachment.php replace entire block of


// Begin Download Credit System
...
// End Download Credit System


with:


// Begin Download Credit System
if($vboptions['credit_mode'])
{
// quick for exceptional groups not restricted by this credit system
if(in_array($attachmentinfo['forumid'], explode(',', $vboptions['credit_sysapplied'])))
{
$usercredits = $bbuserinfo['uttpoints'];
$cost = $vboptions['credit_cost'];
if($usercredits < $vboptions['credit_cost'])
{
eval(print_standard_error('error_notenuffcredits') );
}
else
{
$DB_site->query_first("UPDATE " . TABLE_PREFIX . "user SET uttpoints=uttpoints-$cost WHERE userid = $bbuserinfo[userid]");
$DB_site->query_first("UPDATE " . TABLE_PREFIX . "user SET uttpoints=uttpoints+$cost WHERE userid = $attachmentinfo[userid]");
}
}
}
// End Download Credit System


There is also a conditional to put in postbit to let people know that they are 'paying' x points to user for downloading.

akanevsky
05-06-2005, 11:11 PM
HACK MODIFICATION - "PAY" POINTS IN SPECIFIC FORUMS INSTEAD OF PLAIN SUBTRACTION

-------------------------------------------
1. Do what it says here (https://vborg.vbsupport.ru/showpost.php?p=650259&postcount=39).
-------------------------------------------

-------------------------------------------
In showthread.php, find:
-------------------------------------------


$show['viewpost'] = iif(can_moderate($thread['forumid']), true, false);
$show['managepost'] = iif(can_moderate($thread['forumid'], 'candeleteposts') OR can_moderate($thread['forumid'], 'canremoveposts'), true, false);


-------------------------------------------
Add after:
-------------------------------------------


$show['creditrequired'] = iif(in_array($thread['forumid'], explode(",",$vboptions['credit_sysapplied'])), 1, -1);


-------------------------------------------
In showpost.php, find:
-------------------------------------------


$post['postcount'] = $postcount;


-------------------------------------------
Add after:
-------------------------------------------


$show['creditrequired'] = iif(in_array($threadinfo['forumid'], explode(",",$vboptions['credit_sysapplied'])), 1, -1);


-------------------------------------------
In postbit & postbit_legacy templates, find:
-------------------------------------------

<if condition="$show['thumbnailattachment'] OR $show['attachments'] OR $show['imageattachment']">

-------------------------------------------
Add after:
-------------------------------------------


<if condition="$show[creditrequired]==1 AND $vboptions[credit_mode]==1">
<div align="center" style="font-size: 8pt">
<b><br /><br />Note: By downloading attachments from this forum, you automatically pay $vboptions[credit_cost] points to the attachment owner.</b>
</div>
</if>


-------------------------------------------
Add a credit_sysapplied setting into this hack's setting group. This is a plain text field. In it, input forum IDs of the forums you want this add-on to work in.
-------------------------------------------

Done!

MixMakers
05-07-2005, 03:43 AM
Thank you for the code, but it didn't seem to work. I noticed that points were not getting deducted from the person downloading, nor was the person who uploaded the attatchment receiving points.

Lionel
05-07-2005, 03:51 AM
have you enabled the Download Credit System?

MixMakers
05-07-2005, 03:53 AM
Yes. When I switched the code back to how it was, points were getting deducted like usual. Just tried again, and same thing.

Lionel
05-07-2005, 03:59 AM
This is just a simple db insert, nothing else.

$DB_site->query_first("UPDATE " . TABLE_PREFIX . "user SET uttpoints=uttpoints-$cost WHERE userid = $bbuserinfo[userid]");
$DB_site->query_first("UPDATE " . TABLE_PREFIX . "user SET uttpoints=uttpoints+$cost WHERE userid = $attachmentinfo[userid]");

MixMakers
05-07-2005, 04:02 AM
This is just a simple db insert, nothing else.

Sorry, I'm not exactly sure what I do with that code?

Lionel
05-07-2005, 04:04 AM
Go back to post number 39 above.

MixMakers
05-07-2005, 04:11 AM
Oh, you're just saying that it's a db insert?

Hmm..I have no idea what's wrong and I really want to get this to work.

edit - Maybe this problem comes hand with another problem I'm having with the hack - It doesn't give the person who uploaded the attatchment any points either? Any help on that?

Lionel
05-07-2005, 04:16 AM
OK. You need
1-to install original hack
2-Install Deaths changes
3-Apply the change in attachment.php in post 39
4-put the conditional in postbit
5-make sure that you are not an admin when you test it.
6-make sure the tester *does not* have enough points and watch him being stopped
7-try with a tester with enough points. Jot down how many points he has before, then see if is minus what you set in your vboptions. Also refresh page and jot down how many points uploader has.

Forgot to add: make sure attachment is downloadable, not smaller than thumbsize if it's an image. It has to be clickable.


Works fine for me. Good luck.

The only negative is that the poor member viewing attachment gets deducted every time.

Lionel
05-07-2005, 04:26 AM
The only difference between Deaths code and this one is the addition of
$DB_site->query_first("UPDATE " . TABLE_PREFIX . "user SET uttpoints=uttpoints+$cost WHERE userid = $attachmentinfo[userid]");


to give the points to uploader. So it does not make sense that nothing is happening and that it works well without this.

Deaths
05-07-2005, 07:19 AM
Follow the instructions here (https://vborg.vbsupport.ru/showpost.php?p=650271&postcount=40).

EDIT: Ah, I see you have already replied :)

akanevsky
05-07-2005, 10:50 AM
You need to have vboptions[credit_sysapplied] option added to your credit settings. In it, you input IDs of forums where you want the code to work.

akanevsky
05-07-2005, 10:51 AM
Actually nevermind I will post this as an add-on.

Deaths
05-07-2005, 01:18 PM
An add-on to an add-on, lol :D

akanevsky
05-07-2005, 02:23 PM
lol no I did not notice this is already an add-on. In this case let's just update yours :D :) Is there a vboptions[credit_sysapplied] field by default in your add-on? :P Because this code snippet of mine works only for those forums whose IDs are listed in that option field :)

akanevsky
05-07-2005, 03:47 PM
There you go: complete instructions.

Lionel
05-07-2005, 05:26 PM
Deaths changes makes more sense than original hack as more people use ucash.
Dark Visor addon gives people incentive to upload, and what is good, applies it only to specific forums.

Deaths
05-07-2005, 06:14 PM
Added a link in the main post.

Edit: dang, your name is listed before mine ^^

akanevsky
05-07-2005, 06:42 PM
lol oh well, sorry :)

Deaths
05-07-2005, 06:48 PM
Hehe, not your fault I guess :D.

twin
05-08-2005, 10:29 AM
Is it possible to do this with this hack: I want to let people to buy eg. 1 file download for 300 points?

akanevsky
05-08-2005, 12:22 PM
Then change the point value per download in Death's hack settings...

Deaths
05-08-2005, 03:49 PM
This addon uses the same settings as the origional hack, so you can just edit the settings ;)

MixMakers
05-08-2005, 06:32 PM
Thanks for the info..I'll try it later on today.

Also, a user brought this to my attention on my forums. You can cheat the system by right clicking the link and saving the target. Anyway to prevent this?

edit- Also, I'm not exactly sure how to do this:

Add a credit_sysapplied setting into this hack's setting group. This is a plain text field. In it, input forum IDs of the forums you want this add-on to work in.

edit 2 - AHHH..tried it and it didn't work again. Same result, points didn't get deducted nor did points get added to the person who attatched the file. I left all the edited files the same except for attatchment.php. I changed it back to what the originall install file says and the deduction works.

akanevsky
05-09-2005, 12:25 AM
Also, a user brought this to my attention on my forums. You can cheat the system by right clicking the link and saving the target. Anyway to prevent this?

This makes absolutely no sense to me. When "saving the target", you are still running the script.

edit- Also, I'm not exactly sure how to do this:

admincp/options.php?do=addsetting

Deaths
05-09-2005, 06:47 AM
Right click, save as shouldn't work at all, because you'll just save attachment.php to your PC oO

twin
05-09-2005, 12:03 PM
great hack! I got one more question - how to add an option to u shop dropdown menu. I would like to add 'file datebase' option which would redirect to a forum which contains a file datebase that is using this hack.

Deaths
05-09-2005, 03:35 PM
Try editing the navbar template.

If you don't know how to do that, just reply, and I'll post some instructions.

twin
05-09-2005, 06:28 PM
sorry, I dont know how :) please post some instructions.

Deaths
05-10-2005, 07:14 AM
Ok, login to your admincp.
In the navigation menu on your left, scroll down and look for "Styles & Templates".
Click the little arrow next to it, and click "Style Manager".
Next to the skin you will want to edit, there should be a little dropdown with the text "All Style Options".
Pull it down, and click "edit templates" (you might need to scroll up).
Now find the "Navigation / Breadcrumb Templates".
Double click it, or click the "Expand / Collapse" button.
Open up the "navbar" template, and scroll down aaall the way.
Somewhere around there, find

<!-- shop menu -->

Now find:

<tr><td class="vbmenu_option"><a href="ushop.php?do=userhistory">History</a></td></tr>

And bellow add:

<tr><td class="vbmenu_option"><a href="YOUR_LINK_TO_FILE_DB_FILE">Files Database</a></td></tr>

Thats it!
Change the text from YOUR_LINK_TO_FILE_DB_FILE to the actual link, and if you wish you can change Files Database to something else aswell.

lebanon
05-11-2005, 12:30 PM
hello ,
Ive installed this hack along with previous hack first then now i want to see it live
ofcourse it should be turned on as specified
so when i go to admincp/options.php?do=options&dogroup=creditsystem
actually i only see a blank
**Download Credit System
**save - reset
The above two lines are all i get !
I rechecked steps and all are done fine as i saw , what could possibly be wrong or less ?

Deaths
05-12-2005, 11:45 AM
Did it work before you installed my addon?

lebanon
05-14-2005, 11:16 AM
I actually download both the hack and addon and implemented direcly
And the instruction were not hard to say ive lost
But logically i was confused about something, there were no edits for index.php in the admincp , so where should it build the menu from ?
The installer dumps a db , the edits doesnt include index.php , and your addon actually deletes half the edits already .
Normally what builds the menu ?

Deaths
05-14-2005, 11:54 AM
I really don't get what you expect this hack to do.
This is simply a hack that deducts points from a user when he/she downloads an attachent, and this addon just changes the credits to use uCash, nothing more, nothing less...

lebanon
05-15-2005, 04:42 PM
deaths exactly i know what it does and thats why i have done it on my forum for the pospose exactly.
All am saying is that am having trouble in the VBoptions, where the master swicth to turn it on or off or edit settings is not showing.
The code as i have implemented it only gets it in the vboptions and with the ONLY BUTTON save ( NO settings are showing to be edited )

Deaths
05-15-2005, 04:47 PM
Thats very strange...
But my hack doesn't though any of the vbsettings, so I think tnguy3n will know more if this issue than me.

slim cutty
07-22-2005, 07:53 AM
For some reason, my database isn't letting me add query where uploader recieves points I keep getting this error here...

ERROR: Unknown Punctuation String @ 9
STR: ->
SQL: $DB_site->query("UPDATE " . TABLE_PREFIX . "user SET uttpoints=uttpoints-$cost WHERE userid = $bbuserinfo[userid]")

Can someone help? This hack works perfectly aside from this... until I get the above to work the member uploader will not receive points

Marco van Herwaarden
07-22-2005, 11:50 AM
The above is a statement to be executed in a php-script, not directly as a sql-statement.

slim cutty
07-23-2005, 03:29 PM
Thanks man... it works fine now

I greatly appreciate your help!

VBUsers
11-19-2005, 04:00 PM
will this be available for 3.5.1?

Akagi
02-12-2006, 02:09 PM
I hope this will be ported to 3.5 to integrate with either uCash/eBux