Plugin Directory

Changeset 997280


Ignore:
Timestamp:
09/26/2014 04:49:25 PM (11 years ago)
Author:
mindshare
Message:

Bugfix release 0.1.9.1

Location:
subscribr/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • subscribr/trunk/readme.txt

    r990616 r997280  
    55Requires at least: 3.8
    66Tested up to: 4.0
    7 Stable tag: 0.1.9
     7Stable tag: 0.1.9.1
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    7777== Changelog ==
    7878
     79= 0.1.9.1 =
     80* Bugfixes for terms selctions
     81* Added subscribr_disabled_terms filter
     82
    7983= 0.1.9 =
    8084* Fix for auto-draft status.
  • subscribr/trunk/subscribr.php

    r990613 r997280  
    44Plugin URI: https://mindsharelabs.com/downloads/subscribr/
    55Description: Allows WordPress users to subscribe to email notifications for new posts, pages, and custom types, filterable by taxonomies.
    6 Version: 0.1.9
     6Version: 0.1.9.1
    77Author: Mindshare Studios, Inc.
    88Author URI: http://mind.sh/are/
     
    3535 * Changelog:
    3636 *
     37 * 0.1.9.1 - Bugfixes for terms selections, added subscribr_disabled_terms filter
    3738 * 0.1.9 - Bugfix for auto-draft action
    3839 * 0.1.8 - Bugfix for email sends using default settings
     
    4041 * 0.1.5 - CSS fixes, verified PHP 5.3 support, updated Chosen JS library, update screenshots, bugfix for removing user prefs
    4142 * 0.1.4 - Bugfixes for disabled post types
    42  * 0.1.3 - added custom email template options, added copy to theme folder option, added import/export options tab, added Type support & better Taxonomies support, fixes for WP 3.8, fixes to register screen, fix for is_register fn, disable main.js file for now, misc minor bugfixes
     43 * 0.1.3 - added custom email template options, added copy to theme folder option, added import/export options tab, added Type support & better Taxonomies support, fixes for WP 3.8, fixes to register
     44 * screen, fix for is_register fn, disable main.js file for now, misc minor bugfixes
    4345 * 0.1.2 - bugfix for subscribr_profile_title filter,
    4446 * 0.1.1 - Minor updates, fixed date_format, fix for only one notification getting sent
     
    8991}
    9092
    91 if(!class_exists("Subscribr")) :
     93if(!class_exists("Subscribr")) {
    9294
    9395    /**
     
    101103         * @var string
    102104         */
    103         private $version = '0.1.9';
     105        private $version = '0.1.9.1';
    104106
    105107        /**
     
    269271                array_unshift($links, $settingslink);
    270272            }
     273
    271274            return $links;
    272275        }
     
    313316            // determine what taxonomies are enabled for email notification, if any
    314317            $enabled_taxonomies = $this->get_enabled_taxonomies();
     318            $enabled_terms = $this->get_enabled_terms();
    315319
    316320            if(!is_array($enabled_taxonomies)) {
     
    413417        public function queue_notifications($post_id) {
    414418
    415 
    416 
    417419            // different WP hooks will send either the post ID or the actual post object, so we need to test for both cases
    418420            if(is_a($post_id, 'WP_Post')) {
     
    421423
    422424            if((array_key_exists('subscribr_opt_out', $_POST) && !$this->is_true($_POST['subscribr_opt_out'])) || !array_key_exists('subscribr_opt_out', $_POST)) {
    423 
    424425
    425426                if(!wp_is_post_revision($post_id)) {
     
    495496                    $notify_user_ids = array_unique($notify_user_ids, SORT_NUMERIC);
    496497
    497 
    498498                    if(!empty($notify_user_ids)) {
    499499
     
    666666                }
    667667                closedir($handle);
     668
    668669                return $files;
    669670            } else {
     
    717718                    $notice = __('Could not copy the template files. Could not create the target directory. Try copying the files manually or checking your file permissions. ', 'subscribr');
    718719                    $this->admin_notice($notice, 'error');
     720
    719721                    return new WP_Error('mkdir_failed', $notice);
    720722                }
     
    723725                $notice = __('Could not copy the template files. The target directory already exists.', 'subscribr');
    724726                $this->admin_notice($notice);
     727
    725728                return new WP_Error('mkdir_failed', $notice);
    726729            }
     
    753756
    754757        /**
     758         * Determine what taxonomy terms are enabled
     759         *
     760         */
     761        public function get_enabled_terms() {
     762            if($this->get_option('enable_all_terms')) {
     763                return $this->get_default_terms();
     764            } else {
     765                return $this->get_option('enabled_terms');
     766            }
     767        }
     768
     769        /**
    755770         * Determine what post types are enabled for email notification, if any.
    756771         *
     
    784799            $enabled_terms = $this->get_option('enabled_terms');
    785800            $all_taxonomies = $this->get_default_taxonomies();
     801            $enabled_taxonomies = array();
    786802
    787803            if($this->get_option('enable_all_terms')) {
     804
     805                $enabled_types = $this->get_enabled_types();
     806
     807                foreach($all_taxonomies as $tax) {
     808                    foreach($enabled_types as $type) {
     809
     810                        // check if the taxonomy is on an enabled post type
     811                        if(is_object_in_taxonomy($type, $tax)) {
     812
     813                            // if so, add it to our array
     814                            $enabled_taxonomies[] = $tax;
     815                        }
     816                    }
     817                }
     818
    788819                // return all available taxonomies
    789                 return $all_taxonomies;
     820                $enabled_taxonomies = array_unique($enabled_taxonomies);
     821
     822                // return all user enabled taxonomies
     823
     824                return $enabled_taxonomies;
    790825            } elseif($enabled_terms) {
    791                 $enabled_taxonomies = array();
    792826
    793827                // this bit gets nasty because, surprisingly, there is no
     
    815849                $enabled_taxonomies = array_unique($enabled_taxonomies);
    816850
     851                //mapi_var_dump($enabled_taxonomies,1);
    817852                // return all user enabled taxonomies
    818853                return $enabled_taxonomies;
     
    821856                return FALSE;
    822857            }
     858        }
     859
     860        /**
     861         * Setup the terms that are enabled by default.
     862         *
     863         */
     864        public function get_default_terms() {
     865            $terms = get_terms($this->get_default_taxonomies(), array('hide_empty' => FALSE, 'fields' => 'id=>slug'));
     866            $disabled_terms = array('uncategorized');
     867            $disabled_terms = apply_filters('subscribr_disabled_terms', $disabled_terms);
     868
     869            //mapi_var_dump($terms,1);
     870            $terms = array_diff($terms, $disabled_terms);
     871
     872            return $terms;
    823873        }
    824874
     
    834884
    835885            $taxonomies = array_diff($taxonomies, $disabled_taxonomies);
     886
    836887            return $taxonomies;
    837888        }
     
    9661017            if($options) {
    9671018                $options[$name] = $value;
     1019
    9681020                return update_option(SUBSCRIBR_OPTIONS, $options);
    9691021            }
     
    9861038            if($options) {
    9871039                $options[$name] = '';
     1040
    9881041                return update_option(SUBSCRIBR_OPTIONS, $options);
    9891042            }
     
    10501103                return $string;
    10511104            }
     1105
    10521106            return in_array(strtolower(trim($string)), $true_synonyms);
    10531107        }
    10541108    }
    1055 endif;
     1109}
    10561110
    10571111$subscribr = new Subscribr;
    1058 
    1059 
  • subscribr/trunk/views/profile-fields.php

    r955031 r997280  
    1616echo apply_filters('subscribr_profile_table_open', '<table class="form-table '.SUBSCRIBR_PLUGIN_SLUG.'">');
    1717wp_nonce_field('subscribr_inner_custom_box', 'subscribr_inner_custom_box_nonce');
     18
    1819?>
    1920
     
    2728                    <option value=""></option>
    2829                    <?php foreach($enabled_taxonomies as $taxonomy) : ?>
     30
    2931                        <?php $terms = get_terms($taxonomy, array('hide_empty' => FALSE)); ?>
    3032                        <optgroup label="<?php $taxonomy_object = get_taxonomy($taxonomy);
    3133                        echo $taxonomy_object->labels->name; ?>">
    32                             <?php foreach($terms as $term) : if($term->slug != 'uncategorized') : ?>
     34                            <?php foreach($terms as $term) : if(in_array($term->slug, $enabled_terms)) : ?>
    3335                                <option <?php if($subscribed_terms && in_array($term->slug, $subscribed_terms)) : echo 'selected'; endif; ?> value="<?php echo $term->slug; ?>"><?php echo $term->name; ?></option>
    3436                            <?php endif; endforeach; // end term loop ?>
Note: See TracChangeset for help on using the changeset viewer.