The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
![]() Quote:
Seeing how many attachments I am serving, I would prefer to have the limit as simple as possible. Only adding a new row to all members, summing and controlling their bandwidth usage that way. --------------- Added [DATE]1250388287[/DATE] at [TIME]1250388287[/TIME] --------------- Please bear with me. Since I have asked for an addon like this for several days and so far no one else sees its uses, I might want to try and code it myself with my rather limited knowledge of php and mysql. So if I want to start, I would like to ask you some questions. The hook to be used for an addon like this should be attachment_start, right? Then I want to write the code similar to this: Code:
GET attachment-filesize -> write filesize to member download quota table check member-usergroup; if is member of X usergroup = limit quota->X bytes if member-download-quota > usergroup-limit THEN stop and write attachment quota message. if member-download-quota <= usergroup limit THEN go on. Is it a good approach? --------------- Added [DATE]1250393636[/DATE] at [TIME]1250393636[/TIME] --------------- So far, I got this: Code:
if($vbulletin-userinfo['usergroupid'] = 7) { $download_quota = 15728640; } // Moderators if($vbulletin-userinfo[download_quota'] < $download_quota) { $new_download_quota = $vbulletin-userinfo['download_quota'] + $attachmentinfo['filesize']; $db->query_write(" UPDATE " . TABLE_PREFIX . "user SET download_quota = $new_download_quota WHERE userid = $vbulletin-userinfo[userid] ") } else { print "error"; } Then I set a different download quota for all existing usergroups. In this case it's 15 MB in bytes. Then I go check if the users current download_quota is less than the allowed 15MB. If that is the case, I will add the filesize of the current attachment to the download_quota field for the specific user. If it's bigger I return error. =) Is it that simple? |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|