Remove Dashboard Access - Version 1.1.1

Version Description

Bug Fix:

  • Move options back to Settings > Dashboard Access screen to resolve conflict with page_on_front UI.
Download this release

Release Info

Developer DrewAPicture
Plugin Icon 128x128 Remove Dashboard Access
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1 to 1.1.1

inc/class.rda-options.php CHANGED
@@ -56,8 +56,9 @@ class RDA_Options {
56
  );
57
 
58
  // Settings.
59
- add_action( 'admin_init', array( $this, 'settings' ) );
60
- add_action( 'admin_head-options-reading.php', array( $this, 'access_switch_js' ) );
 
61
 
62
  // Settings link in plugins list.
63
  add_filter( 'plugin_action_links', array( $this, 'settings_link' ), 10, 2 );
@@ -128,6 +129,46 @@ class RDA_Options {
128
  }
129
  }
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  /**
132
  * Register settings and settings sections.
133
  *
@@ -138,7 +179,7 @@ class RDA_Options {
138
  */
139
  public function settings() {
140
  // Dashboard Access Controls section.
141
- add_settings_section( 'rda_options', __( 'Dashboard Access Controls', 'remove_dashbord_access' ), array( $this, 'settings_section' ), 'reading' );
142
 
143
  // Settings.
144
  $sets = array(
@@ -165,16 +206,16 @@ class RDA_Options {
165
  );
166
 
167
  foreach ( $sets as $id => $settings ) {
168
- add_settings_field( $id, $settings['label'], array( $this, $settings['callback'] ), 'reading', 'rda_options' );
169
 
170
  // Pretty lame that we need separate sanitize callbacks for everything.
171
  $sanitize_callback = str_replace( 'rda', 'sanitize', $id );
172
- register_setting( 'reading', $id, array( $this, $sanitize_callback ) );
173
  };
174
 
175
  // Debug info "setting".
176
  if ( ! empty( $_GET['rda_debug'] ) ) {
177
- add_settings_field( 'rda_debug_mode', __( 'Debug Info', 'remove_dashboard_access' ), array( $this, '_debug_mode' ), 'reading', 'rda_options' );
178
  }
179
 
180
  }
@@ -513,10 +554,10 @@ class RDA_Options {
513
  // WordPress.org slug.
514
  if ( 'remove-dashboard-access-for-non-admins/remove-dashboard-access.php' == $file
515
  // GitHub slug
516
- || 'remove-dashboard-access/remove-dashboard-access' == $file
517
  ) {
518
  array_unshift( $links, sprintf( '<a href="%1$s">%2$s</a>',
519
- admin_url( 'options-reading.php#dashboard-access' ),
520
  esc_html__( 'Settings', 'remove_dashboard_access' )
521
  ) );
522
  }
56
  );
57
 
58
  // Settings.
59
+ add_action( 'admin_menu', array( $this, 'options_page' ) );
60
+ add_action( 'admin_init', array( $this, 'settings' ) );
61
+ add_action( 'admin_head-settings_page_dashboard-access', array( $this, 'access_switch_js' ) );
62
 
63
  // Settings link in plugins list.
64
  add_filter( 'plugin_action_links', array( $this, 'settings_link' ), 10, 2 );
129
  }
130
  }
131
 
132
+ /**
133
+ * Options page: Remove Access
134
+ *
135
+ * @since 1.1.1
136
+ *
137
+ * @uses add_options_page() to add a sub-menu under 'Settings'
138
+ */
139
+ function options_page() {
140
+ add_options_page(
141
+ __( 'Dashboard Access Settings', 'remove_dashboard_access' ),
142
+ __( 'Dashboard Access', 'remove_dashboard_access' ),
143
+ 'manage_options',
144
+ 'dashboard-access',
145
+ array( $this, 'options_page_cb' )
146
+ );
147
+ }
148
+
149
+ /**
150
+ * Options page: callback
151
+ *
152
+ * Outputs the form for the 'Remove Access' submenu
153
+ *
154
+ * @since 1.1.1
155
+ */
156
+ function options_page_cb() {
157
+ ?>
158
+ <div class="wrap">
159
+ <?php screen_icon(); ?>
160
+ <h2><?php _e( 'Dashboard Access Settings', 'remove_dashboard_access' ); ?></h2>
161
+ <form action="options.php" method="POST" id="rda-options-form">
162
+ <?php
163
+ settings_fields( 'dashboard-access' );
164
+ do_settings_sections( 'dashboard-access' );
165
+ submit_button();
166
+ ?>
167
+ </form>
168
+ </div><!-- .wrap -->
169
+ <?php
170
+ }
171
+
172
  /**
173
  * Register settings and settings sections.
174
  *
179
  */
180
  public function settings() {
181
  // Dashboard Access Controls section.
182
+ add_settings_section( 'rda_options', __( 'Dashboard Access Controls', 'remove_dashbord_access' ), array( $this, 'settings_section' ), 'dashboard-access' );
183
 
184
  // Settings.
185
  $sets = array(
206
  );
207
 
208
  foreach ( $sets as $id => $settings ) {
209
+ add_settings_field( $id, $settings['label'], array( $this, $settings['callback'] ), 'dashboard-access', 'rda_options' );
210
 
211
  // Pretty lame that we need separate sanitize callbacks for everything.
212
  $sanitize_callback = str_replace( 'rda', 'sanitize', $id );
213
+ register_setting( 'dashboard-access', $id, array( $this, $sanitize_callback ) );
214
  };
215
 
216
  // Debug info "setting".
217
  if ( ! empty( $_GET['rda_debug'] ) ) {
218
+ add_settings_field( 'rda_debug_mode', __( 'Debug Info', 'remove_dashboard_access' ), array( $this, '_debug_mode' ), 'dashboard-access', 'rda_options' );
219
  }
220
 
221
  }
554
  // WordPress.org slug.
555
  if ( 'remove-dashboard-access-for-non-admins/remove-dashboard-access.php' == $file
556
  // GitHub slug
557
+ || 'remove-dashboard-access/remove-dashboard-access.php' == $file
558
  ) {
559
  array_unshift( $links, sprintf( '<a href="%1$s">%2$s</a>',
560
+ admin_url( 'options-general.php?page=dashboard-access' ),
561
  esc_html__( 'Settings', 'remove_dashboard_access' )
562
  ) );
563
  }
languages/remove-dashboard-access.mo CHANGED
Binary file
languages/remove-dashboard-access.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Remove Dashboard Access\n"
4
- "POT-Creation-Date: 2014-07-14 20:21-0700\n"
5
- "PO-Revision-Date: 2014-07-14 20:22-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: Drew Jaynes (DrewAPicture) <info@drewapicture.com>\n"
8
  "Language: en\n"
@@ -15,102 +15,110 @@ msgstr ""
15
  "X-Poedit-Basepath: ../\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
- #: inc/class.rda-options.php:56
19
  msgid "This site is in maintenance mode."
20
  msgstr ""
21
 
22
- #: inc/class.rda-options.php:117
 
 
 
 
 
 
 
 
23
  msgid "Dashboard Access Controls"
24
  msgstr ""
25
 
26
- #: inc/class.rda-options.php:122
27
  msgid "Dashboard User Access:"
28
  msgstr ""
29
 
30
- #: inc/class.rda-options.php:130
31
  msgid "Redirect URL:"
32
  msgstr ""
33
 
34
- #: inc/class.rda-options.php:134
35
  msgid "User Profile Access:"
36
  msgstr ""
37
 
38
- #: inc/class.rda-options.php:138
39
  msgid "Login Message"
40
  msgstr ""
41
 
42
- #: inc/class.rda-options.php:153
43
  msgid "Debug Info"
44
  msgstr ""
45
 
46
- #: inc/class.rda-options.php:165
47
  msgid ""
48
  "Dashboard access can be restricted to users of certain roles only or users "
49
  "with a specific capability."
50
  msgstr ""
51
 
52
- #: inc/class.rda-options.php:181
53
  msgid "<strong>Advanced</strong>: Limit by capability:"
54
  msgstr ""
55
 
56
- #: inc/class.rda-options.php:184
57
  #, php-format
58
  msgid "You can find out more about specific %s in the Codex."
59
  msgstr ""
60
 
61
- #: inc/class.rda-options.php:187
62
  msgid "Roles &amp; Capabilities"
63
  msgstr ""
64
 
65
- #: inc/class.rda-options.php:220
66
  msgid " Disable access controls and redirection"
67
  msgstr ""
68
 
69
- #: inc/class.rda-options.php:263
70
  msgid "Administrators only"
71
  msgstr ""
72
 
73
- #: inc/class.rda-options.php:267
74
  msgid "Editors and Administrators"
75
  msgstr ""
76
 
77
- #: inc/class.rda-options.php:271
78
  msgid "Authors, Editors, and Administrators"
79
  msgstr ""
80
 
81
- #: inc/class.rda-options.php:321
82
  msgid "--- Select a Capability ---"
83
  msgstr ""
84
 
85
- #: inc/class.rda-options.php:345
86
  msgid " Allow all users to edit their profiles in the dashboard."
87
  msgstr ""
88
 
89
- #: inc/class.rda-options.php:362
90
  msgid "Redirect disallowed users to:"
91
  msgstr ""
92
 
93
- #: inc/class.rda-options.php:363
94
  #, php-format
95
  msgid "Default: %s"
96
  msgstr ""
97
 
98
- #: inc/class.rda-options.php:376
99
  msgid "(Disabled when empty)"
100
  msgstr ""
101
 
102
- #: inc/class.rda-options.php:480
103
  msgid "Settings"
104
  msgstr ""
105
 
106
- #: inc/class.rda-options.php:514
107
  msgid "Setting"
108
  msgstr ""
109
 
110
- #: inc/class.rda-options.php:515
111
  msgid "Value"
112
  msgstr ""
113
 
114
- #: inc/class.rda-options.php:518
115
  msgid "empty"
116
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Remove Dashboard Access\n"
4
+ "POT-Creation-Date: 2014-07-16 02:30-0700\n"
5
+ "PO-Revision-Date: 2014-07-16 02:31-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: Drew Jaynes (DrewAPicture) <info@drewapicture.com>\n"
8
  "Language: en\n"
15
  "X-Poedit-Basepath: ../\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
+ #: inc/class.rda-options.php:55
19
  msgid "This site is in maintenance mode."
20
  msgstr ""
21
 
22
+ #: inc/class.rda-options.php:141 inc/class.rda-options.php:160
23
+ msgid "Dashboard Access Settings"
24
+ msgstr ""
25
+
26
+ #: inc/class.rda-options.php:142
27
+ msgid "Dashboard Access"
28
+ msgstr ""
29
+
30
+ #: inc/class.rda-options.php:182
31
  msgid "Dashboard Access Controls"
32
  msgstr ""
33
 
34
+ #: inc/class.rda-options.php:187
35
  msgid "Dashboard User Access:"
36
  msgstr ""
37
 
38
+ #: inc/class.rda-options.php:195
39
  msgid "Redirect URL:"
40
  msgstr ""
41
 
42
+ #: inc/class.rda-options.php:199
43
  msgid "User Profile Access:"
44
  msgstr ""
45
 
46
+ #: inc/class.rda-options.php:203
47
  msgid "Login Message"
48
  msgstr ""
49
 
50
+ #: inc/class.rda-options.php:218
51
  msgid "Debug Info"
52
  msgstr ""
53
 
54
+ #: inc/class.rda-options.php:230
55
  msgid ""
56
  "Dashboard access can be restricted to users of certain roles only or users "
57
  "with a specific capability."
58
  msgstr ""
59
 
60
+ #: inc/class.rda-options.php:246
61
  msgid "<strong>Advanced</strong>: Limit by capability:"
62
  msgstr ""
63
 
64
+ #: inc/class.rda-options.php:249
65
  #, php-format
66
  msgid "You can find out more about specific %s in the Codex."
67
  msgstr ""
68
 
69
+ #: inc/class.rda-options.php:252
70
  msgid "Roles &amp; Capabilities"
71
  msgstr ""
72
 
73
+ #: inc/class.rda-options.php:285
74
  msgid " Disable access controls and redirection"
75
  msgstr ""
76
 
77
+ #: inc/class.rda-options.php:328
78
  msgid "Administrators only"
79
  msgstr ""
80
 
81
+ #: inc/class.rda-options.php:332
82
  msgid "Editors and Administrators"
83
  msgstr ""
84
 
85
+ #: inc/class.rda-options.php:336
86
  msgid "Authors, Editors, and Administrators"
87
  msgstr ""
88
 
89
+ #: inc/class.rda-options.php:386
90
  msgid "--- Select a Capability ---"
91
  msgstr ""
92
 
93
+ #: inc/class.rda-options.php:410
94
  msgid " Allow all users to edit their profiles in the dashboard."
95
  msgstr ""
96
 
97
+ #: inc/class.rda-options.php:427
98
  msgid "Redirect disallowed users to:"
99
  msgstr ""
100
 
101
+ #: inc/class.rda-options.php:428
102
  #, php-format
103
  msgid "Default: %s"
104
  msgstr ""
105
 
106
+ #: inc/class.rda-options.php:441
107
  msgid "(Disabled when empty)"
108
  msgstr ""
109
 
110
+ #: inc/class.rda-options.php:561
111
  msgid "Settings"
112
  msgstr ""
113
 
114
+ #: inc/class.rda-options.php:596
115
  msgid "Setting"
116
  msgstr ""
117
 
118
+ #: inc/class.rda-options.php:597
119
  msgid "Value"
120
  msgstr ""
121
 
122
+ #: inc/class.rda-options.php:600
123
  msgid "empty"
124
  msgstr ""
readme.txt CHANGED
@@ -4,9 +4,9 @@ Donate link: http://www.werdswords.com
4
  Tags: dashboard, access, users, administration
5
  Requires at least: 3.1
6
  Tested up to: 4.0
7
- Stable tag: 1.1
8
 
9
- Disable Dashboard access for users of a specific role or capability. Disallowed users are redirected to a chosen URL.
10
 
11
  == Description ==
12
 
@@ -78,35 +78,41 @@ add_filter( 'rda_frontend_toolbar_nodes', 'hide_some_toolbar_menu' );
78
  `
79
 
80
  <strong>Common plugin Toolbar menus and their ids:</strong>
81
- | Plugin | Menu ID |
82
- | ------ | ------- |
83
- | <a href="http://wordpress.org/extend/plugins/jetpack/">Jetpack by WordPress.com</a> (notifications) | 'notes |
84
- | <a href="http://wordpress.org/extend/plugins/wordpress-seo/">WordPress SEO by Yoast</a> | 'wpseo-menu' |
85
- | <a href="http://wordpress.org/extend/plugins/w3-total-cache/">W3 Total Cache</a> | 'w3tc' |
86
 
87
  <strong>Debug Mode</strong>
88
 
89
- To view debugging information on the Settings > Reading screen, visit yoursite.com/wp-admin/options-reading.php?rda_debug=1
90
 
91
  == Screenshots ==
92
 
93
- 1. The Dashboard Access Controls settings in the Settings > Reading screen.
94
  2. Allow users to access their profile settings (only).
95
  3. Optional login message.
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
 
99
  = 1.1 =
100
 
101
  Enhancements:
 
102
  * Instantiate as a static instance for better modularity
103
- * Move Dashboard Access Controls settings to Settings > Reading
104
  * Add optional login message option
105
  * Add better settings sanitization
106
  * New Filter: `rda_default_caps_for_role` - Filter default roles for Admins, Editors, and Authors
107
  * New Debug Mode
108
 
109
  Bug Fixes:
 
110
  * Remove unnecessarily stringent URL mask on the redirect URL option
111
 
112
  = 1.0 =
4
  Tags: dashboard, access, users, administration
5
  Requires at least: 3.1
6
  Tested up to: 4.0
7
+ Stable tag: 1.1.1
8
 
9
+ Allows you to disable Dashboard access for users of a specific role or capability. Disallowed users are redirected to a chosen URL.
10
 
11
  == Description ==
12
 
78
  `
79
 
80
  <strong>Common plugin Toolbar menus and their ids:</strong>
81
+ | <a href="http://wordpress.org/extend/plugins/jetpack/">Jetpack by WordPress.com</a> (notifications): 'notes
82
+ | <a href="http://wordpress.org/extend/plugins/wordpress-seo/">WordPress SEO by Yoast</a>: 'wpseo-menu'
83
+ | <a href="http://wordpress.org/extend/plugins/w3-total-cache/">W3 Total Cache</a>: 'w3tc'
 
 
84
 
85
  <strong>Debug Mode</strong>
86
 
87
+ To view debugging information on the Settings > Reading screen, visit yoursite.com/options-general.php?page=dashboard-access&rda_debug=1
88
 
89
  == Screenshots ==
90
 
91
+ 1. The Dashboard Access Controls settings in the Settings > Dashboard Access screen.
92
  2. Allow users to access their profile settings (only).
93
  3. Optional login message.
94
 
95
  == Changelog ==
96
 
97
+ = 1.1.1 =
98
+
99
+ Bug Fix:
100
+
101
+ * Move options back to Settings > Dashboard Access screen to resolve conflict with page_on_front UI.
102
+
103
  = 1.1 =
104
 
105
  Enhancements:
106
+
107
  * Instantiate as a static instance for better modularity
108
+ * Move Dashboard Access Controls settings to Settings > Dashboard Access
109
  * Add optional login message option
110
  * Add better settings sanitization
111
  * New Filter: `rda_default_caps_for_role` - Filter default roles for Admins, Editors, and Authors
112
  * New Debug Mode
113
 
114
  Bug Fixes:
115
+
116
  * Remove unnecessarily stringent URL mask on the redirect URL option
117
 
118
  = 1.0 =
remove-dashboard-access.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Remove Dashboard Access
4
  * Plugin URI: http://www.werdswords.com
5
  * Description: Removes Dashboard access for certain users based on capability.
6
- * Version: 1.1
7
  * Author: Drew Jaynes (DrewAPicture)
8
  * Author URI: http://www.drewapicture.com
9
  * License: GPLv2
3
  * Plugin Name: Remove Dashboard Access
4
  * Plugin URI: http://www.werdswords.com
5
  * Description: Removes Dashboard access for certain users based on capability.
6
+ * Version: 1.1.1
7
  * Author: Drew Jaynes (DrewAPicture)
8
  * Author URI: http://www.drewapicture.com
9
  * License: GPLv2