Private Suite 2.0
-
Patch to fix current known problems
- exclude pages from auto-privatization; should not be needed, but I had pages which were becoming stuck as private after being edited
- allow trashing of private posts
- fix inclusion of prefixes in titles
- fix display of protected prefix
diff -ru private-suite/private-suite.php /home/scisci/www/wp-content/plugins/private-suite/private-suite.php --- private-suite/private-suite.php 2011-12-13 01:07:29.000000000 -0600 +++ /home/scisci/www/wp-content/plugins/private-suite/private-suite.php 2013-07-17 08:50:47.000000000 -0500 @@ -3,7 +3,7 @@ Plugin Name: Private Suite Plugin URI: https://sillybean.net/code/wordpress/private-suite/ Description: Allows admins to add private pages to <code>wp_list_pages()</code>, <code>wp_page_menu()</code>, and the Pages widget or use a separate <code>wp_list_private_pages()</code> tag; specify the prefix on private and password-protected titles; create private categories; and choose which user roles may read private pages and posts. -Version: 2.0 +Version: 2.0+ Author: Stephanie Leary, patched by Jerrad Pierce & Jeff Cohan Author URI: https://sillybean.net/ License: GPL2 @@ -64,16 +64,16 @@ /*------------------------ Set Prefixes ------------------------*/ add_filter('private_title_format', 'private_suite_custom_private_title'); -function private_suite_custom_private_title() { +function private_suite_custom_private_title($title) { $options = private_suite_get_options(); - return $options['private_title_prefix']; + return $options['private_title_prefix'] . '%s'; } add_filter('protected_title_format', 'private_suite_custom_protected_title'); -function private_suite_custom_protected_title() { +function private_suite_custom_protected_title($title) { $options = private_suite_get_options(); - return $options['protected_title_prefix']; + return $options['protected_title_prefix'] . $title; } /*---------------------- Private Categories -----------------------*/ @@ -83,7 +83,9 @@ if ($parent_id = wp_is_post_revision($postid)) $postid = $parent_id; $options = get_option('private_suite'); - if (in_category($options['categories'], $postid)) { + if( get_post_status($postid) != 'trash' && + get_post_type($postid) != 'page' && + in_category($options['categories'], $postid)) { // unhook this function so it doesn't loop infinitely, update the post, then re-hook remove_action('save_post', 'set_private_categories', 10, 1); wp_update_post(array('ID' => $postid, 'post_status' => 'private')); @@ -228,7 +230,7 @@ <p><label for="private_title_prefix"><?php _e( 'Prefix for private post and page titles:' , 'private-suite'); ?></label><br /> <input type="text" id="private_title_prefix" name="private_suite[private_title_prefix]" value="<?php esc_attr_e($options['private_title_prefix']); ?>" /></p> <p><label for="protected_title_prefix"><?php _e( 'Prefix for password-protected post and page titles:' , 'private-suite'); ?></label><br /> - <input type="text" id="protected_title_prefix" name="private_suite[protected_title_prefix]" value="<?php esc_attr_e($options['private_title_prefix']); ?>" /></p> + <input type="text" id="protected_title_prefix" name="private_suite[protected_title_prefix]" value="<?php esc_attr_e($options['protected_title_prefix']); ?>" /></p> <p><label for="private_suite_filter"><input type="checkbox" value="1" name="private_suite[private_suite_filter]" <?php checked($options['private_suite_filter']); ?> /> <?php _e('Try to add private pages to <code>wp_list_pages()</code>, <code>wp_page_menu()</code>, and the Pages widget.', 'private-suite'); ?></label><br />
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Private Suite 2.0’ is closed to new replies.