Plugin Directory

Changeset 1781539


Ignore:
Timestamp:
12/05/2017 07:03:07 PM (8 years ago)
Author:
petermantos
Message:

1.9 attempts to mitigate loss of any category selection made prior to version 1.7

Location:
read-and-understood/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • read-and-understood/trunk/class_wp_rnu.php

    r1780467 r1781539  
    55    Plugin URI: http://mantos.com/experience-and-expertise/plugin-read-understood/
    66    Description: Records acknowledgements that specific users have read specific postings (or not).
    7     Version: 1.8
     7    Version: 1.9
    88    Author: Peter Mantos; Mantos I.T. Consulting Inc.
    99    Author URI: http://mantos.com/experience-and-expertise/peter-mantos-resume/
     
    2828 * REV : WHEN : WHO : WHAT
    2929 * =====+=============+================+===================================================
     30 * 1.9 : 05-Dec-2017 : P.Mantos
     31 * : : : Retro-actively attemps to recovery any category selected before version 1.7
     32 * : : : by looking at the category option and using it to populate the rnu_category table
     33 * : : : if that table is empty.
     34* =====+=============+================+===================================================
    3035 * 1.8 : 03-Dec-2017 : P.Mantos
    3136 * : : : Respects [rnu_ack] shortcode.
     
    7580defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    7681if (!defined('READ_AND_UNDERSTOOD_PLUGIN_VERSION'))
    77     define('READ_AND_UNDERSTOOD_PLUGIN_VERSION', '1.8');
     82    define('READ_AND_UNDERSTOOD_PLUGIN_VERSION', '1.9');
    7883class class_wp_rnu
    7984{
     
    231236          $this->rnudb_install(); 
    232237      }
     238      $this->rnudb_install();
    233239}
    234240
     
    804810
    805811        dbDelta($sql); // unfortunately there are no results; errors will be 'shown' by default
     812       
     813        // version 1.7 effectively wiped out whatever category the user had previously chosen to be acknowledged.
     814        // attempt to mitigate that error by looking to see if the option still exists, yet no categories have yet been selected.
     815        $oldSingleCategoryId = get_option($this->shortname . '_category', '');
     816        $rnu_cat_tablename = $wpdb->prefix . "rnu_categories";
     817        $sql = " Select * from $rnu_cat_tablename;";
     818        $results = $wpdb->get_results($sql);
     819        $rows_total = $wpdb->num_rows;
     820       
     821        if ($oldSingleCategoryId != false ) {
     822            if ($rows_total == 0) {
     823               //does not appear that user has set categories (but could have deselected all)
     824                if (!is_array($oldSingleCategoryId)) {
     825                    $oldSingleCategoryId = (int) $oldSingleCategoryId; // make sure it is a number
     826                    // echo "<br/>                      need to update categories with $oldSingleCategoryId <br/>";
     827                    $this->rnudb_addCategory($oldSingleCategoryId);
     828                 } else {
     829                    // echo "<br/>              looks like old single category is an array <br/>";
     830                }
     831            } else {
     832                // echo "<br/>                Looks like categories have already been chosen <br/>";
     833            }
     834        } else {
     835           // \ echo "<br/>                Looks as though category option has not been set at all <br/>";
     836        }
    806837       
    807838        update_option('rnu_plugin_version', $this->rnu_plugin_version); // update to the current version regardless of existing version whihc has already been checked.
  • read-and-understood/trunk/readme.txt

    r1780467 r1781539  
    55Requires at least: 3.0
    66
    7 Stable tag: 1.8
     7Stable tag: 1.9
    88
    99Tested up to: 4.9
     
    1616
    1717== Upgrade Notice ==
     18V1.9 attempts to mitigate an error whereby users of the plugin using a version earlier than V1.7 may have
     19had lost their category selections.  Please go into Settings => Read and Understood from your WP-Admin page
     20and ensure that the categories that you what acknowleged are in fact selected.
     21
    1822Now allows the use of a shortcode [rnu_ack] which will add the READ AND UNDERSTOOD button to any post regardless of category selecte.
    1923
Note: See TracChangeset for help on using the changeset viewer.