User Attachment Quota

Started by CiQ, October 16, 2008, 08:16:23 AM

Previous topic - Next topic

CiQ

Link to Mod

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


genieuk

#2
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

genieuk


Bancherd

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.

CiQ

Well.
This mod will allow the admin to set the Membergroups attachment quotas.
Test it please.

genieuk

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

CiQ

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

genieuk

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

CiQ

"contributor" is the "Additional Membergroup" in user profile?

genieuk

#10
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

CiQ


$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?

[SiNaN]

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.
Former SMF Core Developer | My Mods | SimplePortal

genieuk

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

genieuk

mmm, mod page is showing it was updated yesterday, is this problem now fixed ???

Thank you,
Mathew

[SiNaN]

Yeah, it seems to be fixed now.
Former SMF Core Developer | My Mods | SimplePortal

genieuk

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

CiQ

Sorry for waiting. I have problems with ISP.
2[SiNaN]:
how i can made "select the highest quota" in profile summary?

genieuk

Hi,

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

thank you,
Mathew

CiQ

#19
yes. but i dont made "select the highest quota".
test please

[SiNaN]

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);
Former SMF Core Developer | My Mods | SimplePortal

CiQ

#21
thank you! This is been in next version of mod.

wt..?? i find bug in 1.11 version :(
sorry pls.

Coyote Keith

Once a user reaches their quota, can the remove items to get their space back?

CiQ

#23
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".

[SiNaN]

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.
Former SMF Core Developer | My Mods | SimplePortal

CiQ

1.2 version released (thanks to [SiNaN])

i test this mod on my web-site. I hope that it completely works.

qtime

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.

CiQ

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

CiQ

Yahoo!
1.3 version coming soon! With attachments browser in profile о_О (like ?action=manageattachments;sa=browse)!


CiQ

#30
No. Only 1.1.x. support.

upd:
1.3 Released

CiQ

#31
1.3.1 - traditional bug-fix =_=

Dazza0101

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. :)
My new electronics forum.
http://www.silicontronics.com
For the electronic engineer to anyone who has an interest in electronics.

qtime

I hope this will also be available for smf 2

CiQ

I hope too. But it will not be fast.

nopity4u

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.

ceewee

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.

CiQ

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.

ceewee

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

CiQ

QuoteNow you will see attachment statistics in admin's profile.
Now all users will see attachment statistics in all profiles.  :P


CiQ


perro88

Quote from: CiQ on July 03, 2009, 10:18:52 AM
v1.3.2 comming soon ;)
nice. installed this one and working smoothly :P

CiQ

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)

qtime

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... :).

Shannar

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
Sorry for terrible English. My native language is C++ Russian.

qtime

@ Shannar, wow thanks a lot, I overlooked that one!!!
smf 2 not supported, but I should not speaking to you about that...

CiQ

eh, it a trouble for me to add smf2 support :/
i not use smf2 :P

flickernever

#48
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".

$p00ky

Is it possible to have an update to SMF 2.x?
$p00ky @ EroGaKi

CiQ

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.

holyw1ng

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

Biology Forums

I ended up using this mod for the sake of being able view any member's attachments.

Thank you...!

nevsutt

Where Do I find the rules text

Yes-U-Can

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
Bullying people is not right, STOP YOUR BULLYING GROW UP AND BE AN ADULT!!!

Advertisement: