Version Description
December 18, 2013 =
Mark as compatible with WordPress 4.0
Fix some checkboxes (for roles) not having label tags
Download this release
Release Info
Developer | brandon.wamboldt |
Plugin | WordPress Access Control |
Version | 4.0.9 |
Comparing to | |
See all releases |
Code changes from version 4.0.8 to 4.0.9
- documentation/assets/css/readme.css +0 -0
- documentation/assets/images/default_interface.png +0 -0
- documentation/assets/images/htmlstructure.png +0 -0
- documentation/assets/images/members_interface.png +0 -0
- documentation/assets/images/nonmembers_interface.png +0 -0
- documentation/assets/images/white-grad-active.png +0 -0
- documentation/assets/images/white-grad.png +0 -0
- documentation/assets/images/wordpress-logo.png +0 -0
- documentation/index.html +0 -0
- languages/wordpress-access-control.pot +0 -0
- readme.txt +7 -2
- templates/meta_box.php +17 -19
- templates/options.php +48 -48
- wordpress-access-control.php +1 -1
documentation/assets/css/readme.css
CHANGED
File without changes
|
documentation/assets/images/default_interface.png
CHANGED
File without changes
|
documentation/assets/images/htmlstructure.png
CHANGED
File without changes
|
documentation/assets/images/members_interface.png
CHANGED
File without changes
|
documentation/assets/images/nonmembers_interface.png
CHANGED
File without changes
|
documentation/assets/images/white-grad-active.png
CHANGED
File without changes
|
documentation/assets/images/white-grad.png
CHANGED
File without changes
|
documentation/assets/images/wordpress-logo.png
CHANGED
File without changes
|
documentation/index.html
CHANGED
File without changes
|
languages/wordpress-access-control.pot
CHANGED
File without changes
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: brandon.wamboldt
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y398QNA6FM9TA
|
4 |
Tags: members, only, plugin, restricted, access, menus, 3.3, wp_nav_menu, nonmembers
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 4.0.
|
8 |
|
9 |
Restrict pages, posts, custom post types, menus and widgets to members, nonmembers or specific roles and still add to navigation
|
10 |
|
@@ -64,6 +64,11 @@ Yes, this is a new feature in 3.1.3. Use the syntax [members role="administrator
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
|
|
|
|
|
|
|
|
|
|
67 |
= 4.0.8 - December 18, 2013 =
|
68 |
|
69 |
* Fixing syntax errors (forgot to turn WP_DEBUG back on)
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y398QNA6FM9TA
|
4 |
Tags: members, only, plugin, restricted, access, menus, 3.3, wp_nav_menu, nonmembers
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.0
|
7 |
+
Stable tag: 4.0.9
|
8 |
|
9 |
Restrict pages, posts, custom post types, menus and widgets to members, nonmembers or specific roles and still add to navigation
|
10 |
|
64 |
|
65 |
== Changelog ==
|
66 |
|
67 |
+
= 4.0.9 - December 18, 2013 =
|
68 |
+
|
69 |
+
* Mark as compatible with WordPress 4.0
|
70 |
+
* Fix some checkboxes (for roles) not having label tags
|
71 |
+
|
72 |
= 4.0.8 - December 18, 2013 =
|
73 |
|
74 |
* Fixing syntax errors (forgot to turn WP_DEBUG back on)
|
templates/meta_box.php
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
?><input type="hidden" name="members_only_nonce" id="members_only_nonce" value="<?php echo wp_create_nonce( 'members_only' ); ?>" />
|
4 |
|
5 |
<div id="members_only_container">
|
6 |
<label>
|
7 |
-
<input type="checkbox" name="members_only" id="members_only" value="true" <?php echo $is_members_only; ?> />
|
8 |
<?php _e( 'Only accessible by members?', 'wpac' ); ?>
|
9 |
</label>
|
10 |
-
|
11 |
<div id="members_only_options" class="hide-if-js">
|
12 |
<br /><strong><?php _e( 'Only Accessible By (Defaults to everyone):', 'wpac' ); ?></strong><br />
|
13 |
-
|
14 |
-
<?php
|
15 |
global $wp_roles;
|
16 |
$roles = $wp_roles->get_names();
|
17 |
$checked_roles = (array) maybe_unserialize( get_post_meta( $post->ID, '_wpac_restricted_to', TRUE ) );
|
18 |
-
|
19 |
if ( $post->post_status == 'auto-draft' && $post->post_type == 'post' ) {
|
20 |
$checked_roles = get_option( 'wpac_posts_default_restricted_to', array() );
|
21 |
} else if ( $post->post_status == 'auto-draft' ) {
|
@@ -24,24 +22,24 @@
|
|
24 |
|
25 |
foreach ( $roles as $role => $label ) {
|
26 |
if ( in_array( $role, $checked_roles ) ) {
|
27 |
-
echo '<input type="checkbox" name="wpac_restricted_to[]" checked="checked" value="' . $role . '"
|
28 |
} else {
|
29 |
-
echo '<input type="checkbox" name="wpac_restricted_to[]" value="' . $role . '"
|
30 |
}
|
31 |
}
|
32 |
-
|
33 |
$redirect_to = get_post_meta( $post->ID, '_wpac_members_redirect_to', TRUE );
|
34 |
-
|
35 |
if ( $post->post_status == 'auto-draft' ) {
|
36 |
$redirect_to = get_option( 'wpac_default_members_redirect', '' );
|
37 |
}
|
38 |
?>
|
39 |
-
|
40 |
<br /><strong><?php _e( 'Redirect To (Leave empty for login page):', 'wpac' ); ?></strong><br />
|
41 |
<input type="text" name="wpac_members_redirect_to" value="<?php echo $redirect_to; ?>" /><br />
|
42 |
-
|
43 |
<br /><strong>Options</strong><br />
|
44 |
-
<?php
|
45 |
if ( $post->post_type == 'post' && $post->post_status == 'auto-draft' ) {
|
46 |
$wpac_show_in_search = get_option( 'wpac_show_posts_in_search', 0 );
|
47 |
$wpac_show_excerpt_in_search = get_option( 'wpac_show_post_excerpts_in_search', 0 );
|
@@ -57,13 +55,13 @@
|
|
57 |
|
58 |
<div id="nonmembers_only_container">
|
59 |
<label>
|
60 |
-
<input type="checkbox" name="nonmembers_only" id="nonmembers_only" value="true" <?php echo $is_nonmembers_only; ?> />
|
61 |
<?php _e( 'Only accessible by non-members?', 'wpac' ); ?>
|
62 |
</label>
|
63 |
-
|
64 |
<div id="nonmembers_only_options" class="hide-if-js">
|
65 |
<?php $redirect_to = get_post_meta( $post->ID, '_wpac_nonmembers_redirect_to', true ); ?>
|
66 |
-
|
67 |
<br /><strong><?php _e( 'Redirect To (Leave empty for home page):', 'wpac' ); ?> </strong><br />
|
68 |
<input type="text" name="wpac_nonmembers_redirect_to" value="<?php echo $redirect_to; ?>" />
|
69 |
</div>
|
@@ -105,4 +103,4 @@ if (jQuery('#nonmembers_only').is(":checked") == true) {
|
|
105 |
jQuery('#nonmembers_only_container').hide('fast');
|
106 |
jQuery('#members_only_options').show();
|
107 |
}
|
108 |
-
</script>
|
1 |
+
<input type="hidden" name="members_only_nonce" id="members_only_nonce" value="<?php echo wp_create_nonce( 'members_only' ); ?>" />
|
|
|
|
|
2 |
|
3 |
<div id="members_only_container">
|
4 |
<label>
|
5 |
+
<input type="checkbox" name="members_only" id="members_only" value="true" <?php echo $is_members_only; ?> />
|
6 |
<?php _e( 'Only accessible by members?', 'wpac' ); ?>
|
7 |
</label>
|
8 |
+
|
9 |
<div id="members_only_options" class="hide-if-js">
|
10 |
<br /><strong><?php _e( 'Only Accessible By (Defaults to everyone):', 'wpac' ); ?></strong><br />
|
11 |
+
|
12 |
+
<?php
|
13 |
global $wp_roles;
|
14 |
$roles = $wp_roles->get_names();
|
15 |
$checked_roles = (array) maybe_unserialize( get_post_meta( $post->ID, '_wpac_restricted_to', TRUE ) );
|
16 |
+
|
17 |
if ( $post->post_status == 'auto-draft' && $post->post_type == 'post' ) {
|
18 |
$checked_roles = get_option( 'wpac_posts_default_restricted_to', array() );
|
19 |
} else if ( $post->post_status == 'auto-draft' ) {
|
22 |
|
23 |
foreach ( $roles as $role => $label ) {
|
24 |
if ( in_array( $role, $checked_roles ) ) {
|
25 |
+
echo '<label><input type="checkbox" name="wpac_restricted_to[]" checked="checked" value="' . $role . '"> ' . $label . '</label><br>';
|
26 |
} else {
|
27 |
+
echo '<label><input type="checkbox" name="wpac_restricted_to[]" value="' . $role . '"> ' . $label . '</label><br>';
|
28 |
}
|
29 |
}
|
30 |
+
|
31 |
$redirect_to = get_post_meta( $post->ID, '_wpac_members_redirect_to', TRUE );
|
32 |
+
|
33 |
if ( $post->post_status == 'auto-draft' ) {
|
34 |
$redirect_to = get_option( 'wpac_default_members_redirect', '' );
|
35 |
}
|
36 |
?>
|
37 |
+
|
38 |
<br /><strong><?php _e( 'Redirect To (Leave empty for login page):', 'wpac' ); ?></strong><br />
|
39 |
<input type="text" name="wpac_members_redirect_to" value="<?php echo $redirect_to; ?>" /><br />
|
40 |
+
|
41 |
<br /><strong>Options</strong><br />
|
42 |
+
<?php
|
43 |
if ( $post->post_type == 'post' && $post->post_status == 'auto-draft' ) {
|
44 |
$wpac_show_in_search = get_option( 'wpac_show_posts_in_search', 0 );
|
45 |
$wpac_show_excerpt_in_search = get_option( 'wpac_show_post_excerpts_in_search', 0 );
|
55 |
|
56 |
<div id="nonmembers_only_container">
|
57 |
<label>
|
58 |
+
<input type="checkbox" name="nonmembers_only" id="nonmembers_only" value="true" <?php echo $is_nonmembers_only; ?> />
|
59 |
<?php _e( 'Only accessible by non-members?', 'wpac' ); ?>
|
60 |
</label>
|
61 |
+
|
62 |
<div id="nonmembers_only_options" class="hide-if-js">
|
63 |
<?php $redirect_to = get_post_meta( $post->ID, '_wpac_nonmembers_redirect_to', true ); ?>
|
64 |
+
|
65 |
<br /><strong><?php _e( 'Redirect To (Leave empty for home page):', 'wpac' ); ?> </strong><br />
|
66 |
<input type="text" name="wpac_nonmembers_redirect_to" value="<?php echo $redirect_to; ?>" />
|
67 |
</div>
|
103 |
jQuery('#nonmembers_only_container').hide('fast');
|
104 |
jQuery('#members_only_options').show();
|
105 |
}
|
106 |
+
</script>
|
templates/options.php
CHANGED
@@ -22,43 +22,43 @@ $wpac_show_page_excerpts_in_search = get_option( 'wpac_show_page_excerpts_in_sea
|
|
22 |
?><div class="wrap">
|
23 |
<div class="icon32" id="icon-options-general"><br /></div>
|
24 |
<h2><?php _e( 'WordPress Access Control Settings', 'wpac' ); ?></h2>
|
25 |
-
|
26 |
<?php if ( isset( $admin_message ) && ! empty( $admin_message ) ) { ?>
|
27 |
<div class="updated below-h2" id="message"><p><?php echo $admin_message; ?></p></div>
|
28 |
<?php } ?>
|
29 |
-
|
30 |
<?php if ( isset( $admin_error ) && ! empty( $admin_error ) ) { ?>
|
31 |
<div class="error below-h2" id="error"><p><?php echo $admin_error; ?></p></div>
|
32 |
<?php } ?>
|
33 |
-
|
34 |
<form action="options-general.php?page=wpac-options" method="post">
|
35 |
<input type="hidden" value="wpac-options" name="options_page" />
|
36 |
<input type="hidden" value="update" name="action" />
|
37 |
<?php wp_nonce_field( 'wpac_options_save' ); ?>
|
38 |
-
|
39 |
<h3 class="title"><?php _e( 'Shortcodes', 'wpac' ); ?></h3>
|
40 |
-
|
41 |
<p><?php _e( 'To make a specific section of content members only instead of the entire page, sorround it with [member]Your content here[/member] tags. For non-member content, use [nonmember]Your content here[/nonmember].', 'wpac' ); ?></p>
|
42 |
-
|
43 |
<h3 class="title"><?php _e( 'General Options', 'wpac' ); ?></h3>
|
44 |
-
|
45 |
<table class="form-table">
|
46 |
<tbody>
|
47 |
<tr>
|
48 |
<th scope="row">
|
49 |
<label for="wpac_members_only_blog"><?php _e( 'Make Blog Members Only', 'wpac' ); ?></label>
|
50 |
</th>
|
51 |
-
|
52 |
<td>
|
53 |
<label><input type="checkbox" name="wpac_members_only_blog" value="yes" id="wpac_members_only_blog" <?php checked( $wpac_members_only_blog, 1 ); ?>/> <span><?php _e( 'Make Blog Members Only', 'wpac' ); ?></span></label>
|
54 |
</td>
|
55 |
</tr>
|
56 |
-
|
57 |
<tr>
|
58 |
<th scope="row">
|
59 |
<label for="wpac_members_blog_redirect"><?php _e( 'Members Blog Redirect', 'wpac' ); ?></label>
|
60 |
</th>
|
61 |
-
|
62 |
<td>
|
63 |
<input type="text" class="regular-text" value="<?php esc_attr_e( $wpac_members_blog_redirect ); ?>" id="wpac_members_blog_redirect" name="wpac_members_blog_redirect" />
|
64 |
<span class="description"><?php printf( __( 'Where to redirect non-members when they try to visit the blog. %1$s
|
@@ -66,18 +66,18 @@ Defaults to WordPress login page (%2$s)%1$s
|
|
66 |
After a user logs in they will be redirected back to the blog', 'wpac' ), '<br />', '<a href="' . wp_login_url() . '">' . wp_login_url() . '</a>' ); ?></span>
|
67 |
</td>
|
68 |
</tr>
|
69 |
-
|
70 |
<?php if ( ! empty( $custom_post_types ) ) { ?>
|
71 |
<tr>
|
72 |
<th scope="row">
|
73 |
<label for="wpac_members_only_blog"><?php _e( 'Custom Post Types', 'wpac' ); ?></label>
|
74 |
</th>
|
75 |
-
|
76 |
<td>
|
77 |
<p class="description"><?php _e( 'You can enable access controls for custom post types by selecting them below. May not work if the post type uses a custom admin interface.', 'wpac' ); ?></p>
|
78 |
-
<?php
|
79 |
$wpac_custom_post_types = get_option( 'wpac_custom_post_types', array() );
|
80 |
-
|
81 |
foreach ( $custom_post_types as $post_type => $details ) {
|
82 |
if ( in_array( $post_type, $wpac_custom_post_types ) ) {
|
83 |
echo '<label><input type="checkbox" checked="checked" value="' . esc_attr( $post_type ) . '" id="wpac_enable_for_post_type_' . esc_attr( $post_type ) . '" name="wpac_custom_post_types[]" /> <span>' . $post_type . ' – ' . $details->labels->name . ' - ' . ( ( ! empty( $details->description ) ) ? $details->description : '<em>No Description</em>' ) . '</span></label><br />';
|
@@ -91,9 +91,9 @@ After a user logs in they will be redirected back to the blog', 'wpac' ), '<br
|
|
91 |
<?php } ?>
|
92 |
</tbody>
|
93 |
</table>
|
94 |
-
|
95 |
<h3 class="title"><?php _e( 'Override Permisisons', 'wpac' ); ?></h3>
|
96 |
-
|
97 |
<table class="form-table">
|
98 |
<tbody>
|
99 |
<tr>
|
@@ -101,11 +101,11 @@ After a user logs in they will be redirected back to the blog', 'wpac' ), '<br
|
|
101 |
<?php _e( 'Always Accessible By', 'wpac' ); ?>
|
102 |
</th>
|
103 |
<td>
|
104 |
-
<?php
|
105 |
global $wp_roles;
|
106 |
$roles = $wp_roles->get_names();
|
107 |
$checked_roles = (array) maybe_unserialize( get_option( 'wpac_always_accessible_by', array( 0 => 'administrator' ) ) );
|
108 |
-
|
109 |
foreach ( $roles as $role => $label ) {
|
110 |
if ( in_array( $role, $checked_roles ) ) {
|
111 |
echo '<label><input type="checkbox" name="wpac_always_accessible_by[]" checked="checked" value="' . $role . '" /> ' . $label . '<br /></label>';
|
@@ -118,9 +118,9 @@ After a user logs in they will be redirected back to the blog', 'wpac' ), '<br
|
|
118 |
</tr>
|
119 |
</tbody>
|
120 |
</table>
|
121 |
-
|
122 |
<h3 class="title"><?php _e( 'Menu Options', 'wpac' ); ?></h3>
|
123 |
-
|
124 |
<table class="form-table">
|
125 |
<tbody>
|
126 |
<tr>
|
@@ -135,13 +135,13 @@ After a user logs in they will be redirected back to the blog', 'wpac' ), '<br
|
|
135 |
</tr>
|
136 |
</tbody>
|
137 |
</table>
|
138 |
-
|
139 |
<h3 class="title"><?php _e( 'Post/Page Default Options', 'wpac' ); ?></h3>
|
140 |
-
|
141 |
<p>
|
142 |
<?php _e( 'These options are defaults for posts and pages in case the majority of your posts and pages will have similar settings. You can override any of these settings on a per-post or per-page basis.' ); ?>
|
143 |
</p>
|
144 |
-
|
145 |
<table class="form-table">
|
146 |
<tbody>
|
147 |
<tr>
|
@@ -154,29 +154,29 @@ After a user logs in they will be redirected back to the blog', 'wpac' ), '<br
|
|
154 |
<label><input <?php checked( $wpac_default_post_state, 'nonmembers' ); ?> type="radio" value="nonmembers" name="default_post_state" /> <span><?php _e( 'Non-Members Only', 'wpac' ); ?></span></label><br />
|
155 |
</td>
|
156 |
</tr>
|
157 |
-
|
158 |
<tr>
|
159 |
<th scope="row">
|
160 |
<?php _e( 'Posts: Only Accessible By', 'wpac' ); ?>
|
161 |
</th>
|
162 |
<td>
|
163 |
-
<?php
|
164 |
global $wp_roles;
|
165 |
$roles = $wp_roles->get_names();
|
166 |
$checked_roles = (array) get_option( 'wpac_posts_default_restricted_to', array() );
|
167 |
-
|
168 |
foreach ( $roles as $role => $label ) {
|
169 |
if ( in_array( $role, $checked_roles ) ) {
|
170 |
-
echo '<input type="checkbox" name="wpac_posts_default_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '
|
171 |
} else {
|
172 |
-
echo '<input type="checkbox" name="wpac_posts_default_restricted_to[]" value="' . $role . '" /> ' . $label . '
|
173 |
}
|
174 |
}
|
175 |
?>
|
176 |
<span class="description"><?php _e( 'Defaults to all roles', 'wpac' ); ?></span>
|
177 |
</td>
|
178 |
</tr>
|
179 |
-
|
180 |
<tr>
|
181 |
<th scope="row">
|
182 |
<?php _e( 'Default Page State', 'wpac' ); ?>
|
@@ -187,29 +187,29 @@ After a user logs in they will be redirected back to the blog', 'wpac' ), '<br
|
|
187 |
<label><input <?php checked( $wpac_default_page_state, 'nonmembers' ); ?> type="radio" value="nonmembers" name="default_page_state" /> <span><?php _e( 'Non-Members Only', 'wpac' ); ?></span></label><br />
|
188 |
</td>
|
189 |
</tr>
|
190 |
-
|
191 |
<tr>
|
192 |
<th scope="row">
|
193 |
<?php _e( 'Pages: Only Accessible By', 'wpac' ); ?>
|
194 |
</th>
|
195 |
<td>
|
196 |
-
<?php
|
197 |
global $wp_roles;
|
198 |
$roles = $wp_roles->get_names();
|
199 |
$checked_roles = (array) get_option( 'wpac_pages_default_restricted_to', array() );
|
200 |
-
|
201 |
foreach ( $roles as $role => $label ) {
|
202 |
if ( in_array( $role, $checked_roles ) ) {
|
203 |
-
echo '<input type="checkbox" name="wpac_pages_default_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '
|
204 |
} else {
|
205 |
-
echo '<input type="checkbox" name="wpac_pages_default_restricted_to[]" value="' . $role . '" /> ' . $label . '
|
206 |
}
|
207 |
}
|
208 |
?>
|
209 |
<span class="description"><?php _e( 'Defaults to all roles', 'wpac' ); ?></span>
|
210 |
</td>
|
211 |
</tr>
|
212 |
-
|
213 |
<tr>
|
214 |
<th scope="row">
|
215 |
<label for="wpac_default_members_redirect"><?php _e( 'Default Redirect For Members Only Pages', 'wpac' ); ?></label>
|
@@ -223,15 +223,15 @@ After a user logs in they will be redirected back to the blog', 'wpac' ), '<br
|
|
223 |
</tr>
|
224 |
</tbody>
|
225 |
</table>
|
226 |
-
|
227 |
<h3 class="title"><?php _e( 'Search/Archive Options', 'wpac' ); ?></h3>
|
228 |
-
|
229 |
<p>
|
230 |
-
<?php __( 'I use the wording "search" below, but these settings apply to search AND archive pages (Such as the blog page, categories and tags pages, and such).
|
231 |
-
<strong>For example</strong>, if you wanted a blog where non-members could see post titles and excerpts but not the actual posts, set the default
|
232 |
post state to Members Only, then set the Search Options to show restricted posts in search results and show post excerpts.', 'wpac' ); ?>
|
233 |
</p>
|
234 |
-
|
235 |
<table class="form-table">
|
236 |
<tbody>
|
237 |
<tr>
|
@@ -245,7 +245,7 @@ post state to Members Only, then set the Search Options to show restricted posts
|
|
245 |
<label><input type="checkbox" <?php checked( $wpac_show_page_excerpts_in_search, 1 ); ?> value="yes" name="show_page_excerpts_in_search" /> <span><?php _e( 'Show restricted page excerpts in search results?', 'wpac' ); ?></span></label><br />
|
246 |
</td>
|
247 |
</tr>
|
248 |
-
|
249 |
<tr>
|
250 |
<th scope="row">
|
251 |
<label for="post_excerpt_text"><?php _e( 'Search Excerpt (Posts)', 'wpac' ); ?></label>
|
@@ -253,18 +253,18 @@ post state to Members Only, then set the Search Options to show restricted posts
|
|
253 |
<td>
|
254 |
<fieldset>
|
255 |
<legend class="screen-reader-text"><?php _e( 'Search Excerpt (Posts)', 'wpac' ); ?></legend>
|
256 |
-
|
257 |
<p>
|
258 |
<label for="post_excerpt_text"><?php _e( 'If a post is set to show in search results WITHOUT an excerpt, this text will be displayed instead.', 'wpac' ); ?></label>
|
259 |
</p>
|
260 |
-
|
261 |
<p>
|
262 |
<textarea id="post_excerpt_text" name="post_excerpt_text" class="large-text" cols="50" rows="5"><?php echo get_option( 'wpac_post_excerpt_text', __( 'To view the contents of this post, you must be authenticated and have the required access level.', 'wpac' ) ); ?></textarea>
|
263 |
</p>
|
264 |
</fieldset>
|
265 |
</td>
|
266 |
</tr>
|
267 |
-
|
268 |
<tr>
|
269 |
<th scope="row">
|
270 |
<label for="page_excerpt_text"><?php _e( 'Search Excerpt (Pages)', 'wpac' ); ?></label>
|
@@ -272,11 +272,11 @@ post state to Members Only, then set the Search Options to show restricted posts
|
|
272 |
<td>
|
273 |
<fieldset>
|
274 |
<legend class="screen-reader-text"><?php _e( 'Search Excerpt (Pages)', 'wpac' ); ?>)</legend>
|
275 |
-
|
276 |
<p>
|
277 |
<label for="page_excerpt_text"><?php _e( 'If a page is set to show in search results WITHOUT an excerpt, this text will be displayed instead.', 'wpac' ); ?></label>
|
278 |
</p>
|
279 |
-
|
280 |
<p>
|
281 |
<textarea id="page_excerpt_text" name="page_excerpt_text" class="large-text" cols="50" rows="5"><?php echo get_option( 'wpac_page_excerpt_text', __( 'To view the contents of this page, you must be authenticated and have the required access level.', 'wpac' ) ); ?></textarea>
|
282 |
</p>
|
@@ -285,7 +285,7 @@ post state to Members Only, then set the Search Options to show restricted posts
|
|
285 |
</tr>
|
286 |
</tbody>
|
287 |
</table>
|
288 |
-
|
289 |
<p class="submit"><input type="submit" value="<?php _e( 'Save Changes', 'wpac' ); ?>" class="button-primary" id="submit" name="submit" /></p>
|
290 |
</form>
|
291 |
-
</div>
|
22 |
?><div class="wrap">
|
23 |
<div class="icon32" id="icon-options-general"><br /></div>
|
24 |
<h2><?php _e( 'WordPress Access Control Settings', 'wpac' ); ?></h2>
|
25 |
+
|
26 |
<?php if ( isset( $admin_message ) && ! empty( $admin_message ) ) { ?>
|
27 |
<div class="updated below-h2" id="message"><p><?php echo $admin_message; ?></p></div>
|
28 |
<?php } ?>
|
29 |
+
|
30 |
<?php if ( isset( $admin_error ) && ! empty( $admin_error ) ) { ?>
|
31 |
<div class="error below-h2" id="error"><p><?php echo $admin_error; ?></p></div>
|
32 |
<?php } ?>
|
33 |
+
|
34 |
<form action="options-general.php?page=wpac-options" method="post">
|
35 |
<input type="hidden" value="wpac-options" name="options_page" />
|
36 |
<input type="hidden" value="update" name="action" />
|
37 |
<?php wp_nonce_field( 'wpac_options_save' ); ?>
|
38 |
+
|
39 |
<h3 class="title"><?php _e( 'Shortcodes', 'wpac' ); ?></h3>
|
40 |
+
|
41 |
<p><?php _e( 'To make a specific section of content members only instead of the entire page, sorround it with [member]Your content here[/member] tags. For non-member content, use [nonmember]Your content here[/nonmember].', 'wpac' ); ?></p>
|
42 |
+
|
43 |
<h3 class="title"><?php _e( 'General Options', 'wpac' ); ?></h3>
|
44 |
+
|
45 |
<table class="form-table">
|
46 |
<tbody>
|
47 |
<tr>
|
48 |
<th scope="row">
|
49 |
<label for="wpac_members_only_blog"><?php _e( 'Make Blog Members Only', 'wpac' ); ?></label>
|
50 |
</th>
|
51 |
+
|
52 |
<td>
|
53 |
<label><input type="checkbox" name="wpac_members_only_blog" value="yes" id="wpac_members_only_blog" <?php checked( $wpac_members_only_blog, 1 ); ?>/> <span><?php _e( 'Make Blog Members Only', 'wpac' ); ?></span></label>
|
54 |
</td>
|
55 |
</tr>
|
56 |
+
|
57 |
<tr>
|
58 |
<th scope="row">
|
59 |
<label for="wpac_members_blog_redirect"><?php _e( 'Members Blog Redirect', 'wpac' ); ?></label>
|
60 |
</th>
|
61 |
+
|
62 |
<td>
|
63 |
<input type="text" class="regular-text" value="<?php esc_attr_e( $wpac_members_blog_redirect ); ?>" id="wpac_members_blog_redirect" name="wpac_members_blog_redirect" />
|
64 |
<span class="description"><?php printf( __( 'Where to redirect non-members when they try to visit the blog. %1$s
|
66 |
After a user logs in they will be redirected back to the blog', 'wpac' ), '<br />', '<a href="' . wp_login_url() . '">' . wp_login_url() . '</a>' ); ?></span>
|
67 |
</td>
|
68 |
</tr>
|
69 |
+
|
70 |
<?php if ( ! empty( $custom_post_types ) ) { ?>
|
71 |
<tr>
|
72 |
<th scope="row">
|
73 |
<label for="wpac_members_only_blog"><?php _e( 'Custom Post Types', 'wpac' ); ?></label>
|
74 |
</th>
|
75 |
+
|
76 |
<td>
|
77 |
<p class="description"><?php _e( 'You can enable access controls for custom post types by selecting them below. May not work if the post type uses a custom admin interface.', 'wpac' ); ?></p>
|
78 |
+
<?php
|
79 |
$wpac_custom_post_types = get_option( 'wpac_custom_post_types', array() );
|
80 |
+
|
81 |
foreach ( $custom_post_types as $post_type => $details ) {
|
82 |
if ( in_array( $post_type, $wpac_custom_post_types ) ) {
|
83 |
echo '<label><input type="checkbox" checked="checked" value="' . esc_attr( $post_type ) . '" id="wpac_enable_for_post_type_' . esc_attr( $post_type ) . '" name="wpac_custom_post_types[]" /> <span>' . $post_type . ' – ' . $details->labels->name . ' - ' . ( ( ! empty( $details->description ) ) ? $details->description : '<em>No Description</em>' ) . '</span></label><br />';
|
91 |
<?php } ?>
|
92 |
</tbody>
|
93 |
</table>
|
94 |
+
|
95 |
<h3 class="title"><?php _e( 'Override Permisisons', 'wpac' ); ?></h3>
|
96 |
+
|
97 |
<table class="form-table">
|
98 |
<tbody>
|
99 |
<tr>
|
101 |
<?php _e( 'Always Accessible By', 'wpac' ); ?>
|
102 |
</th>
|
103 |
<td>
|
104 |
+
<?php
|
105 |
global $wp_roles;
|
106 |
$roles = $wp_roles->get_names();
|
107 |
$checked_roles = (array) maybe_unserialize( get_option( 'wpac_always_accessible_by', array( 0 => 'administrator' ) ) );
|
108 |
+
|
109 |
foreach ( $roles as $role => $label ) {
|
110 |
if ( in_array( $role, $checked_roles ) ) {
|
111 |
echo '<label><input type="checkbox" name="wpac_always_accessible_by[]" checked="checked" value="' . $role . '" /> ' . $label . '<br /></label>';
|
118 |
</tr>
|
119 |
</tbody>
|
120 |
</table>
|
121 |
+
|
122 |
<h3 class="title"><?php _e( 'Menu Options', 'wpac' ); ?></h3>
|
123 |
+
|
124 |
<table class="form-table">
|
125 |
<tbody>
|
126 |
<tr>
|
135 |
</tr>
|
136 |
</tbody>
|
137 |
</table>
|
138 |
+
|
139 |
<h3 class="title"><?php _e( 'Post/Page Default Options', 'wpac' ); ?></h3>
|
140 |
+
|
141 |
<p>
|
142 |
<?php _e( 'These options are defaults for posts and pages in case the majority of your posts and pages will have similar settings. You can override any of these settings on a per-post or per-page basis.' ); ?>
|
143 |
</p>
|
144 |
+
|
145 |
<table class="form-table">
|
146 |
<tbody>
|
147 |
<tr>
|
154 |
<label><input <?php checked( $wpac_default_post_state, 'nonmembers' ); ?> type="radio" value="nonmembers" name="default_post_state" /> <span><?php _e( 'Non-Members Only', 'wpac' ); ?></span></label><br />
|
155 |
</td>
|
156 |
</tr>
|
157 |
+
|
158 |
<tr>
|
159 |
<th scope="row">
|
160 |
<?php _e( 'Posts: Only Accessible By', 'wpac' ); ?>
|
161 |
</th>
|
162 |
<td>
|
163 |
+
<?php
|
164 |
global $wp_roles;
|
165 |
$roles = $wp_roles->get_names();
|
166 |
$checked_roles = (array) get_option( 'wpac_posts_default_restricted_to', array() );
|
167 |
+
|
168 |
foreach ( $roles as $role => $label ) {
|
169 |
if ( in_array( $role, $checked_roles ) ) {
|
170 |
+
echo '<label><input type="checkbox" name="wpac_posts_default_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '</label><br />';
|
171 |
} else {
|
172 |
+
echo '<label><input type="checkbox" name="wpac_posts_default_restricted_to[]" value="' . $role . '" /> ' . $label . '</label><br />';
|
173 |
}
|
174 |
}
|
175 |
?>
|
176 |
<span class="description"><?php _e( 'Defaults to all roles', 'wpac' ); ?></span>
|
177 |
</td>
|
178 |
</tr>
|
179 |
+
|
180 |
<tr>
|
181 |
<th scope="row">
|
182 |
<?php _e( 'Default Page State', 'wpac' ); ?>
|
187 |
<label><input <?php checked( $wpac_default_page_state, 'nonmembers' ); ?> type="radio" value="nonmembers" name="default_page_state" /> <span><?php _e( 'Non-Members Only', 'wpac' ); ?></span></label><br />
|
188 |
</td>
|
189 |
</tr>
|
190 |
+
|
191 |
<tr>
|
192 |
<th scope="row">
|
193 |
<?php _e( 'Pages: Only Accessible By', 'wpac' ); ?>
|
194 |
</th>
|
195 |
<td>
|
196 |
+
<?php
|
197 |
global $wp_roles;
|
198 |
$roles = $wp_roles->get_names();
|
199 |
$checked_roles = (array) get_option( 'wpac_pages_default_restricted_to', array() );
|
200 |
+
|
201 |
foreach ( $roles as $role => $label ) {
|
202 |
if ( in_array( $role, $checked_roles ) ) {
|
203 |
+
echo '<label><input type="checkbox" name="wpac_pages_default_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '</label><br />';
|
204 |
} else {
|
205 |
+
echo '<label><input type="checkbox" name="wpac_pages_default_restricted_to[]" value="' . $role . '" /> ' . $label . '</label><br />';
|
206 |
}
|
207 |
}
|
208 |
?>
|
209 |
<span class="description"><?php _e( 'Defaults to all roles', 'wpac' ); ?></span>
|
210 |
</td>
|
211 |
</tr>
|
212 |
+
|
213 |
<tr>
|
214 |
<th scope="row">
|
215 |
<label for="wpac_default_members_redirect"><?php _e( 'Default Redirect For Members Only Pages', 'wpac' ); ?></label>
|
223 |
</tr>
|
224 |
</tbody>
|
225 |
</table>
|
226 |
+
|
227 |
<h3 class="title"><?php _e( 'Search/Archive Options', 'wpac' ); ?></h3>
|
228 |
+
|
229 |
<p>
|
230 |
+
<?php __( 'I use the wording "search" below, but these settings apply to search AND archive pages (Such as the blog page, categories and tags pages, and such).
|
231 |
+
<strong>For example</strong>, if you wanted a blog where non-members could see post titles and excerpts but not the actual posts, set the default
|
232 |
post state to Members Only, then set the Search Options to show restricted posts in search results and show post excerpts.', 'wpac' ); ?>
|
233 |
</p>
|
234 |
+
|
235 |
<table class="form-table">
|
236 |
<tbody>
|
237 |
<tr>
|
245 |
<label><input type="checkbox" <?php checked( $wpac_show_page_excerpts_in_search, 1 ); ?> value="yes" name="show_page_excerpts_in_search" /> <span><?php _e( 'Show restricted page excerpts in search results?', 'wpac' ); ?></span></label><br />
|
246 |
</td>
|
247 |
</tr>
|
248 |
+
|
249 |
<tr>
|
250 |
<th scope="row">
|
251 |
<label for="post_excerpt_text"><?php _e( 'Search Excerpt (Posts)', 'wpac' ); ?></label>
|
253 |
<td>
|
254 |
<fieldset>
|
255 |
<legend class="screen-reader-text"><?php _e( 'Search Excerpt (Posts)', 'wpac' ); ?></legend>
|
256 |
+
|
257 |
<p>
|
258 |
<label for="post_excerpt_text"><?php _e( 'If a post is set to show in search results WITHOUT an excerpt, this text will be displayed instead.', 'wpac' ); ?></label>
|
259 |
</p>
|
260 |
+
|
261 |
<p>
|
262 |
<textarea id="post_excerpt_text" name="post_excerpt_text" class="large-text" cols="50" rows="5"><?php echo get_option( 'wpac_post_excerpt_text', __( 'To view the contents of this post, you must be authenticated and have the required access level.', 'wpac' ) ); ?></textarea>
|
263 |
</p>
|
264 |
</fieldset>
|
265 |
</td>
|
266 |
</tr>
|
267 |
+
|
268 |
<tr>
|
269 |
<th scope="row">
|
270 |
<label for="page_excerpt_text"><?php _e( 'Search Excerpt (Pages)', 'wpac' ); ?></label>
|
272 |
<td>
|
273 |
<fieldset>
|
274 |
<legend class="screen-reader-text"><?php _e( 'Search Excerpt (Pages)', 'wpac' ); ?>)</legend>
|
275 |
+
|
276 |
<p>
|
277 |
<label for="page_excerpt_text"><?php _e( 'If a page is set to show in search results WITHOUT an excerpt, this text will be displayed instead.', 'wpac' ); ?></label>
|
278 |
</p>
|
279 |
+
|
280 |
<p>
|
281 |
<textarea id="page_excerpt_text" name="page_excerpt_text" class="large-text" cols="50" rows="5"><?php echo get_option( 'wpac_page_excerpt_text', __( 'To view the contents of this page, you must be authenticated and have the required access level.', 'wpac' ) ); ?></textarea>
|
282 |
</p>
|
285 |
</tr>
|
286 |
</tbody>
|
287 |
</table>
|
288 |
+
|
289 |
<p class="submit"><input type="submit" value="<?php _e( 'Save Changes', 'wpac' ); ?>" class="button-primary" id="submit" name="submit" /></p>
|
290 |
</form>
|
291 |
+
</div>
|
wordpress-access-control.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://brandonwamboldt.ca/plugins/members-only-menu-plugin/
|
5 |
* Author: Brandon Wamboldt
|
6 |
* Author URI: http://brandonwamboldt.ca/
|
7 |
-
* Version: 4.0.
|
8 |
* Description: This plugin is a powerful tool which gives you fine grained control over your pages and posts (and custom post types), allowing you to restrict a page, post, or custom post type to members, non-members, or even specific roles. You can customize how these pages and posts show up in search results, where users are directed when they visit them, and much more. <strong>You can even make your entire blog members only!</strong>.
|
9 |
*/
|
10 |
|
4 |
* Plugin URI: http://brandonwamboldt.ca/plugins/members-only-menu-plugin/
|
5 |
* Author: Brandon Wamboldt
|
6 |
* Author URI: http://brandonwamboldt.ca/
|
7 |
+
* Version: 4.0.9
|
8 |
* Description: This plugin is a powerful tool which gives you fine grained control over your pages and posts (and custom post types), allowing you to restrict a page, post, or custom post type to members, non-members, or even specific roles. You can customize how these pages and posts show up in search results, where users are directed when they visit them, and much more. <strong>You can even make your entire blog members only!</strong>.
|
9 |
*/
|
10 |
|