Adding personal options
git-svn-id: http://svn.automattic.com/wordpress/trunk@2760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
851ac5a414
commit
d9bb04b5a0
|
@ -11,7 +11,7 @@ $menu[20] = array(__('Links'), 'manage_links', 'link-manager.php');
|
|||
$menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php');
|
||||
$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
|
||||
$menu[35] = array(__('Users'), 'read', 'profile.php');
|
||||
$menu[40] = array(__('Options'), 'manage_options', 'options-general.php');
|
||||
$menu[40] = array(__('Options'), 'read', 'options-personal.php');
|
||||
|
||||
if ( get_option('use_fileupload') )
|
||||
$menu[45] = array(__('Upload'), 'upload_files', 'upload.php');
|
||||
|
@ -35,12 +35,13 @@ $submenu['link-manager.php'][20] = array(__('Import Links'), 'manage_links', 'li
|
|||
$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
|
||||
$submenu['profile.php'][10] = array(__('Authors & Users'), 'edit_users', 'users.php');
|
||||
|
||||
$submenu['options-general.php'][5] = array(__('General'), 'manage_options', 'options-general.php');
|
||||
$submenu['options-general.php'][10] = array(__('Writing'), 'manage_options', 'options-writing.php');
|
||||
$submenu['options-general.php'][15] = array(__('Reading'), 'manage_options', 'options-reading.php');
|
||||
$submenu['options-general.php'][20] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
|
||||
$submenu['options-general.php'][25] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
|
||||
$submenu['options-general.php'][30] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
|
||||
$submenu['options-personal.php'][5] = array(__('Personal'), 'read', 'options-personal.php');
|
||||
$submenu['options-personal.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
|
||||
$submenu['options-personal.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
|
||||
$submenu['options-personal.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
|
||||
$submenu['options-personal.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
|
||||
$submenu['options-personal.php'][30] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
|
||||
$submenu['options-personal.php'][35] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
|
||||
|
||||
$submenu['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
|
||||
$submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin-editor.php');
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Discussion Options');
|
||||
$parent_file = 'options-general.php';
|
||||
$parent_file = 'options-personal.php';
|
||||
|
||||
include('admin-header.php');
|
||||
|
||||
|
@ -20,9 +20,7 @@ if ($action == 'retrospam') {
|
|||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Discussion Options') ?></h2>
|
||||
<form name="form1" method="post" action="options.php">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','comment_whitelist','comment_max_links','moderation_keys','blacklist_keys','open_proxy_check'" />
|
||||
<form method="post" action="options.php">
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Usual settings for an article: <em>(These settings may be overridden for individual articles.)</em>') ?></legend>
|
||||
<ul>
|
||||
|
@ -93,6 +91,8 @@ if ($action == 'retrospam') {
|
|||
<?php _e('Blacklist comments from open and insecure proxies.') ?></label></p>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','comment_whitelist','comment_max_links','moderation_keys','blacklist_keys','open_proxy_check'" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('General Options');
|
||||
$parent_file = 'options-general.php';
|
||||
$parent_file = 'options-personal.php';
|
||||
|
||||
include('admin-header.php');
|
||||
?>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Miscellaneous Options');
|
||||
$parent_file = 'options-general.php';
|
||||
$parent_file = 'options-personal.php';
|
||||
|
||||
include('admin-header.php');
|
||||
|
||||
|
@ -10,9 +10,7 @@ include('admin-header.php');
|
|||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Miscellaneous Options') ?></h2>
|
||||
<form name="miscoptions" method="post" action="options.php">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'hack_file','use_fileupload','fileupload_realpath','fileupload_url','fileupload_allowedtypes','fileupload_maxk','fileupload_maxk','fileupload_minlevel','use_geo_positions','use_linksupdate'" />
|
||||
<form method="post" action="options.php">
|
||||
<fieldset class="options">
|
||||
<legend>
|
||||
<input name="use_fileupload" type="checkbox" id="use_fileupload" value="1" <?php checked('1', get_settings('use_fileupload')); ?> />
|
||||
|
@ -64,6 +62,8 @@ include('admin-header.php');
|
|||
<label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_settings('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'hack_file','use_fileupload','fileupload_realpath','fileupload_url','fileupload_allowedtypes','fileupload_maxk','fileupload_maxk','fileupload_minlevel','use_geo_positions','use_linksupdate'" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> »" />
|
||||
</p>
|
||||
</form>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Permalink Options');
|
||||
$parent_file = 'options-general.php';
|
||||
$parent_file = 'options-personal.php';
|
||||
|
||||
function add_js() {
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
require_once('admin.php');
|
||||
|
||||
if ( isset( $_POST['action'] ) ) {
|
||||
if ( !isset( $_POST['rich_editing'] ) )
|
||||
$_POST['rich_editing'] = 'false';
|
||||
update_user_option( $current_user->id, 'rich_editing', $wpdb->escape($_POST['rich_editing']), true );
|
||||
do_action('personal_options_update');
|
||||
|
||||
$goback = add_query_arg('updated', 'true', $_SERVER['HTTP_REFERER']);
|
||||
$goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
|
||||
wp_redirect($goback);
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$title = __('Personal Options');
|
||||
$parent_file = 'options-personal.php';
|
||||
|
||||
include('admin-header.php');
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Personal Options') ?></h2>
|
||||
<form id="personal-options" method="post" action="options-personal-update.php">
|
||||
<p><?php _e('Personal options are just for you, they don’t affect other users on blog.'); ?><input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'rich_editing'<?php do_action('personal_option_list'); ?>" /></p>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"><?php _e('Editing:') ?></th>
|
||||
<td><label for="rich_editing">
|
||||
<input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', get_user_option('rich_editing')); ?> />
|
||||
<?php _e('Use the visual rich editor when writing') ?></label></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('More:') ?></th>
|
||||
<td>We should really figure out what else to put here.</td>
|
||||
</tr>
|
||||
<?php do_action('personal_options_table'); ?>
|
||||
</table>
|
||||
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Personal Options') ?> »" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php include('admin-footer.php'); ?>
|
|
@ -2,7 +2,7 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Reading Options');
|
||||
$parent_file = 'options-general.php';
|
||||
$parent_file = 'options-personal.php';
|
||||
|
||||
include('admin-header.php');
|
||||
?>
|
||||
|
@ -10,8 +10,6 @@ include('admin-header.php');
|
|||
<div class="wrap">
|
||||
<h2><?php _e('Reading Options') ?></h2>
|
||||
<form name="form1" method="post" action="options.php">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'posts_per_page','what_to_show','posts_per_rss','rss_use_excerpt','blog_charset','gzipcompression' " />
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Blog Pages') ?></legend>
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
|
||||
|
@ -56,6 +54,8 @@ include('admin-header.php');
|
|||
<?php _e('WordPress should compress articles (gzip) if browsers ask for them') ?></label>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'posts_per_page','what_to_show','posts_per_rss','rss_use_excerpt','blog_charset','gzipcompression' " />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> »" />
|
||||
</p>
|
||||
</form>
|
||||
|
|
|
@ -2,16 +2,14 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Writing Options');
|
||||
$parent_file = 'options-general.php';
|
||||
$parent_file = 'options-personal.php';
|
||||
|
||||
include('admin-header.php');
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Writing Options') ?></h2>
|
||||
<form name="form1" method="post" action="options.php">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'default_post_edit_rows','use_smilies','rich_editing','ping_sites','mailserver_url', 'mailserver_port','mailserver_login','mailserver_pass','default_category','default_email_category'" />
|
||||
<form method="post" action="options.php">
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
|
||||
<tr valign="top">
|
||||
<th width="33%" scope="row"> <?php _e('Size of the post box:') ?></th>
|
||||
|
@ -90,6 +88,8 @@ endforeach;
|
|||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="'default_post_edit_rows','use_smilies','rich_editing','ping_sites','mailserver_url', 'mailserver_port','mailserver_login','mailserver_pass','default_category','default_email_category'" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> »" />
|
||||
</p>
|
||||
</form>
|
||||
|
|
|
@ -299,6 +299,16 @@ function get_option($option) {
|
|||
return get_settings($option);
|
||||
}
|
||||
|
||||
function get_user_option( $option ) {
|
||||
global $wpdb, $current_user;
|
||||
if ( isset( $current_user->data->{$wpdb->prefix . $option} ) ) // Blog specific
|
||||
return $current_user->data->{$wpdb->prefix . $option};
|
||||
elseif ( isset( $current_user->data->{$option} ) ) // User specific and cross-blog
|
||||
return $current_user->data->{$option};
|
||||
else // Blog global
|
||||
return get_option( $option );
|
||||
}
|
||||
|
||||
function form_option($option) {
|
||||
echo htmlspecialchars( get_option($option), ENT_QUOTES );
|
||||
}
|
||||
|
@ -349,6 +359,12 @@ function update_option($option_name, $newvalue) {
|
|||
return true;
|
||||
}
|
||||
|
||||
function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
|
||||
global $wpdb;
|
||||
if ( !$global )
|
||||
$option_name = $wpdb->prefix . $option_name;
|
||||
return update_usermeta( $user_id, $option_name, $newvalue );
|
||||
}
|
||||
|
||||
// thx Alex Stapleton, http://alex.vort-x.net/blog/
|
||||
function add_option($name, $value = '', $description = '', $autoload = 'yes') {
|
||||
|
|
Loading…
Reference in New Issue