forked from jmhobbs/userping-for-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.php
More file actions
67 lines (58 loc) · 1.84 KB
/
options.php
File metadata and controls
67 lines (58 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
add_action( 'admin_menu', 'userping_modify_menu' );
function userping_modify_menu () {
add_options_page(
'UserPing',
'UserPing',
'administrator',
__FILE__,
'userping_settings_page'
);
add_action( 'admin_init', 'register_userping_settings' );
}
function register_userping_settings () {
register_setting( 'userping-settings-group', 'show-userping-graphic' );
register_setting( 'userping-settings-group', 'track-logged-in-administrators' );
}
function userping_settings_page() {
$show_userping_graphic = '';
if( (bool) get_option( 'show-userping-graphic' ) )
$show_userping_graphic = ' selected="selected" ';
$track_logged_in_administrators = '';
if( (bool) get_option( 'track-logged-in-administrators' ) )
$track_logged_in_administrators = ' selected="selected" ';
?>
<div class="wrap">
<h2>UserPing</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row">Show The UserPing Graphic</th>
<td>
<select name="show-userping-graphic">
<option value="0">No</option>
<option value="1" <?php echo $show_userping_graphic; ?>>Yes</option>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row">Track Logged In Administrators</th>
<td>
<select name="track-logged-in-administrators">
<option value="0">No</option>
<option value="1" <?php echo $track_logged_in_administrators; ?>>Yes</option>
</select>
</td>
</tr>
</table>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="show-userping-graphic,track-logged-in-administrators" />
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>
<?php
}
?>