nextcellent's People
nextcellent's Issues
Bulk Copy or move
Hi,
I realize this is a real long shot, but I've been working with Nextcellent forever and only recently has it broken for me. I'm on a current WP and PHP and I don't know when it broke, but Bulk Copy and Bulk Move don't work. Specifically, the choose gallery dialog fails to allow for search or a list of galleries to copy/move to. For me anyways, everything else seems to work. I have only basic coding knowledge, but if steered in the right direction, I might be able to chase this down. I do see all the code involved, but I'm at a loss as to how to start.
Thanks so much!
Thanks
Just wanted to say thanks for maintaining this fork!
"Married controls" prevents the execution of some bulk actions.
A change introduced in WP 5.7 “marries”, binds the values of the top and bottom bulk action <select>
s by forcing the other <select>
's value the same. Source:
https://core.trac.wordpress.org/browser/tags/5.7/src/js/_enqueues/admin/common.js#L1222
Unfortunately this cause a problem with a condition inside handle_bulk_actions()
which handles delete_gallery
and delete_images
:
https://github.com/nickg/nextcellent/blob/master/admin/manage/class-ngg-manager.php#L473
if ( $_POST['action'] !== "-1" && $_POST['action2'] !== "-1" ) {
return;
}
Because both action
and action2
are forced to have the same value, bulk deletion of galleries and images is made impossible, because either both or none will be -1
.
The affected admin pages are (at least) these:
wp-admin/admin.php?page=nggallery-manage
wp-admin/admin.php?page=nggallery-manage&mode=image&gid=111
Suggested fix:
Replacing the condition and the following two sanitizations with
$action = array_filter( array( $_POST['action'] => true, $_POST['action2'] => true, "-1" => false ));
$action = count( $action ) === 1 ? key( $action ) : '';
// $action = sanitize_text_field( $a ); // Is sanitization necessary BTW?
and replacing the action conditions
if ( $a1 === "delete_gallery" || $a2 === "delete_gallery" ) {
} elseif ( $a1 === "delete_images" || $a2 === "delete_images" ) {
with
if ( $action === "delete_gallery" ) {
} elseif ( $action === "delete_images" ) {
It works by creating an array using both (top and bottom) action values as keys and a last false element to filter out the no-choice -1
value.
If there is only one meaningful action
, the $action
array will have exactly one key.
The suggested fix should work with current and older WordPress installations too.
(To be honest, I tried using if
s, but they were too long and complicated.)
The trick using "-1"
as the last key should work because www.php.net/array says:
If multiple elements in the array declaration use the same key, only the last one will be used as all others are overwritten.
To be sure, here is a test of the array key method, it works and fails properly with all php versions:
https://3v4l.org/ANpoA#veol
And thank you for keeping the good ol' Nextgen gallery alive. :)
Gaining Maintenance rights
Just wanted to ask if there is any interest in gaining maintenance rights for nextcellent from Fernando, so that it would be possible to publish new versions on your own accord.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.