• Hi.

    I’ve been using your NextGen Gallery plugin to create galleries for a while, and it works just fine. But I also use Better Delete Revision plugin (https://www.ads-software.com/plugins/better-delete-revision) to remove revisions. After I delete the revisions of the post that features the gallery – it is immediately crashes and a message ‘Invalid Displayed Gallery’ appears. When I delete other posts’ revisions that do not contain a gallery, nothing crashes and everything works as it’s supposed to. Also, this problem does not appear if a gallery is displayed via the shortcode.
    I honestly tried to figure out what the problem is myself. If I create a gallery through the button in the TinyMCE editor, then a post with post_type = displayed_gallery is created in the wp_posts chart, featuring the data that, as far as I understand, is essential for the gallery display. I checked the Better Delete Revision plugin code, and its work seems simple and correct. It uses built-in WordPress functions, such as:

    wp_delete_post_revision:

    $bdr_revisions = $wpdb->get_results(
    “SELECT ID AS revision_id
    FROM ($wpdb->posts)
    WHERE post_type = ‘revision’
    ORDER BY ID DESC”
    );
    foreach ( $bdr_revisions as $bdr_revision ) {
    wp_delete_post_revision( $bdr_revision->revision_id );
    }

    Then I examined the function wp_delete_post_revision and saw that this function trigger the following function – wp_delete_post( $revision->ID ). The function wp_delete_post features a hook o_action( ‘after_delete_post’, $postid ). Then I checked your plugin’s file wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php and in the line 131 I saw that there is a connection to this hook – add_action(‘after_delete_post’, array(&$this, ‘cleanup_displayed_galleries’));

    which triggers the following function:

    cleanup_displayed_galleries()

    function cleanup_displayed_galleries($post_id)
    {
    global $displayed_galleries_to_cleanup;
    $mapper = $this->get_registry()->get_utility(‘I_Displayed_Gallery_Mapper’);
    foreach ($displayed_galleries_to_cleanup as $id) $mapper->destroy($id);
    }

    As $post_id parameter a post id from the post_type = displayed_gallery (which I’ve mentioned above) is transmitted. This is where the gallery featured in this post gets deleted.

    I find it not exactly right that NextGen Gallery does not check what is deleted – the post or its revision, especially given that they have different id-s and post_type in the database.

    Sadly, I am not that good at programming, so I have no idea how to fix this. Can you please get onto this problem and fix it?

    Thanks in advance.

    https://www.ads-software.com/plugins/nextgen-gallery/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @jurer – Given the “Better Delete Revisions” plugin explicitly states to not use it with NextGEN Gallery I would suspect you are reporting what they already realize.

    Have you taken this up with that plugin author to see if they are working on a correction to their plugin that would allow it to work with NextGEN Gallery?

    Thanks!

    – Cais.

    PS: I have passed this along to our developers as well for them to review.

    Thread Starter jUreR

    (@jurer)

    Hi Cais,

    Thanks for the quick reply!

    I have already contacted Better Delete Revisions support team, and it was them who helped me figure out what the problem is and what exactly goes wrong. That is why I am now writing to you now, hoping that you’ll help me get this straight and fix my problem.

    Thanks.

    Plugin Contributor photocrati

    (@photocrati)

    @jurer – Thanks for letting us know about the issue you are seeing … perhaps there are settings within Better Delete Revisions than can be modified to correct for this conflict?

    – Cais.

    Thread Starter jUreR

    (@jurer)

    Hi Cais,

    Better Delete Revisions developers have warned me that Better Delete Revisions plugin cannot yet be used with NextGEN Gallery. They’ve also suggested I contact you, as it is your plugin that should have the check added for revision or post being deleted, as well as should the gallery be deleted or not.

    They also wrote that they cannot fix this in their plugin, as the functions, in which the check can be added, are located in your plugin. Most likely, it is cleanup_displayed_galleries() function, which gets called by the action action ‘after_delete_post’.

    Could you please tell me how soon will you be able to fix this bug?

    Thanks!

    Plugin Contributor photocrati

    (@photocrati)

    @jurer – I do not have an ETA for when we will be looking at this issue.

    We will have to deconstruct their plugin to see why it is doing what you are describing and then see how best to address the conflict it is creating.

    Unfortunately, at this time, you may have to choose which plugin is more important going forward for your site and needs.

    – Cais.

    PS: I added a note to our developers to the effect of what you are relaying from the other plugin author. It would have been nice if they chose to address this directly with us but we will do what we can.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Gallery crashes when revision is deleted’ is closed to new replies.