Skip to content
This repository was archived by the owner on Oct 9, 2018. It is now read-only.

Commit 0b6661a

Browse files
author
Shane Tomlinson
committed
Fix Get_option to return the default value if the option exists but is empty.
fixes #51
1 parent 7b23947 commit 0b6661a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

browserid.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -913,13 +913,11 @@ function Options_main() {
913913
}
914914

915915
// Print a text input for a plugin option
916-
function Print_option_text_input($id, $default_value = null, $info = null) {
917-
$options = get_option('browserid_options');
918-
$option_value = (empty($options[$id]) ? '' : $options[$id]);
919-
echo sprintf("<input id='%s' name='browserid_options[%s]'
920-
type='text' size='50' value='%s' />",
921-
$id,
922-
$id,
916+
function Print_option_text_input($option_name, $default_value = null, $info = null) {
917+
$option_value = $this->Get_option($option_name, $default_value);
918+
echo sprintf("<input id='%s' name='browserid_options[%s]' type='text' size='50' value='%s' />",
919+
$option_name,
920+
$option_name,
923921
htmlspecialchars($option_value, ENT_QUOTES));
924922

925923
if ($info) {
@@ -932,8 +930,10 @@ function Print_option_text_input($id, $default_value = null, $info = null) {
932930
// default value
933931
function Get_option($option_name, $default_value = '') {
934932
$options = get_option('browserid_options');
935-
if (isset($options[$option_name]))
933+
if (isset($options[$option_name])
934+
&& !empty($options[$option_name])) {
936935
return $options[$option_name];
936+
}
937937
return $default_value;
938938
}
939939

@@ -1041,7 +1041,7 @@ function Option_comment_html() {
10411041
}
10421042

10431043
function Get_option_comment_html() {
1044-
return $this->get_option('browserid_comment_html', __('post comment', c_bid_text_domain));
1044+
return $this->Get_option('browserid_comment_html', __('post comment', c_bid_text_domain));
10451045
}
10461046

10471047
// Enable bbPress integration

0 commit comments

Comments
 (0)