Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: CiQ on October 16, 2008, 08:16:23 AM

Title: User Attachment Quota
Post by: CiQ on October 16, 2008, 08:16:23 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1442)

User Attachment Quota 1.3.2

This mod will allow the admin to set the Membergroups's attachment quotas.

Admin -> Membergroups and modify any groups.
and
Admin -> Permissions -> Permissions by Membergroup -> Modify -> "View attachments via profile" and "Remove attachments via profile"

- If the user consists in many groups has been selected maximum quota
- look the user profiles for information of the status of a quota
- admin has no quota
- attachments browser in profile

Languages: english, russian

Changelog:
v1.3.2 (03 July 2009) - contain update from 1.3.1
- corrected mechanism of selection of quotas (If in any group of groups that belong to the user, given a quota equal to zero, then the user an unlimited space for attachments. Else choose a maximum quota of these groups.)
- you can set a quota for admin
- "Uploaded" field is always visible in profile (and "View attachments" link if have permision to browse attachments)

v1.3.1 (27 November 2008) - contain update from 1.3
- bug fixed

v1.3 (23 November 2008) - contain update from 1.2.1
- attachments browser in profile!

v1.2.1 (12 November 2008) - contain update from 1.2
- fixed small bug with guests

v1.2 (5 November 2008) - contain update from 1.11
- If the user consists in many groups has been selected maximum quota

v1.11 (4 November 2008) - contain update from 1.02
- fixed critical error

v1.1 (1 November 2008) - bad
- membergroups attachment quotas

v1.02 (15 October 2008)
- hide quota status in admin's profile

v1.01 (8 October 2008)
- no db upd. Admin has no quota

v1.0 (7 October 2008)
- db upd fix, code errors

v0.95 (5 October 2008)
- fix code errors

v0.9 (4 October 2008)
- Initial release


Donation:
only web-money
Z236300658671
R997147501661
Title: Re: User Attachment Quota
Post by: Nibogo on October 26, 2008, 06:29:40 PM
Nice mod , great Job ;)
Title: Re: User Attachment Quota
Post by: genieuk on October 26, 2008, 07:02:00 PM
Great Mod,

but i cannot install.

It fails on Post.template.php, i can of course install but even doing a manual edit for that file does not find the code it says to find.

it says find:

if ($context['can_post_attachment'])
{


And Replace with:
if ($context['can_post_attachment'])
// AttQuota 1.01
if (!empty($modSettings['attachmentQuota']) && !$context['user']['is_admin'] && $context['user_attach']['size'] > $modSettings['attachmentQuota'] * 1024)
echo '
<tr id="postAttachment2">
<td align="center" valign="top" colspan="2">
', $txt['full_quota'], '
</td>
</tr>';
else
// end AttQuota 1.01
{


This cannot be found in my post.template.php

I have uploaded my post.template.php file if you would have a look for me, maybe because i got a ton of mods.

Thanks
Mathew
Title: Re: User Attachment Quota
Post by: genieuk on October 27, 2008, 05:40:36 AM
Sorted it now, thanks
Title: Re: User Attachment Quota
Post by: Bancherd on October 28, 2008, 01:34:52 AM
Nice  :D   Is it possible to make it such that it controls the maximum size of the attachments for the particular post......instead of relying on the fixed/global limit set by the Admin's Control Panel?  ???

I have a few special members that I would like to increase the maximum size of attachments per post.
Title: Re: User Attachment Quota
Post by: CiQ on November 01, 2008, 02:05:37 PM
Well.
This mod will allow the admin to set the Membergroups attachment quotas.
Test it please.
Title: Re: User Attachment Quota
Post by: genieuk on November 01, 2008, 02:24:29 PM
Quote from: CiQ on November 01, 2008, 02:05:37 PM
Well.
This mod will allow the admin to set the Membergroups attachment quotas.
Test it please.

Great! much better, do i uninstall previous version then install new version? just want to check to be on safe side.

Mathew
Title: Re: User Attachment Quota
Post by: CiQ on November 01, 2008, 02:37:47 PM
Quote from: genieuk on November 01, 2008, 02:24:29 PM
Great! much better, do i uninstall previous version then install new version? just want to check to be on safe side.

Mathew
1.1 includes an updater from 1.02 which you can use to update without having to uninstall
Title: Re: User Attachment Quota
Post by: genieuk on November 01, 2008, 09:12:20 PM
Works great, easy to update via package manager, did not notice that at first.

my only slight problem is this,

i have treasury mod installed and when member makes donation they are then a regular membergroup (contributor) even thou they dont show as contributor but a post count member they get access to hidden board for contributing. Now i wanted contributors to have more space but one of my members is a contributor, a moderator of two boards and a post count member in the other boards.

Even thou i changed contributor to receive 5MB she still shows as only 3MB which is what i set for normal members. So how do i get a contributor to have more space? like i said i did alter the amount for contributor but her space amount has not changed.

Thank you,
Mathew
Title: Re: User Attachment Quota
Post by: CiQ on November 02, 2008, 05:03:50 AM
"contributor" is the "Additional Membergroup" in user profile?
Title: Re: User Attachment Quota
Post by: genieuk on November 02, 2008, 05:46:23 AM
Quote from: CiQ on November 02, 2008, 05:03:50 AM
"contributor" is the "Additional Membergroup" in user profile?

hi,

I just had to uninstall your mod since updating. Please read here. Also i attached file if you look it is code from your mod. Line 117

http://www.simplemachines.org/community/index.php?topic=271842.msg1778883#new

very important.

I marked the topic on that link as solved after finding out it was to do with this mod so it can be solved here.

Thank you,
Mathew
Title: Re: User Attachment Quota
Post by: CiQ on November 02, 2008, 10:06:22 AM

$request = db_query("
SELECT SUM(a.size) AS totalsize
FROM {$db_prefix}attachments as a
LEFT JOIN {$db_prefix}messages as m ON (a.ID_MSG = m.ID_MSG)
WHERE m.ID_MEMBER = ".$ID_MEMBER."
AND a.attachmentType != 3
AND a.ID_MSG != 0
", __FILE__, __LINE__);
list($row) = mysql_fetch_row($request);
$context['user_attach']['size'] = (int) $row;
mysql_free_result($request);

This peace of code from 1.02 version (fully worked) and not modified in 1.1 version.
I do not find errors. Who can will help me?
Title: Re: User Attachment Quota
Post by: [SiNaN] on November 02, 2008, 10:54:52 AM
Error is related to new added query after that one.

$getquota = db_query("
SELECT attquota
FROM {$db_prefix}membergroups
WHERE ID_GROUP = ".$user_info['id_gr']."
", __FILE__, __LINE__);
list($row2) = mysql_fetch_row($getquota);
$context['attquota'] = (int) $row2;
mysql_free_result($getquota);


$user_info does not contain a 'id_gr' index. It has 'groups' index, but it is an array. You can use $user_info['groups'][0] and it will give you the primary group of the member. But I'll suggest this one:

$getquota = db_query("
SELECT attquota
FROM {$db_prefix}membergroups
WHERE ID_GROUP IN (" . implode(',', $user_info['groups']) .")
", __FILE__, __LINE__);
while ($row2 = mysql_fetch_assoc($getquota))
$quotas[] = (int) $row2['attquota'];
$context['attquota'] = max($quotas);
mysql_free_result($getquota);


It will get all users groups' quotas and select the highest quota from them.
Title: Re: User Attachment Quota
Post by: genieuk on November 02, 2008, 12:13:02 PM
mmm, are you going to update this soon? ifso will you reply in your thread to let me know, uninstalled it until fixed.

and thanks to [SiNaN] for offering help, this means i can install a really good, useful mod when changes are made.

Regards,
MAthew
Title: Re: User Attachment Quota
Post by: genieuk on November 03, 2008, 05:42:29 AM
mmm, mod page is showing it was updated yesterday, is this problem now fixed ???

Thank you,
Mathew
Title: Re: User Attachment Quota
Post by: [SiNaN] on November 03, 2008, 05:49:07 AM
Yeah, it seems to be fixed now.
Title: Re: User Attachment Quota
Post by: genieuk on November 03, 2008, 07:20:02 AM
Quote from: [SiNaN] on November 03, 2008, 05:49:07 AM
Yeah, it seems to be fixed now.

Hi, just installed and same problem still happens as stated above in my post about error.

Mathew
Title: Re: User Attachment Quota
Post by: CiQ on November 03, 2008, 12:02:54 PM
Sorry for waiting. I have problems with ISP.
2[SiNaN]:
how i can made "select the highest quota" in profile summary?
Title: Re: User Attachment Quota
Post by: genieuk on November 03, 2008, 01:15:50 PM
Hi,

I see it says on mod page critical error fixed, is this the error fixed that i was receiving?

thank you,
Mathew
Title: Re: User Attachment Quota
Post by: CiQ on November 03, 2008, 01:23:20 PM
yes. but i dont made "select the highest quota".
test please
Title: Re: User Attachment Quota
Post by: [SiNaN] on November 04, 2008, 06:25:48 AM
I just realized that the query is in Profile.php. This should get the maximum quota:

$groups = (!empty($user_profile[$memID]['additionalGroups']) ? $user_profile[$memID]['additionalGroups'] . ',' : '') . $user_profile[$memID]['ID_GROUP'];

$getquota = db_query("
   SELECT attquota
   FROM {$db_prefix}membergroups
   WHERE ID_GROUP IN ($groups)
   ", __FILE__, __LINE__);
while ($row2 = mysql_fetch_assoc($getquota))
      $quotas[] = (int) $row2['attquota'];
$context['attquota'] = max($quotas);
mysql_free_result($getquota);
Title: Re: User Attachment Quota
Post by: CiQ on November 04, 2008, 01:13:27 PM
thank you! This is been in next version of mod.

wt..?? i find bug in 1.11 version :(
sorry pls.
Title: Re: User Attachment Quota
Post by: Coyote Keith on November 04, 2008, 06:44:42 PM
Once a user reaches their quota, can the remove items to get their space back?
Title: Re: User Attachment Quota
Post by: CiQ on November 05, 2008, 12:03:09 AM
Quote from: Coyote Keith on November 04, 2008, 06:44:42 PM
Once a user reaches their quota, can the remove items to get their space back?
yes. edit post and delete attachment.

2[SiNaN]:
one moment:
Should be:
$groups = (!empty($user_profile[$memID]['additionalGroups']) ? $user_profile[$memID]['additionalGroups'] . ',' : '') . (!empty($user_profile[$memID]['ID_POST_GROUP']) ? $user_profile[$memID]['ID_POST_GROUP'] . ',' : '') . $user_profile[$memID]['ID_GROUP'];
right?

well, i upload good 1.11 version with good installer (I hope)
pls test install/uninstall/upgrade this mod. if no errors, i made 1.2 version with "select the highest quota".
Title: Re: User Attachment Quota
Post by: [SiNaN] on November 05, 2008, 03:37:18 AM
Quote from: CiQ on November 05, 2008, 12:03:09 AM
2[SiNaN]:
one moment:
Should be:
$groups = (!empty($user_profile[$memID]['additionalGroups']) ? $user_profile[$memID]['additionalGroups'] . ',' : '') . (!empty($user_profile[$memID]['ID_POST_GROUP']) ? $user_profile[$memID]['ID_POST_GROUP'] . ',' : '') . $user_profile[$memID]['ID_GROUP'];
right?

well, i upload good 1.11 version with good installer (I hope)
pls test install/uninstall/upgrade this mod. if no errors, i made 1.2 version with "select the highest quota".

Yeah, that would be okay.
Title: Re: User Attachment Quota
Post by: CiQ on November 05, 2008, 08:04:30 AM
1.2 version released (thanks to [SiNaN])

i test this mod on my web-site. I hope that it completely works.
Title: Re: User Attachment Quota
Post by: qtime on November 06, 2008, 03:27:52 PM
This is a good feature to the smf software, but this will remind me to a wish I had some time ago (and still have it).
Is it possible to have this mod as an oppositte, not an upload limit, but a download limit a membergroup a day for example.
Title: Re: User Attachment Quota
Post by: CiQ on November 14, 2008, 02:20:00 PM
Quote from: qtime on November 06, 2008, 03:27:52 PM
Is it possible to have this mod as an oppositte, not an upload limit, but a download limit a membergroup a day for example.
Probably, this will be other mod...
---> http://www.simplemachines.org/community/index.php?board=79.0
Title: Re: User Attachment Quota
Post by: CiQ on November 22, 2008, 02:41:01 PM
Yahoo!
1.3 version coming soon! With attachments browser in profile о_О (like ?action=manageattachments;sa=browse)!
Title: Re: User Attachment Quota
Post by: Nibogo on November 22, 2008, 04:44:19 PM
Quote from: CiQ on November 22, 2008, 02:41:01 PM
Yahoo!
1.3 version coming soon! With attachments browser in profile о_О (like ?action=manageattachments;sa=browse)!

also with smf 2.0 support?
Title: Re: User Attachment Quota
Post by: CiQ on November 23, 2008, 03:12:41 AM
No. Only 1.1.x. support.

upd:
1.3 Released
Title: Re: User Attachment Quota
Post by: CiQ on November 27, 2008, 02:10:19 PM
1.3.1 - traditional bug-fix =_=
Title: Re: User Attachment Quota
Post by: Dazza0101 on November 29, 2008, 12:54:07 AM
Hi,

Thank you for creating and sharing this mod, it was mentioned earlier and I am also in need of this feature, is to be able to control the file size limit for a particular user or user group.

Any help is greatly appreciated,

Dazza0101. :)
Title: Re: User Attachment Quota
Post by: qtime on February 14, 2009, 02:52:19 AM
I hope this will also be available for smf 2
Title: Re: User Attachment Quota
Post by: CiQ on February 14, 2009, 04:51:47 AM
I hope too. But it will not be fast.
Title: Re: User Attachment Quota
Post by: nopity4u on June 10, 2009, 02:22:28 PM
I'd like to second the request for download limits added to this mod :)

I used to know of an quota type mod but it has somehow seemed to have disappeared.
Title: Re: User Attachment Quota
Post by: ceewee on June 27, 2009, 08:25:20 AM
The admin is excluded I see, would like to see on profilepage what the 2 admins of my board have uploaded compared to other membergroups , is that easy to change in the code?

Couldn't enter data in the fields of membergroup.
Title: Re: User Attachment Quota
Post by: CiQ on June 27, 2009, 04:18:38 PM
Quote from: ceewee on June 27, 2009, 08:25:20 AM
The admin is excluded I see, would like to see on profilepage what the 2 admins of my board have uploaded compared to other membergroups , is that easy to change in the code?

Couldn't enter data in the fields of membergroup.
try comment this code in Profile.template.php:
if ($context['show_attachment_quota'])
get
//if ($context['show_attachment_quota'])
Now you will see attachment statistics in admin's profile.
Title: Re: User Attachment Quota
Post by: ceewee on June 29, 2009, 05:16:57 PM
Quote from: CiQ on June 27, 2009, 04:18:38 PM
Quote from: ceewee on June 27, 2009, 08:25:20 AM
The admin is excluded I see, would like to see on profilepage what the 2 admins of my board have uploaded compared to other membergroups , is that easy to change in the code?

Couldn't enter data in the fields of membergroup.
try comment this code in Profile.template.php:
if ($context['show_attachment_quota'])
get
//if ($context['show_attachment_quota'])
Now you will see attachment statistics in admin's profile.

Nice THX
Title: Re: User Attachment Quota
Post by: CiQ on July 03, 2009, 07:06:06 AM
QuoteNow you will see attachment statistics in admin's profile.
Now all users will see attachment statistics in all profiles.  :P
Title: Re: User Attachment Quota
Post by: perro88 on July 03, 2009, 10:14:03 AM
thanks for the mod ;)
Title: Re: User Attachment Quota
Post by: CiQ on July 03, 2009, 10:18:52 AM
v1.3.2 comming soon ;)
Title: Re: User Attachment Quota
Post by: perro88 on July 03, 2009, 11:17:24 AM
Quote from: CiQ on July 03, 2009, 10:18:52 AM
v1.3.2 comming soon ;)
nice. installed this one and working smoothly :P
Title: Re: User Attachment Quota
Post by: CiQ on July 03, 2009, 12:12:01 PM
1.3.2 Released!

- corrected mechanism of selection of quotas (If in any group of groups that belong to the user, given a quota equal to zero, then the user an unlimited space for attachments. Else choose a maximum quota of these groups.)
- you can set a quota for admin
- "Uploaded" field is always visible in profile (and "View attachments" link if have permision to browse attachments)

8)
Title: Re: User Attachment Quota
Post by: qtime on July 04, 2009, 10:45:54 AM
Quote from: CiQ on July 03, 2009, 12:12:01 PM
1.3.2 Released!

- corrected mechanism of selection of quotas (If in any group of groups that belong to the user, given a quota equal to zero, then the user an unlimited space for attachments. Else choose a maximum quota of these groups.)
- you can set a quota for admin
- "Uploaded" field is always visible in profile (and "View attachments" link if have permision to browse attachments)

8)
thanks a lot, now I hope you like to code the opposite way, download traffic counting... :).
Title: Re: User Attachment Quota
Post by: Shannar on July 04, 2009, 11:21:35 AM
Quote from: qtime on July 04, 2009, 10:45:54 AM
thanks a lot, now I hope you like to code the opposite way, download traffic counting... :).

Why? If exist http://custom.simplemachines.org/mods/index.php?mod=1897
Title: Re: User Attachment Quota
Post by: qtime on July 05, 2009, 11:25:47 AM
@ Shannar, wow thanks a lot, I overlooked that one!!!
smf 2 not supported, but I should not speaking to you about that...
Title: Re: User Attachment Quota
Post by: CiQ on July 07, 2009, 07:39:06 AM
eh, it a trouble for me to add smf2 support :/
i not use smf2 :P
Title: Re: User Attachment Quota
Post by: flickernever on December 12, 2009, 03:09:39 PM
How could I reset the quota to 0?

Figured it out, just find the two DB queries and add a "AND a.ID_ATTACH > last attachment id of your board".
Title: Re: User Attachment Quota
Post by: $p00ky on October 27, 2010, 07:36:03 PM
Is it possible to have an update to SMF 2.x?
Title: Re: User Attachment Quota
Post by: CiQ on October 28, 2010, 07:34:33 PM
Quote from: $p00ky on October 27, 2010, 07:36:03 PM
Is it possible to have an update to SMF 2.x?
it possible if smf 2 will been released in final version.
Title: User Attachment Quota
Post by: holyw1ng on September 15, 2011, 08:13:39 AM
Does this mod support SMF 2.0?
If not, are there other mod that has this function and works in SMF 2.0?

Thanks.
Sorry for reviving old topic, but I can't find info anywhere else
Title: Re: User Attachment Quota
Post by: Biology Forums on May 02, 2012, 08:10:03 PM
I ended up using this mod for the sake of being able view any member's attachments.

Thank you...!
Title: Re: User Attachment Quota
Post by: nevsutt on October 17, 2012, 06:18:52 PM
Where Do I find the rules text
Title: Re: User Attachment Quota
Post by: Yes-U-Can on July 25, 2014, 01:14:58 AM
It's  been a while since no-one has posted here, i am only checking i may be wrong, Is there a modification already for the current 2.08 version , if so can someone guide me to it please? Thanks