WordPress.org

Plugin Directory

Opened 4 years ago

Last modified 15 months ago

#2173 assigned enhancement

Easy Photo Album: More robust album save mechanism.

Reported by: TV productions Owned by: TV productions
Priority: normal Severity: normal
Plugin: not-listed Keywords: easy-photo-album
Cc:

Description

Currently the albums save also the title and the caption of an image, with a hacky workaround to update the captions if they are changed in the media library. It would be better to save only the image id and the order and load the title and caption on render. The user should still be able to edit the caption (and/or the title) from the album edit screen.

The current method has also very weird effects, like removing all the album data at once.


Code suggestions:

  1. Don't use $this->current_photos = array() in save_metadata but more something like:
    <!--?php
    $images = get_images_from_request(); // the album images, processed after submit
    //
    // There could be some check if the album is empty, 
    // that should be done at the front end and then sets some flag.
    //
    order_images($images); // sort by order
    $this--->current_photos = $images; // just add them
    
  2. Empty album check at the front-end.
    js
    // on save:
    if (album.images.length == 0) {
       if (confirm("Do you really want to submit an empty album?")) {
           flag_is_empty = true;
       }
       else {
           cancel_save();
       }
    }
    

Change History (2)

comment:1 @TV productions4 years ago

  • Keywords easy-photo-album added
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.