Changeset 997280
- Timestamp:
- 09/26/2014 04:49:25 PM (11 years ago)
- Location:
- subscribr/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (2 diffs)
-
subscribr.php (modified) (21 diffs)
-
views/profile-fields.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subscribr/trunk/readme.txt
r990616 r997280 5 5 Requires at least: 3.8 6 6 Tested up to: 4.0 7 Stable tag: 0.1.9 7 Stable tag: 0.1.9.1 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 77 77 == Changelog == 78 78 79 = 0.1.9.1 = 80 * Bugfixes for terms selctions 81 * Added subscribr_disabled_terms filter 82 79 83 = 0.1.9 = 80 84 * Fix for auto-draft status. -
subscribr/trunk/subscribr.php
r990613 r997280 4 4 Plugin URI: https://mindsharelabs.com/downloads/subscribr/ 5 5 Description: Allows WordPress users to subscribe to email notifications for new posts, pages, and custom types, filterable by taxonomies. 6 Version: 0.1.9 6 Version: 0.1.9.1 7 7 Author: Mindshare Studios, Inc. 8 8 Author URI: http://mind.sh/are/ … … 35 35 * Changelog: 36 36 * 37 * 0.1.9.1 - Bugfixes for terms selections, added subscribr_disabled_terms filter 37 38 * 0.1.9 - Bugfix for auto-draft action 38 39 * 0.1.8 - Bugfix for email sends using default settings … … 40 41 * 0.1.5 - CSS fixes, verified PHP 5.3 support, updated Chosen JS library, update screenshots, bugfix for removing user prefs 41 42 * 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 43 45 * 0.1.2 - bugfix for subscribr_profile_title filter, 44 46 * 0.1.1 - Minor updates, fixed date_format, fix for only one notification getting sent … … 89 91 } 90 92 91 if(!class_exists("Subscribr")) :93 if(!class_exists("Subscribr")) { 92 94 93 95 /** … … 101 103 * @var string 102 104 */ 103 private $version = '0.1.9 ';105 private $version = '0.1.9.1'; 104 106 105 107 /** … … 269 271 array_unshift($links, $settingslink); 270 272 } 273 271 274 return $links; 272 275 } … … 313 316 // determine what taxonomies are enabled for email notification, if any 314 317 $enabled_taxonomies = $this->get_enabled_taxonomies(); 318 $enabled_terms = $this->get_enabled_terms(); 315 319 316 320 if(!is_array($enabled_taxonomies)) { … … 413 417 public function queue_notifications($post_id) { 414 418 415 416 417 419 // different WP hooks will send either the post ID or the actual post object, so we need to test for both cases 418 420 if(is_a($post_id, 'WP_Post')) { … … 421 423 422 424 if((array_key_exists('subscribr_opt_out', $_POST) && !$this->is_true($_POST['subscribr_opt_out'])) || !array_key_exists('subscribr_opt_out', $_POST)) { 423 424 425 425 426 if(!wp_is_post_revision($post_id)) { … … 495 496 $notify_user_ids = array_unique($notify_user_ids, SORT_NUMERIC); 496 497 497 498 498 if(!empty($notify_user_ids)) { 499 499 … … 666 666 } 667 667 closedir($handle); 668 668 669 return $files; 669 670 } else { … … 717 718 $notice = __('Could not copy the template files. Could not create the target directory. Try copying the files manually or checking your file permissions. ', 'subscribr'); 718 719 $this->admin_notice($notice, 'error'); 720 719 721 return new WP_Error('mkdir_failed', $notice); 720 722 } … … 723 725 $notice = __('Could not copy the template files. The target directory already exists.', 'subscribr'); 724 726 $this->admin_notice($notice); 727 725 728 return new WP_Error('mkdir_failed', $notice); 726 729 } … … 753 756 754 757 /** 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 /** 755 770 * Determine what post types are enabled for email notification, if any. 756 771 * … … 784 799 $enabled_terms = $this->get_option('enabled_terms'); 785 800 $all_taxonomies = $this->get_default_taxonomies(); 801 $enabled_taxonomies = array(); 786 802 787 803 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 788 819 // 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; 790 825 } elseif($enabled_terms) { 791 $enabled_taxonomies = array();792 826 793 827 // this bit gets nasty because, surprisingly, there is no … … 815 849 $enabled_taxonomies = array_unique($enabled_taxonomies); 816 850 851 //mapi_var_dump($enabled_taxonomies,1); 817 852 // return all user enabled taxonomies 818 853 return $enabled_taxonomies; … … 821 856 return FALSE; 822 857 } 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; 823 873 } 824 874 … … 834 884 835 885 $taxonomies = array_diff($taxonomies, $disabled_taxonomies); 886 836 887 return $taxonomies; 837 888 } … … 966 1017 if($options) { 967 1018 $options[$name] = $value; 1019 968 1020 return update_option(SUBSCRIBR_OPTIONS, $options); 969 1021 } … … 986 1038 if($options) { 987 1039 $options[$name] = ''; 1040 988 1041 return update_option(SUBSCRIBR_OPTIONS, $options); 989 1042 } … … 1050 1103 return $string; 1051 1104 } 1105 1052 1106 return in_array(strtolower(trim($string)), $true_synonyms); 1053 1107 } 1054 1108 } 1055 endif; 1109 } 1056 1110 1057 1111 $subscribr = new Subscribr; 1058 1059 -
subscribr/trunk/views/profile-fields.php
r955031 r997280 16 16 echo apply_filters('subscribr_profile_table_open', '<table class="form-table '.SUBSCRIBR_PLUGIN_SLUG.'">'); 17 17 wp_nonce_field('subscribr_inner_custom_box', 'subscribr_inner_custom_box_nonce'); 18 18 19 ?> 19 20 … … 27 28 <option value=""></option> 28 29 <?php foreach($enabled_taxonomies as $taxonomy) : ?> 30 29 31 <?php $terms = get_terms($taxonomy, array('hide_empty' => FALSE)); ?> 30 32 <optgroup label="<?php $taxonomy_object = get_taxonomy($taxonomy); 31 33 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)) : ?> 33 35 <option <?php if($subscribed_terms && in_array($term->slug, $subscribed_terms)) : echo 'selected'; endif; ?> value="<?php echo $term->slug; ?>"><?php echo $term->name; ?></option> 34 36 <?php endif; endforeach; // end term loop ?>
Note: See TracChangeset
for help on using the changeset viewer.