Avatar Folder permissions for user/admins

https://www.phpbb.com/ideas/
Post Reply
Author:
Bitsqueezer
Posted:
Sun Jun 23, 2019 1:42 pm
Rating:
Status:
New
Bitsqueezer
Registered User
Posts: 2
Joined: Mon Jan 23, 2006 10:25 pm
Contact:

Avatar Folder permissions for user/admins

Post by Bitsqueezer » Sun Jun 23, 2019 1:42 pm

Hi,

in my forum I have the need that I as admin am able to assign an avatar from a gallery which the users cannot see when they open the gallery category dropdown in their user profile. So there are some categories which can be used by all users to assign an avatar from the gallery by themselves and on the other hand users can send me an avatar picture by mail, then I can resize the picture/change the file size etc. to fit our needs and then upload it with FTP to a folder named "Personal" which only I as admin can see. Then I can go into the user's profile in the ACP and assign him his personal avatar from this folder.
This makes it possible that every user can get a personal avatar image on one hand, that no other user can set this image in his own profile on the other hand and also that I as admin am the only one who can upload new images and make sure that the image fits into the avatar rules (dimensions/file size/image contents).

It would be great if phpBB would integrate a possibility in future to assign permissions to avatar folders simply with the ACP. For anyone interested, this is what I have changed in the phpBB2 and phpBB3 code to make this possible:

In phpBB2 (where user and admin pages are handled with different codes) it is in "usercp_avatar.php" in the function "display_avatar_gallery" (in my board in line 316) where I changed this line of code:

Code: Select all

if( $file!='Personal' && $file != '.' && $file != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $file) && !is_link($board_config['avatar_gallery_path'] . '/' . $file) )
(the part "$file!='Personal' && " was added here)

That prohibits that the folder named "Personal" was shown in the user's profile page.

In phpBB 3.2.7 everything has changed, so here it is the code in the file "phpbb\avatar\driver\local.php" where I changed this (line 47 in my file) in the function "prepare_form":

Code: Select all

			if (!empty($avatar_list[$cat]))
to this

Code: Select all

			if (!empty($avatar_list[$cat]) && (($user->data['group_id'] == 1493) || ($user->data['group_id'] != 1493 && substr($cat,-8) != 'Personal')))
After that modification any folder name which ends with the string "Personal" is hidden in the user's profile setting except the user is in the default group Administrators (which is the group_id "1493" in my board, can be found in the table "phpbb_groups" in the database).

So if you create a new folder named "Personal" or "Test_Personal" etc., insert some images there and empty the cache of phpBB3 after that then any administrator logged in can still see these folders in the avatar categories in ACP and the normal user profile but any other user cannot.

Maybe helpful for someone and maybe an idea to implement similar things like this to be able to separate access to specific avatar categories.

Cheers,

Christian

User avatar
Mannix_
Registered User
Posts: 484
Joined: Sun Oct 25, 2015 2:56 pm
Contact:

Re: Avatar Folder permissions for user/admins

Post by Mannix_ » Sun Jun 23, 2019 2:51 pm

This is so specific so I think it's better to ask for extension to be created. Don't see this as core feature that should be added. Just my 2 cents
-=-=-=-=-=-=-=-=-=-=-=-=-My Styles-=-=-=-=-=-=-=-=-=-=-=-=-
HexagonHexagonRebornCleanSilverProject Durango
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Want me to port a style to 3.2.x etc. contact me here or on twitter.

User avatar
3Di
Former Team Member
Posts: 13792
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Avatar Folder permissions for user/admins

Post by 3Di » Sun Jun 23, 2019 9:47 pm

Bitsqueezer wrote:
Sun Jun 23, 2019 1:42 pm
-- snip ..
In phpBB2 (where user and admin pages are handled with different codes) it is in "usercp_avatar.php" in the function "display_avatar_gallery" (in my board in line 316) where I changed this line of code:
.. snip ..
Well, back to 2005 I made a MOD for phpBB2 which was validated: https://www.phpbb.com/customise/db/mod/ ... t_gallery/ ;)

Not really an idea for the core IMO, maybe an extension.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

Post Reply

Return to “phpBB Ideas”