Plugin Directory

Changeset 1824288


Ignore:
Timestamp:
02/19/2018 02:02:19 AM (8 years ago)
Author:
ErinMorelli
Message:

Version 1.2.1 - Critical Bug Fix

Location:
dlm-changelog
Files:
16 added
4 edited

Legend:

Unmodified
Added
Removed
  • dlm-changelog/trunk/README.txt

    r1824263 r1824288  
    55Requires at least: 3.0.1
    66Tested up to: 4.9.4
    7 Stable tag: 1.2.0
     7Stable tag: 1.2.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9292== Changelog ==
    9393
     94= 1.2.1 =
     95* Overrides and fixes an issue introduced DLM where saving a download will remove all existing saved changelog content for that download's versions
     96
    9497= 1.2.0 =
    9598* Fixed incompatibility issues with DLM versions 4.0+
     
    122125== Upgrade Notice ==
    123126
     127= 1.2.1 =
     128* CRITICAL UPDATE to fix a bug conflict with DLM that caused all changelog data to be deleted when updating a download via DLM
     129
    124130= 1.0.1 =
    125131* Fixed issue where not all published downloads were showing in admin dropdown
  • dlm-changelog/trunk/dlm-changelog.php

    r1824263 r1824288  
    44 * Plugin URI: https://www.erinmorelli.com/projects/dlm-changelog/
    55 * Description: An add-on for Mike Jolley's Download Monitor that adds version changelog functionality.
    6  * Version: 1.2.0
     6 * Version: 1.2.1
    77 * Author: Erin Morelli
    88 * Author URI: https://erinmorelli.com/
     
    4242}
    4343
     44// Set post meta name
     45define('DLMCL_POST_CONTENT', '_dlmcl_post_content');
     46
    4447
    4548/**
     
    5154{
    5255    // Check for new version
    53     $dlmcl_curr_version = '1.2.0';
     56    $dlmcl_curr_version = '1.2.1';
    5457
    5558    // Define new version option
     
    297300// Set uninstall hook
    298301register_uninstall_hook(__FILE__, 'DLMCL_Plugin_uninstall');
     302
     303
     304/**
     305 * Get post content for a given download version
     306 *
     307 * @param int $version_id The WP post ID for the version
     308 *
     309 * @return string The HTML-formatted content for the version
     310 */
     311function DLMCL_Plugin_Version_content($version_id)
     312{
     313    $version = get_post($version_id);
     314
     315    if ($version->post_content == '') {
     316        return get_post_meta($version_id, DLMCL_POST_CONTENT, true);
     317    }
     318
     319    return $version->post_content;
     320}
  • dlm-changelog/trunk/includes/dlmcl-admin.php

    r1824263 r1824288  
    1919 * @package DLMCL\Admin
    2020 */
     21
     22
     23/**
     24 * Saves all version post content to a meta value to prevent overrides
     25 *
     26 * @param int $version_id The WP post ID of the version being saved
     27 *
     28 * @return void
     29 */
     30function DLMCL_Admin_override($version_id)
     31{
     32    // We only care about DLM version posts
     33    if (get_post_type($version_id) != 'dlm_download_version') {
     34        return;
     35    }
     36
     37    // Get current post and meta data
     38    $version = get_post($version_id);
     39    $saved_content = get_post_meta($version_id, DLMCL_POST_CONTENT, true);
     40
     41    // Update our post meta if there's content
     42    if (!$saved_content || $version->post_content != '') {
     43        update_post_meta($version_id, DLMCL_POST_CONTENT, $version->post_content);
     44    }
     45}
     46
     47// Add to save post hook
     48add_action('save_post', 'DLMCL_Admin_override');
    2149
    2250
     
    208236                            data-id="<?php echo $this_version_id; ?>"
    209237                            data-placeholder="<?php _e('Click to add version notes', 'dlm-changelog'); ?>"
    210                         ><?php echo $this_version->post_content; ?></div>
     238                        ><?php echo DLMCL_Plugin_Version_content($this_version_id); ?></div>
    211239                    </td>
    212240                    <td><?php echo date('m/d/y', strtotime($this_version->post_date)); ?></td>
  • dlm-changelog/trunk/includes/dlmcl-shortcode.php

    r1824263 r1824288  
    212212
    213213        // Release Notes
    214         $output .= $release->post_content ."\n";
     214        $output .= DLMCL_Plugin_Version_content($version_id)."\n";
    215215
    216216        // End version output
Note: See TracChangeset for help on using the changeset viewer.