News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

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

Advertisement: