WordPress.org

Make WordPress Core

Changeset 21852


Ignore:
Timestamp:
09/14/12 21:00:39 (20 months ago)
Author:
nacin
Message:

Hide upload_path and upload_url_path from the Media Settings screen, assuming they are both set to their default values.

These can be set on options.php, or the UPLOADS constant or the filters in wp_upload_dir() should be used. WordPress should aim to avoid UI options that require filesystem changes as well, not to mention requiring the user to convert between paths and URLs.

fixes #21720.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-media.php

    r20605 r21852  
    122122<h3><?php _e('Uploading Files'); ?></h3> 
    123123<table class="form-table"> 
     124<?php 
     125// If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty) 
     126if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) : 
     127?> 
    124128<tr valign="top"> 
    125129<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th> 
     
    135139</td> 
    136140</tr> 
    137  
     141<?php endif; ?> 
    138142<tr> 
    139143<th scope="row" colspan="2" class="th-full"> 
  • trunk/wp-admin/options.php

    r21849 r21852  
    6969 
    7070$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); 
    71 $uploads_options = array('uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path'); 
    7271 
    7372if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) 
     
    8786    $whitelist_options['writing'][] = 'ping_sites'; 
    8887 
    89     $whitelist_options['media'] = array_merge($whitelist_options['media'], $uploads_options); 
     88    $whitelist_options['media'][] = 'uploads_use_yearmonth_folders'; 
     89 
     90    // If upload_url_path and upload_path are both default values, they're locked. 
     91    if ( get_option( 'upload_url_path' ) || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) { 
     92        $whitelist_options['media'][] = 'upload_path'; 
     93        $whitelist_options['media'][] = 'upload_url_path'; 
     94    } 
    9095} else { 
    9196    $whitelist_options['general'][] = 'new_admin_email'; 
Note: See TracChangeset for help on using the changeset viewer.