From d9bb04b5a05be412ea4b8801d46e35907039d4fc Mon Sep 17 00:00:00 2001 From: matt Date: Sun, 7 Aug 2005 19:23:41 +0000 Subject: [PATCH] Adding personal options git-svn-id: http://svn.automattic.com/wordpress/trunk@2760 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/menu.php | 15 +-- wp-admin/options-discussion.php | 134 ++++++++++----------- wp-admin/options-general.php | 172 +++++++++++++-------------- wp-admin/options-misc.php | 114 +++++++++--------- wp-admin/options-permalink.php | 2 +- wp-admin/options-personal-update.php | 16 +++ wp-admin/options-personal.php | 35 ++++++ wp-admin/options-reading.php | 96 +++++++-------- wp-admin/options-writing.php | 102 ++++++++-------- wp-includes/functions.php | 16 +++ 10 files changed, 385 insertions(+), 317 deletions(-) create mode 100644 wp-admin/options-personal-update.php create mode 100644 wp-admin/options-personal.php diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 4c5d09c9b..ae890545c 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -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'); diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index e3732ecf1..fcc3cb1be 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.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'); @@ -19,82 +19,82 @@ if ($action == 'retrospam') { ?>
-

-
- - +

+
- (These settings may be overridden for individual articles.)') ?> -
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
+(These settings may be overridden for individual articles.)') ?> +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
- -
    -
  • - -
  • -
  • - -
  • -
+ +
    +
  • + +
  • +
  • + +
  • +
- -
    -
  • - -
  • -
  • -
  • -
+ +
    +
  • + +
  • +
  • +
  • +
- -

' ) ?>

+ +

' ) ?>

-

Common spam words.') ?>

-

- -

-

- -

+

Common spam words.') ?>

+

+ +

+

+ +

- -

-

- -

-

+ +

+

+ +

+

-

- -

-
+

+ + + +

+
\ No newline at end of file diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index d435f6719..a5a5c15bb 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -2,109 +2,109 @@ require_once('admin.php'); $title = __('General Options'); -$parent_file = 'options-general.php'; +$parent_file = 'options-personal.php'; include('admin-header.php'); ?>
-

-
- - - - - - - - - -
-
+

+ + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - + + + - - - - - -
+

-
+

+

- +

+
-
-
- - - - - - - - - - - - - - - - - + + + + +
UTC time is:') ?>
-
 PHP date() function. Save option to update sample output.') ?>

+
+
+
+ + + + + + + + + + + + + + + + + - - - - + + + - - - - + + - +
UTC time is:') ?>
+
 PHP date() function. Save option to update sample output.') ?>


+

-
-

- -

- +
+

+ +

+ diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index d5ac5a492..2229042c3 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.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,62 +10,62 @@ include('admin-header.php');

-
- - -
- - /> - - - - - - - - - - - - - - - - - - - - - - -
-
- %s'), ABSPATH . 'wp-content') ?> - -
-
- %s'), get_settings('siteurl') . '/wp-content') ?> -
-
-
- jpg jpeg png gif') ?>
-
-

/> -

-

- -

-

- -

+ +
+ + /> + + + + + + + + + + + + + + + + + + + + + + +
+
+%s'), ABSPATH . 'wp-content') ?> + +
+
+%s'), get_settings('siteurl') . '/wp-content') ?> +
+
+
+jpg jpeg png gif') ?>
+
+

/> +

+

+ +

+

+ + + +

diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index eb135bfcb..0ad0775b0 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -2,7 +2,7 @@ require_once('admin.php'); $title = __('Permalink Options'); -$parent_file = 'options-general.php'; +$parent_file = 'options-personal.php'; function add_js() { ?> diff --git a/wp-admin/options-personal-update.php b/wp-admin/options-personal-update.php new file mode 100644 index 000000000..d0c7a98b0 --- /dev/null +++ b/wp-admin/options-personal-update.php @@ -0,0 +1,16 @@ +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); +} + +?> \ No newline at end of file diff --git a/wp-admin/options-personal.php b/wp-admin/options-personal.php new file mode 100644 index 000000000..e8d8c2d89 --- /dev/null +++ b/wp-admin/options-personal.php @@ -0,0 +1,35 @@ + + +
+

+
+

+

+ + + + + + + + + + +
We should really figure out what else to put here.
+ + +

+ +

+
+
+ \ No newline at end of file diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index b9b493387..2bd7a45e5 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.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,54 +10,54 @@ include('admin-header.php');

- - -
- - - - - - -
- - -
-
+
+ + + + + + +
+ + +
+
-
- - - - - - - - - - -
-
- -
-
- - - - - -

- recommended)') ?>
-

- -

-

- -

+
+ + + + + + + + + + +
+
+ +
+
+ + + + + +

+recommended)') ?>
+

+ +

+

+ + + +

\ No newline at end of file diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index e01202126..b8cf448bc 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -2,22 +2,20 @@ require_once('admin.php'); $title = __('Writing Options'); -$parent_file = 'options-general.php'; +$parent_file = 'options-personal.php'; include('admin-header.php'); ?>
-

-
- - - - - - - +

+ +
-
+ + + + - - - + + - + +
+
@@ -29,46 +27,46 @@ include('admin-header.php'); :-) and :-P to graphics on display') ?>
- -

%s, %s, %s.'), substr(md5(uniqid(microtime())),0,5), substr(md5(uniqid(microtime())),0,5), substr(md5(uniqid(microtime())),0,5)) ?>

- - - - - - - - - - - - - - - - - + +
- - -
- -
+ + + + + + + + + + + + + + + - -
+ + +
+ +
+
- -

Update Services on the Codex. Separate multiple service URIs with line breaks.') ?>

- - + +

Update Services on the Codex. Separate multiple service URIs with line breaks.') ?>

+ +
-

- +

+ + +

- + \ No newline at end of file diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 69096ad14..d7043dfc0 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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') {