•  » Beta testing
  •  » Batch Manager single mode error with Community uploads

#1 2025-11-16 00:45:53

moberley
Member
2025-11-10
75

Batch Manager single mode error with Community uploads

I'm not sure if this is an error with the community plugin or the Batch Manager, but if I try opening a selection that includes community uploads that are pending in the single mode batch manager I get the following error message.

Code:

Warning: Undefined array key 16 in /var/www/html/piwigo/admin/batch_manager_unit.php on line 409

That code at line 409 in batch_manager_unit.php is looking up the 'level' attribute from the image table in an array that expects only 0, 1, 2, 4 or 8 but the community plugin uploads seem to have a 'level' of 16 when they are pending approval.

Environment
Piwigo 16.0.0RC2 Check for upgrade
Installed on 6 November 2025, 1 week 1 day ago
Operating system: Linux
PHP: 8.4.11 (Show info) [2025-11-15 17:32:50]
MySQL: 11.8.3-MariaDB-0+deb13u1 from Debian [2025-11-15 17:32:50]
Graphics Library: External ImageMagick 7.1.1-43
Cache size 14.93 Mo   calculated 5 days ago Refresh

Activated plugin list
Add Users Notes
Additional Pages
Admin Tools
Community
Community Extended User Albums
Copyrights
Custom Registration Form
Extended Description
LocalFiles Editor
Perso Footer
Personal Plugin
Photo added by
Protect Notification
Upload 1 menu
Write Metadata

Offline

 

#2 2025-11-16 04:41:58

moberley
Member
2025-11-10
75

Re: Batch Manager single mode error with Community uploads

After reviewing the related template file (batch_manager_unit.tpl) further it isn't clear to me where the template variable set on the error line (LEVEL_CONVERT) is actually being used. All the level select options in the template seem to be built using: $level_options (set on line 147) and the elements array -- $element.level_options_selected (set on lines 370 and 410).

I commented out line 409 and that page still seems to work entirely as expected.

However $level_options ultimately references $conf['available_permission_levels'] which doesn't include level 16. If I set $conf['available_permission_levels'] = array(0,1,2,4,8,16); to the local config then the unit batch manager shows "Pending" for the status on those images, otherwise it shows "Admin".

However that whole interaction is a bit strange anyway since in the default setup (not having changed the configuration variable) I just see Admin in the level selector and I can change that to Everybody which does as far as I can see make that image available to everybody but it doesn't remove it from the community plugin pending table.

The batch manager could be extended by adding a sub-template but it doesn't appear to do so now, and in any case that might just be more confusing.

Offline

 

#3 2025-11-21 18:33:51

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13993

Re: Batch Manager single mode error with Community uploads

I have been working on the issue you reported.

After reviewing the related template file (batch_manager_unit.tpl) further it isn't clear to me where the template variable set on the error line (LEVEL_CONVERT) is actually being used.

I created an issue on Piwigo core [Github] Piwigo issue #2454

The variable is not used at all. I removed it, see [Github] Piwigo commit b1288115

But hiding the warning is not the ultimate fix. Far from it. I created another issue on Community this time [Github] Piwigo-community issue #100

The solution I implemented is to make obvious in the list of "Who can see this photo?" the "Pending" option. This way, the level is not changed when you modify the author/title/description.

I'm not 100% satisfied with this fix because an admin can change the level but the photo is still pending on the Community dedicated page. The situation is better now but I think there might be a better solution, by using a mecanism like I implemented with the lounge. In the lounge the photo is fully in the piwigo_images table and has no specific privacy level. The trick of the lounge is to keep the link between the photo and its album in a separate table and copy this link only when the lounge is emptied. I could do that too for community pending photos BUT I would have to deal with the list of albums, because I don't want to make the administrator think the photo is orphan.

I may have forgotten this important detail : I want to keep the photo editable while being pending. For example, an admin must be able to change the album before validating the photo.

Offline

 

#4 2025-11-21 19:24:28

moberley
Member
2025-11-10
75

Re: Batch Manager single mode error with Community uploads

It isn't a particularly Piwigo native solution but on my test setup I added some database triggers to update the pendings table when the level changes on the images table since I couldn't figure out a way to do that with a plugin in PHP without modifying the other code.

Offline

 

#5 2025-11-23 05:53:07

moberley
Member
2025-11-10
75

Re: Batch Manager single mode error with Community uploads

Maybe it doesn't matter but I had manually set $conf['available_permission_levels'] in my local config so applying the changes to the community plugin "community_init()" function caused the following odd display.

https://private-user-images.githubusercontent.com/383160/517793101-6f59270a-464f-443a-8c4e-611ae27f257a.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM4NzM2MDYsIm5iZiI6MTc2Mzg3MzMwNiwicGF0aCI6Ii8zODMxNjAvNTE3NzkzMTAxLTZmNTkyNzBhLTQ2NGYtNDQzYS04YzRlLTYxMWFlMjdmMjU3YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUxMTIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MTEyM1QwNDQ4MjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MWRhZTAyYjk4MWQ5ZmU2Njk5ODAxNDgzOWZjZWQxY2MzOWM2ZmE4NzQ5NWEyOTUxM2U0YWQ1MmJiNmNhMjEwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.D1OzgU8DU0ZSo9_kUdOyQ5AQX_ceMpSHw9GehKyoRqM

I also posted about this on [Github] Piwigo-community issue #100.

Last edited by moberley (2025-11-24 01:18:52)

Offline

 

#6 2025-11-24 07:24:47

moberley
Member
2025-11-10
75

Re: Batch Manager single mode error with Community uploads

It appears this was being affected by some other code I was testing locally so it was not actually due to the Community plugin itself. Sorry.

Offline

 
  •  » Beta testing
  •  » Batch Manager single mode error with Community uploads

Board footer

Powered by FluxBB

github linkedin newsletter Piwigo.org © 2002-2025 · Contact