Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Hide the link manager from the UI on upgrade, if the site has no link…

…s. New DB option, link_manager_enabled.

Enforce this by denying the 'manage_links' capability, which hides the All Links, Add New Link, and Link Categories screens. Hide WP_Widget_Links and the UI for the default_link_category as well.

Convert all references to 'posts and links' when handling reassignment on user deletion to just 'posts'.

see #21307.



git-svn-id: http://core.svn.wordpress.org/trunk@21501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
commit 84c3a8603652199f20e906d89ef464d6c3f934a9 1 parent 720e09f
@nacin nacin authored
View
3  wp-admin/includes/schema.php
@@ -481,6 +481,9 @@ function populate_options() {
// 3.1
'default_post_format' => 0,
+
+ // 3.5
+ 'link_manager_enabled' => 0,
);
// 3.3
View
15 wp-admin/includes/upgrade.php
@@ -399,6 +399,9 @@ function upgrade_all() {
if ( $wp_current_db_version < 20080 )
upgrade_340();
+ if ( $wp_current_db_version < 21501 )
+ upgrade_350();
+
maybe_disable_automattic_widgets();
update_option( 'db_version', $wp_db_version );
@@ -1182,6 +1185,18 @@ function upgrade_340() {
}
/**
+ * Execute changes made in WordPress 3.5.
+ *
+ * @since 3.5.0
+ */
+function upgrade_350() {
+ global $wp_current_db_version, $wpdb;
+
+ if ( $wp_current_db_version < 21501 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
+ update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
+}
+
+/**
* Execute network level changes
*
* @since 3.0.0
View
8 wp-admin/network/users.php
@@ -24,7 +24,7 @@ function confirm_delete_users( $users ) {
screen_icon();
?>
<h2><?php esc_html_e( 'Users' ); ?></h2>
- <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
+ <p><?php _e( 'Transfer or delete posts before deleting users.' ); ?></p>
<form action="users.php?action=dodelete" method="post">
<input type="hidden" name="dodelete" />
<?php
@@ -47,7 +47,7 @@ function confirm_delete_users( $users ) {
if ( !empty( $blogs ) ) {
?>
- <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
+ <br /><fieldset><p><legend><?php printf( __( "What should be done with posts owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
<?php
foreach ( (array) $blogs as $key => $details ) {
$blog_users = get_users( array( 'blog_id' => $details->userblog_id ) );
@@ -67,9 +67,9 @@ function confirm_delete_users( $users ) {
<ul style="list-style:none;">
<li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
- <?php _e( 'Delete all posts and links.' ); ?></label></li>
+ <?php _e( 'Delete all posts.' ); ?></label></li>
<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
- <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>
+ <?php echo __( 'Attribute all posts to:' ) . '</label>' . $user_dropdown; ?></li>
</ul>
<?php
}
View
7 wp-admin/options-writing.php
@@ -107,7 +107,10 @@
</select>
</td>
</tr>
-<?php endif; endif; ?>
+<?php endif; endif;
+
+if ( get_option( 'link_manager_enabled' ) ) :
+?>
<tr valign="top">
<th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
<td>
@@ -116,6 +119,8 @@
?>
</td>
</tr>
+<?php endif; ?>
+
<?php do_settings_fields('writing', 'default'); ?>
</table>
View
6 wp-admin/users.php
@@ -212,12 +212,12 @@
?>
</ul>
<?php if ( $go_delete ) : ?>
- <fieldset><p><legend><?php echo _n( 'What should be done with posts and links owned by this user?', 'What should be done with posts and links owned by these users?', $go_delete ); ?></legend></p>
+ <fieldset><p><legend><?php echo _n( 'What should be done with posts owned by this user?', 'What should be done with posts owned by these users?', $go_delete ); ?></legend></p>
<ul style="list-style:none;">
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
- <?php _e('Delete all posts and links.'); ?></label></li>
+ <?php _e('Delete all posts.'); ?></label></li>
<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
- <?php echo '<label for="delete_option1">'.__('Attribute all posts and links to:').'</label>';
+ <?php echo '<label for="delete_option1">'.__('Attribute all posts to:').'</label>';
wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
</ul></fieldset>
<input type="hidden" name="action" value="dodelete" />
View
6 wp-includes/capabilities.php
@@ -1226,6 +1226,12 @@ function map_meta_cap( $cap, $user_id ) {
else
$caps[] = 'do_not_allow';
break;
+ case 'manage_links' :
+ if ( get_option( 'link_manager_enabled' ) )
+ $caps[] = $cap;
+ else
+ $caps[] = 'do_not_allow';
+ break;
default:
// Handle meta capabilities for custom post types.
$post_type_meta_caps = _post_type_meta_capabilities();
View
3  wp-includes/default-widgets.php
@@ -1158,7 +1158,8 @@ function wp_widgets_init() {
register_widget('WP_Widget_Archives');
- register_widget('WP_Widget_Links');
+ if ( get_option( 'link_manager_enabled' ) )
+ register_widget('WP_Widget_Links');
register_widget('WP_Widget_Meta');
View
6 wp-includes/taxonomy.php
@@ -89,6 +89,12 @@ function create_initial_taxonomies() {
'add_or_remove_items' => null,
'choose_from_most_used' => null,
),
+ 'capabilities' => array(
+ 'manage_terms' => 'manage_links',
+ 'edit_terms' => 'manage_links',
+ 'delete_terms' => 'manage_links',
+ 'assign_terms' => 'manage_links',
+ ),
'query_var' => false,
'rewrite' => false,
'public' => false,
View
2  wp-includes/version.php
@@ -11,7 +11,7 @@
*
* @global int $wp_db_version
*/
-$wp_db_version = 20596;
+$wp_db_version = 21501;
/**
* Holds the TinyMCE version
Please sign in to comment.
Something went wrong with that request. Please try again.