Version Description
June 2, 2011 =
Added do_shortcode commands to allow nested shortcodes in the [members] and [nonmembers] shortcodes
Download this release
Release Info
Developer | brandon.wamboldt |
Plugin | WordPress Access Control |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.1 to 3.0.2
- documentation/assets/css/readme.css +228 -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 +278 -0
- languages/wordpress-access-control.pot +341 -0
- readme.txt +43 -14
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- templates/meta_box.php +41 -18
- templates/options.php +258 -0
- wordpress-access-control.php +300 -27
documentation/assets/css/readme.css
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
html {
|
2 |
+
background:#f9f9f9;
|
3 |
+
}
|
4 |
+
|
5 |
+
body {
|
6 |
+
background:#fff;
|
7 |
+
color:#333;
|
8 |
+
font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
|
9 |
+
width:700px;
|
10 |
+
-moz-border-radius:11px;
|
11 |
+
-khtml-border-radius:11px;
|
12 |
+
-webkit-border-radius:11px;
|
13 |
+
border-radius:11px;
|
14 |
+
border:1px solid #dfdfdf;
|
15 |
+
margin:2em auto;
|
16 |
+
padding:1em 2em;
|
17 |
+
}
|
18 |
+
|
19 |
+
ol.alpha {
|
20 |
+
list-style:upper-alpha;
|
21 |
+
}
|
22 |
+
|
23 |
+
ol.alpha ol.alpha {
|
24 |
+
list-style: lower-alpha;
|
25 |
+
}
|
26 |
+
|
27 |
+
a {
|
28 |
+
color:#2583ad;
|
29 |
+
text-decoration:none;
|
30 |
+
}
|
31 |
+
|
32 |
+
a:hover {
|
33 |
+
color:#d54e21;
|
34 |
+
}
|
35 |
+
|
36 |
+
h1 {
|
37 |
+
border-bottom:1px solid #dadada;
|
38 |
+
clear:both;
|
39 |
+
color:#666;
|
40 |
+
font:24px Georgia,"Times New Roman",Times,serif;
|
41 |
+
margin:5px 0 0 -4px;
|
42 |
+
padding:0 0 7px;
|
43 |
+
}
|
44 |
+
|
45 |
+
h2 {
|
46 |
+
font-size:16px;
|
47 |
+
border-bottom:1px solid #dadada;
|
48 |
+
color:#666;
|
49 |
+
font-weight: 100;
|
50 |
+
padding:0 0 4px;
|
51 |
+
}
|
52 |
+
|
53 |
+
p, li, dd, dt {
|
54 |
+
padding-bottom:2px;
|
55 |
+
font-size:12px;
|
56 |
+
line-height:18px;
|
57 |
+
}
|
58 |
+
|
59 |
+
code,.code {
|
60 |
+
font-size:13px;
|
61 |
+
}
|
62 |
+
|
63 |
+
ul,ol,dl {
|
64 |
+
padding:5px 5px 5px 22px;
|
65 |
+
}
|
66 |
+
|
67 |
+
a img {
|
68 |
+
border:0;
|
69 |
+
}
|
70 |
+
|
71 |
+
abbr {
|
72 |
+
border:0;
|
73 |
+
font-variant:normal;
|
74 |
+
}
|
75 |
+
|
76 |
+
#logo {
|
77 |
+
border-bottom:none;
|
78 |
+
text-align:center;
|
79 |
+
margin:6px 0 14px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.step {
|
83 |
+
margin:20px 0 15px;
|
84 |
+
}
|
85 |
+
|
86 |
+
.step,th {
|
87 |
+
text-align:left;
|
88 |
+
padding:0;
|
89 |
+
}
|
90 |
+
|
91 |
+
.submit input,.button,.button-secondary {
|
92 |
+
font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
|
93 |
+
text-decoration:none;
|
94 |
+
font-size:14px!important;
|
95 |
+
line-height:16px;
|
96 |
+
cursor:pointer;
|
97 |
+
border:1px solid #bbb;
|
98 |
+
color:#464646;
|
99 |
+
-moz-border-radius:15px;
|
100 |
+
-khtml-border-radius:15px;
|
101 |
+
-webkit-border-radius:15px;
|
102 |
+
border-radius:15px;
|
103 |
+
-moz-box-sizing:content-box;
|
104 |
+
-webkit-box-sizing:content-box;
|
105 |
+
-khtml-box-sizing:content-box;
|
106 |
+
box-sizing:content-box;
|
107 |
+
padding:6px 12px;
|
108 |
+
}
|
109 |
+
|
110 |
+
.button:hover,.button-secondary:hover,.submit input:hover {
|
111 |
+
color:#000;
|
112 |
+
border-color:#666;
|
113 |
+
}
|
114 |
+
|
115 |
+
.button,.submit input,.button-secondary {
|
116 |
+
background:#f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
|
117 |
+
}
|
118 |
+
|
119 |
+
.button:active,.submit input:active,.button-secondary:active {
|
120 |
+
background:#eee url(../images/white-grad-active.png) repeat-x scroll left top;
|
121 |
+
}
|
122 |
+
|
123 |
+
textarea {
|
124 |
+
border:1px solid #bbb;
|
125 |
+
-moz-border-radius:3px;
|
126 |
+
-khtml-border-radius:3px;
|
127 |
+
-webkit-border-radius:3px;
|
128 |
+
border-radius:3px;
|
129 |
+
}
|
130 |
+
|
131 |
+
.form-table {
|
132 |
+
border-collapse:collapse;
|
133 |
+
margin-top:1em;
|
134 |
+
width:100%;
|
135 |
+
}
|
136 |
+
|
137 |
+
.form-table td {
|
138 |
+
margin-bottom:9px;
|
139 |
+
border-bottom:8px solid #fff;
|
140 |
+
font-size:12px;
|
141 |
+
padding:10px;
|
142 |
+
}
|
143 |
+
|
144 |
+
.form-table th {
|
145 |
+
font-size:13px;
|
146 |
+
text-align:left;
|
147 |
+
border-bottom:8px solid #fff;
|
148 |
+
width:130px;
|
149 |
+
vertical-align:top;
|
150 |
+
padding:16px 10px 10px;
|
151 |
+
}
|
152 |
+
|
153 |
+
.form-table tr {
|
154 |
+
background:#f3f3f3;
|
155 |
+
}
|
156 |
+
|
157 |
+
.form-table code {
|
158 |
+
line-height:18px;
|
159 |
+
font-size:18px;
|
160 |
+
}
|
161 |
+
|
162 |
+
.form-table p {
|
163 |
+
font-size:11px;
|
164 |
+
margin:4px 0 0;
|
165 |
+
}
|
166 |
+
|
167 |
+
.form-table input {
|
168 |
+
line-height:20px;
|
169 |
+
font-size:15px;
|
170 |
+
padding:2px;
|
171 |
+
}
|
172 |
+
|
173 |
+
.form-table th p {
|
174 |
+
font-weight:400;
|
175 |
+
}
|
176 |
+
|
177 |
+
#error-page {
|
178 |
+
margin-top:50px;
|
179 |
+
}
|
180 |
+
|
181 |
+
#error-page p {
|
182 |
+
font-size:12px;
|
183 |
+
line-height:18px;
|
184 |
+
margin:25px 0 20px;
|
185 |
+
}
|
186 |
+
|
187 |
+
#error-page code,.code {
|
188 |
+
font-family:Consolas,Monaco,Courier,monospace;
|
189 |
+
}
|
190 |
+
|
191 |
+
#pass-strength-result {
|
192 |
+
background-color:#eee;
|
193 |
+
text-align:center;
|
194 |
+
width:200px;
|
195 |
+
display:none;
|
196 |
+
border-color:#ddd!important;
|
197 |
+
border-style:solid;
|
198 |
+
border-width:1px;
|
199 |
+
margin:5px 5px 5px 1px;
|
200 |
+
padding:5px;
|
201 |
+
}
|
202 |
+
|
203 |
+
#pass-strength-result.bad {
|
204 |
+
background-color:#ffb78c;
|
205 |
+
border-color:#ff853c!important;
|
206 |
+
}
|
207 |
+
|
208 |
+
#pass-strength-result.good {
|
209 |
+
background-color:#ffec8b;
|
210 |
+
border-color:#fc0!important;
|
211 |
+
}
|
212 |
+
|
213 |
+
#pass-strength-result.short {
|
214 |
+
background-color:#ffa0a0;
|
215 |
+
border-color:#f04040!important;
|
216 |
+
}
|
217 |
+
|
218 |
+
#pass-strength-result.strong {
|
219 |
+
background-color:#c3ff88;
|
220 |
+
border-color:#8dff1c!important;
|
221 |
+
}
|
222 |
+
|
223 |
+
.message {
|
224 |
+
border:1px solid #e6db55;
|
225 |
+
background-color:#ffffe0;
|
226 |
+
margin:5px 0 15px;
|
227 |
+
padding:.3em .6em;
|
228 |
+
}
|
documentation/assets/images/default_interface.png
ADDED
Binary file
|
documentation/assets/images/htmlstructure.png
ADDED
Binary file
|
documentation/assets/images/members_interface.png
ADDED
Binary file
|
documentation/assets/images/nonmembers_interface.png
ADDED
Binary file
|
documentation/assets/images/white-grad-active.png
ADDED
Binary file
|
documentation/assets/images/white-grad.png
ADDED
Binary file
|
documentation/assets/images/wordpress-logo.png
ADDED
Binary file
|
documentation/index.html
ADDED
@@ -0,0 +1,278 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
|
3 |
+
<html>
|
4 |
+
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8" />
|
7 |
+
<title>Documentation » WordPress Access Control</title>
|
8 |
+
|
9 |
+
<link rel="stylesheet" href="assets/css/readme.css" type="text/css" />
|
10 |
+
</head>
|
11 |
+
|
12 |
+
<body>
|
13 |
+
<h1 id="logo">
|
14 |
+
<a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" width="250" height="68" /></a><br />
|
15 |
+
WordPress Access Control Documentation Version 3.0.2
|
16 |
+
</h1>
|
17 |
+
|
18 |
+
<p style="text-align: center">The complete guide this plugin</p>
|
19 |
+
|
20 |
+
<h1>First Things First</h1>
|
21 |
+
|
22 |
+
<p>
|
23 |
+
WordPress Access Control is an access control plugin for WordPress, and was
|
24 |
+
built by Brandon Wamboldt. If you have questions outside of the scope of this
|
25 |
+
help file, require assistance, want to report a bug, request a feature or
|
26 |
+
anything else, please <a href="mailto:brandon.wamboldt@gmail.com">email me</a> or
|
27 |
+
leave a comment on my blog, <a href="http://brandonwamboldt.ca/plugins/members-only-menu-plugin/">http://brandonwamboldt.ca/plugins/members-only-menu-plugin/</a>.
|
28 |
+
</p>
|
29 |
+
|
30 |
+
<h1>Table Of Contents</h1>
|
31 |
+
|
32 |
+
<ol class="alpha" id="toc">
|
33 |
+
<li><a href="#introduction">Introduction</a></li>
|
34 |
+
<li><a href="#requirements">Requirements</a></li>
|
35 |
+
<li><a href="#installation">Installation & Configuration</a></li>
|
36 |
+
<li><a href="#settings">Settings</a>
|
37 |
+
<ol class="alpha">
|
38 |
+
<li><a href="#general_options">General Options</a></li>
|
39 |
+
<li><a href="#menu_options">Menu Options</a></li>
|
40 |
+
<li><a href="#postpage_default_options">Post/Page Default Options</a></li>
|
41 |
+
<li><a href="#search_options">Search/Archive Options</a></li>
|
42 |
+
</ol>
|
43 |
+
</li>
|
44 |
+
<li><a href="#shortcodes">Shortcodes</a></li>
|
45 |
+
<li><a href="#interface">Interface</a></li>
|
46 |
+
<li><a href="#changelog">Changelog</a></li>
|
47 |
+
<li><a href="#credits">Sources and Credits</a></li>
|
48 |
+
</ol>
|
49 |
+
|
50 |
+
<h1 id="introduction">A) Introduction - <a href="#toc">top</a></h1>
|
51 |
+
|
52 |
+
<p>
|
53 |
+
The purpose of WordPress Access Control is to provide an easy interface to users for
|
54 |
+
restricting access to content. It was designed for use on members sites where not all
|
55 |
+
content should be accessible by the public, such as with organizations or pay-sites.
|
56 |
+
</p>
|
57 |
+
|
58 |
+
<p>
|
59 |
+
WPAC gives you the ability to restrict content to members, specific roles, or even
|
60 |
+
non-members on a per-page/per-post basis, or using shortcodes. You can still add
|
61 |
+
restricted pages to the navigation, and by default they will only show up to users
|
62 |
+
with the required access. This is an option however.
|
63 |
+
</p>
|
64 |
+
|
65 |
+
<p>
|
66 |
+
WPAC also gives you the ability to customize search/archive pages, completing hiding
|
67 |
+
restricted posts/pages from search results if a user can't access them, showing just
|
68 |
+
the title with a customizable message where the excerpt would be, or showing the title
|
69 |
+
and excerpt.
|
70 |
+
</p>
|
71 |
+
|
72 |
+
<p>
|
73 |
+
This plugin supports custom post types via an easy to use admin option.
|
74 |
+
</p>
|
75 |
+
|
76 |
+
<h1 id="requirements">B) Requirements - <a href="#toc">top</a></h1>
|
77 |
+
|
78 |
+
<p>
|
79 |
+
WordPress Access Control has only been tested with WordPress 2.9 and greater. WordPress Access Control requires <strong>PHP4</strong> or higher, although <strong>PHP5</strong> is recommended.
|
80 |
+
</p>
|
81 |
+
|
82 |
+
<p style="color:red;">
|
83 |
+
WordPress Access Control may not work with all themes. If you find are using WPAC with a theme and it's not working well, please contact me with the name of the theme as well as a link to the theme, and your PHP version.
|
84 |
+
</p>
|
85 |
+
|
86 |
+
<h1 id="installation">C) Installation & Configuration - <a href="#toc">top</a></h1>
|
87 |
+
|
88 |
+
<p>
|
89 |
+
Installation is simple, just follow these steps and you should have no problems.
|
90 |
+
</p>
|
91 |
+
|
92 |
+
<ol>
|
93 |
+
<li>Upload the wordpress-access-control/ folder included in the zip to your WordPress installation's plugin folder. The default location should be /wp-content/plugins/</li>
|
94 |
+
<li>Login to your WordPress administration panel, located by default at http://your-site-here.com/wp-admin/</li>
|
95 |
+
<li>Click on Plugins on the left menu</li>
|
96 |
+
<li>Scroll down to “WordPress Access Control” and click the "Activate" link</li>
|
97 |
+
<li>Scroll back down to “WordPress Access Control” and click "Visit options page". Alternatively, you can access this from Settings > Members Only</li>
|
98 |
+
<li>Set your default settings. An explanation of the settings can be found below.</li>
|
99 |
+
<li>Finished!</li>
|
100 |
+
</ol>
|
101 |
+
|
102 |
+
<h1 id="settings">D) Settings - <a href="#toc">top</a></h1>
|
103 |
+
|
104 |
+
<p>
|
105 |
+
Using the settings screen, you can set many default options for the
|
106 |
+
plugin, which is useful for saving time if most of your pages/posts
|
107 |
+
will have similar access settings. Most of these settings can be
|
108 |
+
overwritten on a per-page/per-post basis.
|
109 |
+
</p>
|
110 |
+
|
111 |
+
<h2 id="general_options">A) General Options - <a href="#toc">top</a></h2>
|
112 |
+
|
113 |
+
<p>
|
114 |
+
<strong>Make Blog Members Only</strong><br />
|
115 |
+
This setting will make the blog page itself, as well as any archive
|
116 |
+
pages restricted to members. Regular pages will still be accessible
|
117 |
+
to non-members however. This setting uses the <a href="http://codex.wordpress.org/Function_Reference/is_home">is_home()</a> and
|
118 |
+
<a href="http://codex.wordpress.org/Function_Reference/is_archive">is_archive()</a> functions to determine blog/archive pages.<br /><br />
|
119 |
+
|
120 |
+
<strong>Members Blog Redirect</strong><br />
|
121 |
+
This setting is a website address to redirect users to if they try to
|
122 |
+
access the blog or archive pages with the "Make Blog Members Only"
|
123 |
+
setting active. By default, it will redirect to the login page.<br /><br />
|
124 |
+
|
125 |
+
<strong>Custom Post Types</strong><br />
|
126 |
+
This setting allows you to enable the Members Only controls for custom
|
127 |
+
post types. This setting only works if the custom post type uses the
|
128 |
+
standard WordPress interface.
|
129 |
+
</p>
|
130 |
+
|
131 |
+
<h2 id="menu_options">B) Menu Options - <a href="#toc">top</a></h2>
|
132 |
+
|
133 |
+
<p>
|
134 |
+
<strong>Display In Menus</strong><br />
|
135 |
+
This setting determines how menu items work when a restricted page/post is
|
136 |
+
added to the navigation and a user doesn't have access to it. You can
|
137 |
+
show the menu only if a user has access to it, or you can show it all
|
138 |
+
the time. If you decide to show it all the time, a user who clicks on a menu
|
139 |
+
item but does not have access to view it will be redirected.
|
140 |
+
</p>
|
141 |
+
|
142 |
+
<h2 id="postpage_default_options">C) Post/Page Default Options - <a href="#toc">top</a></h2>
|
143 |
+
|
144 |
+
<p>
|
145 |
+
<strong>Default Post State</strong><br />
|
146 |
+
This setting determines the default option when creating a new post. Public
|
147 |
+
is the default setting and means the post will be accessible to all. Members
|
148 |
+
Only restricts the post to authenticated users, and Non-Members restricts
|
149 |
+
the post to unauthenticated users.<br /><br />
|
150 |
+
|
151 |
+
<strong>Posts: Only Accessible By</strong><br />
|
152 |
+
This setting determines the default option when creating a new page for which
|
153 |
+
roles can access the post. This setting is only used if the post is set for
|
154 |
+
Members Only. Roles are managed using plugins.<br /><br />
|
155 |
+
|
156 |
+
<strong>Default Page State</strong><br />
|
157 |
+
This setting determines the default option when creating a new page. Public
|
158 |
+
is the default setting and means the page will be accessible to all. Members
|
159 |
+
Only restricts the page to authenticated users, and Non-Members restricts
|
160 |
+
the page to unauthenticated users.<br /><br />This setting also acts as
|
161 |
+
the default for custom post types.<br /><br />
|
162 |
+
|
163 |
+
<strong>Pages: Only Accessible By</strong><br />
|
164 |
+
This setting determines the default option when creating a new page for which
|
165 |
+
roles can access the page. This setting is only used if the page is set for
|
166 |
+
Members Only. Roles are managed using plugins.<br /><br />This setting also acts as
|
167 |
+
the default for custom post types.<br /><br />
|
168 |
+
|
169 |
+
<strong>Default Redirect For Members Only Pages</strong><br />
|
170 |
+
This is the default URL to redirect users to when they attempt to access
|
171 |
+
a restricted page/post.<br /><br />
|
172 |
+
|
173 |
+
The link provided here is automatically appended with a redirect_to query
|
174 |
+
argument, so that the page may redirect the user back if they wish.
|
175 |
+
</p>
|
176 |
+
|
177 |
+
<h2 id="search_options">D) Search/Archive Options - <a href="#toc">top</a></h2>
|
178 |
+
|
179 |
+
<p>
|
180 |
+
<strong>Search Options</strong><br />
|
181 |
+
This setting determines how restricted posts/pages will appear in
|
182 |
+
search or archive pages. This setting uses <a href="http://codex.wordpress.org/Function_Reference/is_search">is_search()</a>
|
183 |
+
and <a href="http://codex.wordpress.org/Function_Reference/is_archive">is_archive()</a>
|
184 |
+
to determine use.<br /><br />
|
185 |
+
If you do not check "Show restricted post excerpts in search results?" the excerpt
|
186 |
+
will be replaced with text from the below options.<br /><br />
|
187 |
+
The page settings for this setting determine defaults for custom post types.<br /><br />
|
188 |
+
|
189 |
+
<strong>Search Excerpt (Posts)/Search Excerpt (Pages)</strong><br />
|
190 |
+
This text is displayed instead of the post/page excerpt in archive/search pages to users
|
191 |
+
without the required access, but only if the post/page is set to now show it's
|
192 |
+
excerpt.
|
193 |
+
</p>
|
194 |
+
|
195 |
+
<h1 id="shortcodes">E) Shortcodes - <a href="#toc">top</a></h1>
|
196 |
+
|
197 |
+
<p>
|
198 |
+
There are two shortcodes available for use with this plugin.<br /><br />
|
199 |
+
|
200 |
+
[members][/members] will hide the content within them unless the user is
|
201 |
+
authenticated. Also works during searching, so that if a user searches for
|
202 |
+
a term found in the shortcodes, but is not logged in, the page/post will
|
203 |
+
not show up in the results.
|
204 |
+
</p>
|
205 |
+
|
206 |
+
<p>
|
207 |
+
[nonmembers][/nonmembers] will hide the content within them unless the user is
|
208 |
+
not authenticated. Also works during searching, so that if a user searches for
|
209 |
+
a term found in the shortcodes, but is logged in, the page/post will
|
210 |
+
not show up in the results.
|
211 |
+
</p>
|
212 |
+
|
213 |
+
<h1 id="interface">F) Interface - <a href="#toc">top</a></h1>
|
214 |
+
|
215 |
+
<p>
|
216 |
+
By default, when you edit/add a new post/page, the control interface should be displayed on
|
217 |
+
the right, directly above the "Publish" box. If you do not see it, please ensure it is set to
|
218 |
+
display under the "Screen Options" panel.
|
219 |
+
</p>
|
220 |
+
|
221 |
+
<p style="text-align:center;">
|
222 |
+
<img src="assets/images/default_interface.png" alt="" /><br />
|
223 |
+
The default interface is very small, and lacks many options. More options will appear once
|
224 |
+
you've checked an option.
|
225 |
+
</p>
|
226 |
+
|
227 |
+
<p style="text-align:center;">
|
228 |
+
<img src="assets/images/members_interface.png" alt="" /><br />
|
229 |
+
If you select "Only accessible by members?", several new options appear. The default values
|
230 |
+
are governed by the options screen, and an explanation of the options are available above
|
231 |
+
as well.
|
232 |
+
</p>
|
233 |
+
|
234 |
+
<p style="text-align:center;">
|
235 |
+
<img src="assets/images/nonmembers_interface.png" alt="" /><br />
|
236 |
+
If you select "Only accessible by non-members?", one new option appears. This is the URL
|
237 |
+
to redirect a user to, such as the my profile page or even a logout page.
|
238 |
+
</p>
|
239 |
+
|
240 |
+
<h1 id="changelog">G) Changelog - <a href="#toc">top</a></h1>
|
241 |
+
|
242 |
+
<p><strong>Version 3.0.2 - June 2, 2011</strong></p>
|
243 |
+
|
244 |
+
<ul>
|
245 |
+
<li>Added do_shortcode commands to allow nested shortcodes in the [members] and [nonmembers] shortcodes</li>
|
246 |
+
</ul>
|
247 |
+
|
248 |
+
<p><strong>Version 3.0.1 - June 1, 2011</strong></p>
|
249 |
+
|
250 |
+
<ul>
|
251 |
+
<li>Fixed an issue where a members only blog with no redirect link specified would cause an infinite loop</li>
|
252 |
+
</ul>
|
253 |
+
|
254 |
+
<p><strong>Version 3.0 - May 26, 2011</strong></p>
|
255 |
+
|
256 |
+
<ul>
|
257 |
+
<li>Added an admin options page</li>
|
258 |
+
<li>Added an option to allow pages to show up in menus even if a user cannot access them</li>
|
259 |
+
<li>Added support to make an entire blog members only</li>
|
260 |
+
<li>Added options to set the defaults of all options for pages and posts</li>
|
261 |
+
<li>Added support for posts</li>
|
262 |
+
<li>Added support for searching/archives</li>
|
263 |
+
<li>Added better support for custom post types</li>
|
264 |
+
<li>Added a redirect_to argument even when using custom redirect links</li>
|
265 |
+
<li>Added [member][/member] and [nonmember][/nonmember] shortcodes</li>
|
266 |
+
</ul>
|
267 |
+
|
268 |
+
<h1 id="credits">H) Sources and Credits - <a href="#toc">top</a></h1>
|
269 |
+
|
270 |
+
<p>
|
271 |
+
<ul>
|
272 |
+
<li>I'd like to thank the <a href="http://wordpress.org/">WordPress community</a> for making such an awesome development platform.</li>
|
273 |
+
<li>Made use of the WordPress codex extensively <a href="http://codex.wordpress.org/">http://codex.wordpress.org/</a></li>
|
274 |
+
</ul>
|
275 |
+
</p>
|
276 |
+
</body>
|
277 |
+
|
278 |
+
</html>
|
languages/wordpress-access-control.pot
ADDED
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WordPress Access Control version 3.0.2\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-06-04 11:04-0400\n"
|
6 |
+
"PO-Revision-Date: 2011-06-04 11:09-0400\n"
|
7 |
+
"Last-Translator: Brandon Wamboldt <brandon.wamboldt@gmail.com>\n"
|
8 |
+
"Language-Team: Brandon Wamboldt <brandon.wamboldt@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: English\n"
|
15 |
+
"X-Poedit-Country: CANADA\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-SearchPath-0: J:\\CodeCanyon\\WordPress Access Control\\wordpress-access-control\n"
|
18 |
+
|
19 |
+
#: J:\CodeCanyon\WordPress
|
20 |
+
#: Access
|
21 |
+
#: Control\wordpress-access-control/wordpress-access-control.php:245
|
22 |
+
msgid "Security check failed, please try again"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: J:\CodeCanyon\WordPress
|
26 |
+
#: Access
|
27 |
+
#: Control\wordpress-access-control/wordpress-access-control.php:345
|
28 |
+
msgid "Settings Saved."
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: J:\CodeCanyon\WordPress
|
32 |
+
#: Access
|
33 |
+
#: Control\wordpress-access-control/wordpress-access-control.php:480
|
34 |
+
#: Control\wordpress-access-control/templates/options.php:229
|
35 |
+
msgid "To view the contents of this post, you must be authenticated and have the required access level."
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: J:\CodeCanyon\WordPress
|
39 |
+
#: Access
|
40 |
+
#: Control\wordpress-access-control/wordpress-access-control.php:482
|
41 |
+
#: Control\wordpress-access-control/templates/options.php:248
|
42 |
+
msgid "To view the contents of this page, you must be authenticated and have the required access level."
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: J:\CodeCanyon\WordPress
|
46 |
+
#: Access
|
47 |
+
#: Control\wordpress-access-control/wordpress-access-control.php:675
|
48 |
+
msgid "Visit options page"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: J:\CodeCanyon\WordPress
|
52 |
+
#: Access
|
53 |
+
#: Control\wordpress-access-control/wordpress-access-control.php:676
|
54 |
+
msgid "Plugin Documentation"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: J:\CodeCanyon\WordPress
|
58 |
+
#: Access
|
59 |
+
#: Control\wordpress-access-control/templates/meta_box.php:7
|
60 |
+
msgid "Only accessible by members?"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: J:\CodeCanyon\WordPress
|
64 |
+
#: Access
|
65 |
+
#: Control\wordpress-access-control/templates/meta_box.php:10
|
66 |
+
msgid "Only Accessible By (Defaults to everyone):"
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: J:\CodeCanyon\WordPress
|
70 |
+
#: Access
|
71 |
+
#: Control\wordpress-access-control/templates/meta_box.php:38
|
72 |
+
msgid "Redirect To (Leave empty for login page):"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: J:\CodeCanyon\WordPress
|
76 |
+
#: Access
|
77 |
+
#: Control\wordpress-access-control/templates/meta_box.php:51
|
78 |
+
msgid "Show in search results?"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: J:\CodeCanyon\WordPress
|
82 |
+
#: Access
|
83 |
+
#: Control\wordpress-access-control/templates/meta_box.php:52
|
84 |
+
msgid "Show excerpt in search?"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: J:\CodeCanyon\WordPress
|
88 |
+
#: Access
|
89 |
+
#: Control\wordpress-access-control/templates/meta_box.php:58
|
90 |
+
msgid "Only accessible by non-members?"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: J:\CodeCanyon\WordPress
|
94 |
+
#: Access
|
95 |
+
#: Control\wordpress-access-control/templates/meta_box.php:63
|
96 |
+
msgid "Redirect To (Leave empty for home page):"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: J:\CodeCanyon\WordPress
|
100 |
+
#: Access
|
101 |
+
#: Control\wordpress-access-control/templates/options.php:14
|
102 |
+
msgid "WordPress Access Control Settings"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: J:\CodeCanyon\WordPress
|
106 |
+
#: Access
|
107 |
+
#: Control\wordpress-access-control/templates/options.php:29
|
108 |
+
msgid "Shortcodes"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: J:\CodeCanyon\WordPress
|
112 |
+
#: Access
|
113 |
+
#: Control\wordpress-access-control/templates/options.php:31
|
114 |
+
msgid "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]."
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: J:\CodeCanyon\WordPress
|
118 |
+
#: Access
|
119 |
+
#: Control\wordpress-access-control/templates/options.php:33
|
120 |
+
msgid "General Options"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: J:\CodeCanyon\WordPress
|
124 |
+
#: Access
|
125 |
+
#: Control\wordpress-access-control/templates/options.php:39
|
126 |
+
#: Control\wordpress-access-control/templates/options.php:43
|
127 |
+
msgid "Make Blog Members Only"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: J:\CodeCanyon\WordPress
|
131 |
+
#: Access
|
132 |
+
#: Control\wordpress-access-control/templates/options.php:49
|
133 |
+
msgid "Members Blog Redirect"
|
134 |
+
msgstr ""
|
135 |
+
|
136 |
+
#: J:\CodeCanyon\WordPress
|
137 |
+
#: Access
|
138 |
+
#: Control\wordpress-access-control/templates/options.php:54
|
139 |
+
#, php-format
|
140 |
+
msgid ""
|
141 |
+
"Where to redirect non-members when they try to visit the blog. %1$s\n"
|
142 |
+
"Defaults to WordPress login page (%2$s)%1$s\n"
|
143 |
+
"After a user logs in they will be redirected back to the blog"
|
144 |
+
msgstr ""
|
145 |
+
|
146 |
+
#: J:\CodeCanyon\WordPress
|
147 |
+
#: Access
|
148 |
+
#: Control\wordpress-access-control/templates/options.php:62
|
149 |
+
msgid "Custom Post Types"
|
150 |
+
msgstr ""
|
151 |
+
|
152 |
+
#: J:\CodeCanyon\WordPress
|
153 |
+
#: Access
|
154 |
+
#: Control\wordpress-access-control/templates/options.php:66
|
155 |
+
msgid "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."
|
156 |
+
msgstr ""
|
157 |
+
|
158 |
+
#: J:\CodeCanyon\WordPress
|
159 |
+
#: Access
|
160 |
+
#: Control\wordpress-access-control/templates/options.php:88
|
161 |
+
msgid "Menu Options"
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
#: J:\CodeCanyon\WordPress
|
165 |
+
#: Access
|
166 |
+
#: Control\wordpress-access-control/templates/options.php:94
|
167 |
+
msgid "Display In Menus"
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: J:\CodeCanyon\WordPress
|
171 |
+
#: Access
|
172 |
+
#: Control\wordpress-access-control/templates/options.php:97
|
173 |
+
msgid "By default, should pages and posts be displayed in your menu even if the user doesn't have access to them? Items will always show up for users with access to them"
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: J:\CodeCanyon\WordPress
|
177 |
+
#: Access
|
178 |
+
#: Control\wordpress-access-control/templates/options.php:98
|
179 |
+
msgid "Only show menu items to users with access to them"
|
180 |
+
msgstr ""
|
181 |
+
|
182 |
+
#: J:\CodeCanyon\WordPress
|
183 |
+
#: Access
|
184 |
+
#: Control\wordpress-access-control/templates/options.php:99
|
185 |
+
msgid "Always show all menu items even if the user cannot access them"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: J:\CodeCanyon\WordPress
|
189 |
+
#: Access
|
190 |
+
#: Control\wordpress-access-control/templates/options.php:106
|
191 |
+
msgid "Post/Page Default Options"
|
192 |
+
msgstr ""
|
193 |
+
|
194 |
+
#: J:\CodeCanyon\WordPress
|
195 |
+
#: Access
|
196 |
+
#: Control\wordpress-access-control/templates/options.php:109
|
197 |
+
msgid "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."
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: J:\CodeCanyon\WordPress
|
201 |
+
#: Access
|
202 |
+
#: Control\wordpress-access-control/templates/options.php:116
|
203 |
+
msgid "Default Post State"
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: J:\CodeCanyon\WordPress
|
207 |
+
#: Access
|
208 |
+
#: Control\wordpress-access-control/templates/options.php:119
|
209 |
+
#: Control\wordpress-access-control/templates/options.php:152
|
210 |
+
msgid "Public"
|
211 |
+
msgstr ""
|
212 |
+
|
213 |
+
#: J:\CodeCanyon\WordPress
|
214 |
+
#: Access
|
215 |
+
#: Control\wordpress-access-control/templates/options.php:120
|
216 |
+
#: Control\wordpress-access-control/templates/options.php:153
|
217 |
+
msgid "Members Only"
|
218 |
+
msgstr ""
|
219 |
+
|
220 |
+
#: J:\CodeCanyon\WordPress
|
221 |
+
#: Access
|
222 |
+
#: Control\wordpress-access-control/templates/options.php:121
|
223 |
+
#: Control\wordpress-access-control/templates/options.php:154
|
224 |
+
msgid "Non-Members Only"
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: J:\CodeCanyon\WordPress
|
228 |
+
#: Access
|
229 |
+
#: Control\wordpress-access-control/templates/options.php:127
|
230 |
+
msgid "Posts: Only Accessible By"
|
231 |
+
msgstr ""
|
232 |
+
|
233 |
+
#: J:\CodeCanyon\WordPress
|
234 |
+
#: Access
|
235 |
+
#: Control\wordpress-access-control/templates/options.php:143
|
236 |
+
#: Control\wordpress-access-control/templates/options.php:176
|
237 |
+
msgid "Defaults to all roles"
|
238 |
+
msgstr ""
|
239 |
+
|
240 |
+
#: J:\CodeCanyon\WordPress
|
241 |
+
#: Access
|
242 |
+
#: Control\wordpress-access-control/templates/options.php:149
|
243 |
+
msgid "Default Page State"
|
244 |
+
msgstr ""
|
245 |
+
|
246 |
+
#: J:\CodeCanyon\WordPress
|
247 |
+
#: Access
|
248 |
+
#: Control\wordpress-access-control/templates/options.php:160
|
249 |
+
msgid "Pages: Only Accessible By"
|
250 |
+
msgstr ""
|
251 |
+
|
252 |
+
#: J:\CodeCanyon\WordPress
|
253 |
+
#: Access
|
254 |
+
#: Control\wordpress-access-control/templates/options.php:182
|
255 |
+
msgid "Default Redirect For Members Only Pages"
|
256 |
+
msgstr ""
|
257 |
+
|
258 |
+
#: J:\CodeCanyon\WordPress
|
259 |
+
#: Access
|
260 |
+
#: Control\wordpress-access-control/templates/options.php:187
|
261 |
+
#, php-format
|
262 |
+
msgid "Defaults to WordPress login page (%1$s)%2$sAfter a user logs in they will be redirected back to the page they attempted to view"
|
263 |
+
msgstr ""
|
264 |
+
|
265 |
+
#: J:\CodeCanyon\WordPress
|
266 |
+
#: Access
|
267 |
+
#: Control\wordpress-access-control/templates/options.php:194
|
268 |
+
msgid "Search/Archive Options"
|
269 |
+
msgstr ""
|
270 |
+
|
271 |
+
#: J:\CodeCanyon\WordPress
|
272 |
+
#: Access
|
273 |
+
#: Control\wordpress-access-control/templates/options.php:197
|
274 |
+
msgid ""
|
275 |
+
"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). \n"
|
276 |
+
"<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 \n"
|
277 |
+
"post state to Members Only, then set the Search Options to show restricted posts in search results and show post excerpts."
|
278 |
+
msgstr ""
|
279 |
+
|
280 |
+
#: J:\CodeCanyon\WordPress
|
281 |
+
#: Access
|
282 |
+
#: Control\wordpress-access-control/templates/options.php:206
|
283 |
+
msgid "Search Options"
|
284 |
+
msgstr ""
|
285 |
+
|
286 |
+
#: J:\CodeCanyon\WordPress
|
287 |
+
#: Access
|
288 |
+
#: Control\wordpress-access-control/templates/options.php:209
|
289 |
+
msgid "Show restricted posts in search results?"
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
+
#: J:\CodeCanyon\WordPress
|
293 |
+
#: Access
|
294 |
+
#: Control\wordpress-access-control/templates/options.php:210
|
295 |
+
msgid "Show restricted post excerpts in search results?"
|
296 |
+
msgstr ""
|
297 |
+
|
298 |
+
#: J:\CodeCanyon\WordPress
|
299 |
+
#: Access
|
300 |
+
#: Control\wordpress-access-control/templates/options.php:211
|
301 |
+
msgid "Show restricted pages in search results?"
|
302 |
+
msgstr ""
|
303 |
+
|
304 |
+
#: J:\CodeCanyon\WordPress
|
305 |
+
#: Access
|
306 |
+
#: Control\wordpress-access-control/templates/options.php:212
|
307 |
+
msgid "Show restricted page excerpts in search results?"
|
308 |
+
msgstr ""
|
309 |
+
|
310 |
+
#: J:\CodeCanyon\WordPress
|
311 |
+
#: Access
|
312 |
+
#: Control\wordpress-access-control/templates/options.php:218
|
313 |
+
#: Control\wordpress-access-control/templates/options.php:222
|
314 |
+
msgid "Search Excerpt (Posts)"
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: J:\CodeCanyon\WordPress
|
318 |
+
#: Access
|
319 |
+
#: Control\wordpress-access-control/templates/options.php:225
|
320 |
+
msgid "If a post is set to show in search results WITHOUT an excerpt, this text will be displayed instead."
|
321 |
+
msgstr ""
|
322 |
+
|
323 |
+
#: J:\CodeCanyon\WordPress
|
324 |
+
#: Access
|
325 |
+
#: Control\wordpress-access-control/templates/options.php:237
|
326 |
+
#: Control\wordpress-access-control/templates/options.php:241
|
327 |
+
msgid "Search Excerpt (Pages)"
|
328 |
+
msgstr ""
|
329 |
+
|
330 |
+
#: J:\CodeCanyon\WordPress
|
331 |
+
#: Access
|
332 |
+
#: Control\wordpress-access-control/templates/options.php:244
|
333 |
+
msgid "If a page is set to show in search results WITHOUT an excerpt, this text will be displayed instead."
|
334 |
+
msgstr ""
|
335 |
+
|
336 |
+
#: J:\CodeCanyon\WordPress
|
337 |
+
#: Access
|
338 |
+
#: Control\wordpress-access-control/templates/options.php:256
|
339 |
+
msgid "Save Changes"
|
340 |
+
msgstr ""
|
341 |
+
|
readme.txt
CHANGED
@@ -3,44 +3,73 @@ 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.0, wp_nav_menu, nonmembers
|
5 |
Requires at least: 2.9
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 2
|
8 |
|
9 |
-
Restrict pages to members, nonmembers or specific roles and still add to navigation
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
**
|
14 |
|
15 |
-
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
== Installation ==
|
24 |
|
25 |
Installation is very simple:
|
26 |
|
27 |
-
1. Upload
|
28 |
-
2.
|
29 |
-
3.
|
|
|
|
|
|
|
30 |
|
31 |
== Frequently Asked Questions ==
|
32 |
|
33 |
-
**I
|
|
|
34 |
|
35 |
-
This
|
|
|
36 |
|
37 |
== Screenshots ==
|
38 |
|
39 |
1. The meta box added by this plugin
|
40 |
-
2. The
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 2.1 =
|
45 |
* Added an icon on the page list dialog that shows Non-member or Member only statuses
|
46 |
* Bug Fix: Fixed a PHP4 bug by replacing self with the full class name thanks to `itpixie`
|
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.0, wp_nav_menu, nonmembers
|
5 |
Requires at least: 2.9
|
6 |
+
Tested up to: 3.2
|
7 |
+
Stable tag: 3.0.2
|
8 |
|
9 |
+
Restrict pages, posts and custom post types to members, nonmembers or specific roles and still add to navigation
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
**Now with shortcodes and post/custom-post-type support, as well as a comprehensive admin interface for setting plugin defaults**
|
14 |
|
15 |
+
WordPress Access Control is a plugin designed to integrate into membership sites where certain pages, posts and custom post types should only be available to members of the site. The plugin offers fine tuned features for this purpose, including the ability to set site wide defaults and override these on a per-page basis.
|
16 |
|
17 |
+
You can easily set a page to be accessible only by members of your site, or even a specific role. You can also set pages to be accessible only to non-members of your site, useful for registration pages.
|
18 |
|
19 |
+
By default, you can add Members only pages to your menus, and users who cannot access them (non-members) won't be able to see them. This applys to the children of a menu item as well, making it easy to build a separate menu for your members.
|
20 |
|
21 |
+
Additionally, you have the ability to customize search pages, completely hiding posts/pages from search results if a user can't access them, showing search results without an excerpt, or showing search results normally.
|
22 |
+
|
23 |
+
**Translators:** The POT file is included with the plugin and all text output uses gettext functions. Alternatively, you may download the POT file from http://brandonwamboldt.ca/files/wordpress-access-control.pot.
|
24 |
+
|
25 |
+
**Documentation:** The plugin includes comprehensive documentation file accessible via the plugin directory
|
26 |
|
27 |
== Installation ==
|
28 |
|
29 |
Installation is very simple:
|
30 |
|
31 |
+
1. Upload wordpress-access-control/ to your websites plugins folder (/wp-content/plugins/ by default)
|
32 |
+
2. Login to your WordPress admin
|
33 |
+
3. Navigate to Plugins
|
34 |
+
4. Activate WordPress Access Control
|
35 |
+
|
36 |
+
You can change settings by going to Settings > Members Only Settings
|
37 |
|
38 |
== Frequently Asked Questions ==
|
39 |
|
40 |
+
**I don't see the controls on the page/post edit screens**
|
41 |
+
Please make sure you have the meta enabled under the Screen Options panel (top right next to help)
|
42 |
|
43 |
+
**This plugin doesn't work with theme XYZ**
|
44 |
+
Please leave a comment at http://brandonwamboldt.ca/plugins/members-only-menu-plugin/ and I will address it A.S.A.P.
|
45 |
|
46 |
== Screenshots ==
|
47 |
|
48 |
1. The meta box added by this plugin
|
49 |
+
2. The comprehensive admin settings interface
|
50 |
|
51 |
== Changelog ==
|
52 |
|
53 |
+
= 3.0.2 - June 2, 2011 =
|
54 |
+
|
55 |
+
* Added do_shortcode commands to allow nested shortcodes in the [members] and [nonmembers] shortcodes
|
56 |
+
|
57 |
+
= 3.0.1 - June 1, 2011 =
|
58 |
+
|
59 |
+
* Fixed an issue where a members only blog with no redirect link specified would cause an infinite loop
|
60 |
+
|
61 |
+
= 3.0 - May 26, 2011 =
|
62 |
+
|
63 |
+
* Added an admin options page
|
64 |
+
* Added an option to allow pages to show up in menus even if a user cannot access them
|
65 |
+
* Added support to make an entire blog members only
|
66 |
+
* Added options to set the defaults of all options for pages and posts
|
67 |
+
* Added support for posts
|
68 |
+
* Added support for searching/archives
|
69 |
+
* Added better support for custom post types
|
70 |
+
* Added a redirect_to argument even when using custom redirect links
|
71 |
+
* Added [member][/member] and [nonmember][/nonmember] shortcodes
|
72 |
+
|
73 |
= 2.1 =
|
74 |
* Added an icon on the page list dialog that shows Non-member or Member only statuses
|
75 |
* Bug Fix: Fixed a PHP4 bug by replacing self with the full class name thanks to `itpixie`
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
templates/meta_box.php
CHANGED
@@ -1,43 +1,66 @@
|
|
1 |
-
|
|
|
|
|
2 |
|
3 |
<div id="members_only_container">
|
4 |
<input type="checkbox" name="members_only" id="members_only" value="true" <?php echo $is_members_only; ?> />
|
5 |
-
<?php _e('Only accessible by members?'); ?>
|
6 |
|
7 |
<div id="members_only_options" class="hide-if-js">
|
8 |
-
<br /><strong
|
9 |
|
10 |
<?php
|
11 |
global $wp_roles;
|
12 |
$roles = $wp_roles->get_names();
|
13 |
-
$checked_roles = (array)maybe_unserialize(get_post_meta($post->ID, '_wpac_restricted_to',
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
foreach ($roles as $role => $label) {
|
16 |
-
if (in_array($role, $checked_roles)) {
|
17 |
echo '<input type="checkbox" name="wpac_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '<br />';
|
18 |
} else {
|
19 |
echo '<input type="checkbox" name="wpac_restricted_to[]" value="' . $role . '" /> ' . $label . '<br />';
|
20 |
}
|
21 |
}
|
22 |
|
23 |
-
$redirect_to = get_post_meta($post->ID, '_wpac_members_redirect_to',
|
|
|
|
|
|
|
|
|
24 |
?>
|
25 |
|
26 |
-
<br /><strong
|
27 |
-
<input type="text" name="wpac_members_redirect_to" value="<?php echo $redirect_to; ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
</div>
|
29 |
</div>
|
30 |
|
31 |
<div id="nonmembers_only_container">
|
32 |
<input type="checkbox" name="nonmembers_only" id="nonmembers_only" value="true" <?php echo $is_nonmembers_only; ?> />
|
33 |
-
<?php _e('Only accessible by non-members?'); ?>
|
34 |
|
35 |
<div id="nonmembers_only_options" class="hide-if-js">
|
36 |
-
<?php
|
37 |
-
$redirect_to = get_post_meta($post->ID, '_wpac_nonmembers_redirect_to', true);
|
38 |
-
?>
|
39 |
|
40 |
-
<br /><strong
|
41 |
<input type="text" name="wpac_nonmembers_redirect_to" value="<?php echo $redirect_to; ?>" />
|
42 |
</div>
|
43 |
</div>
|
@@ -46,7 +69,7 @@
|
|
46 |
//$j = jQuery.noConflict();
|
47 |
|
48 |
jQuery('#members_only').change(function() {
|
49 |
-
if (jQuery(this).
|
50 |
jQuery('#nonmembers_only_container').hide('fast');
|
51 |
jQuery('#members_only_options').show('fast');
|
52 |
} else {
|
@@ -56,7 +79,7 @@ jQuery('#members_only').change(function() {
|
|
56 |
});
|
57 |
|
58 |
jQuery('#nonmembers_only').change(function() {
|
59 |
-
if (jQuery(this).
|
60 |
jQuery('#members_only_container').hide('fast');
|
61 |
jQuery('#nonmembers_only_options').show('fast');
|
62 |
} else {
|
@@ -65,10 +88,10 @@ jQuery('#nonmembers_only').change(function() {
|
|
65 |
}
|
66 |
});
|
67 |
|
68 |
-
if (jQuery('#nonmembers_only').
|
69 |
jQuery('#members_only_container').hide('fast');
|
70 |
jQuery('#nonmembers_only_options').show();
|
71 |
-
} else if (jQuery('#members_only').
|
72 |
jQuery('#nonmembers_only_container').hide('fast');
|
73 |
jQuery('#members_only_options').show();
|
74 |
}
|
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 |
<input type="checkbox" name="members_only" id="members_only" value="true" <?php echo $is_members_only; ?> />
|
7 |
+
<?php _e( 'Only accessible by members?', 'wpac' ); ?>
|
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' ) {
|
20 |
+
$checked_roles = get_option( 'wpac_pages_default_restricted_to', array() );
|
21 |
+
}
|
22 |
|
23 |
+
foreach ( $roles as $role => $label ) {
|
24 |
+
if ( in_array( $role, $checked_roles ) ) {
|
25 |
echo '<input type="checkbox" name="wpac_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '<br />';
|
26 |
} else {
|
27 |
echo '<input type="checkbox" name="wpac_restricted_to[]" value="' . $role . '" /> ' . $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 );
|
46 |
+
} else if ( $post->post_status == 'auto-draft' ) {
|
47 |
+
$wpac_show_in_search = get_option( 'wpac_show_pages_in_search', 0 );
|
48 |
+
$wpac_show_excerpt_in_search = get_option( 'wpac_show_page_excerpts_in_search', 0 );
|
49 |
+
}
|
50 |
+
?>
|
51 |
+
<input type="checkbox" name="wpac_show_in_search" value="yes" <?php checked( $wpac_show_in_search, 1 ); ?> /> <?php _e( 'Show in search results?', 'wpac' ); ?><br />
|
52 |
+
<input type="checkbox" name="wpac_show_excerpt_in_search" value="yes"<?php checked( $wpac_show_excerpt_in_search, 1 ); ?> /> <?php _e( 'Show excerpt in search?', 'wpac' ); ?><br />
|
53 |
</div>
|
54 |
</div>
|
55 |
|
56 |
<div id="nonmembers_only_container">
|
57 |
<input type="checkbox" name="nonmembers_only" id="nonmembers_only" value="true" <?php echo $is_nonmembers_only; ?> />
|
58 |
+
<?php _e( 'Only accessible by non-members?', 'wpac' ); ?>
|
59 |
|
60 |
<div id="nonmembers_only_options" class="hide-if-js">
|
61 |
+
<?php $redirect_to = get_post_meta( $post->ID, '_wpac_nonmembers_redirect_to', true ); ?>
|
|
|
|
|
62 |
|
63 |
+
<br /><strong><?php _e( 'Redirect To (Leave empty for home page):', 'wpac' ); ?> </strong><br />
|
64 |
<input type="text" name="wpac_nonmembers_redirect_to" value="<?php echo $redirect_to; ?>" />
|
65 |
</div>
|
66 |
</div>
|
69 |
//$j = jQuery.noConflict();
|
70 |
|
71 |
jQuery('#members_only').change(function() {
|
72 |
+
if (jQuery(this).is(":checked") == true) {
|
73 |
jQuery('#nonmembers_only_container').hide('fast');
|
74 |
jQuery('#members_only_options').show('fast');
|
75 |
} else {
|
79 |
});
|
80 |
|
81 |
jQuery('#nonmembers_only').change(function() {
|
82 |
+
if (jQuery(this).is(":checked") == true) {
|
83 |
jQuery('#members_only_container').hide('fast');
|
84 |
jQuery('#nonmembers_only_options').show('fast');
|
85 |
} else {
|
88 |
}
|
89 |
});
|
90 |
|
91 |
+
if (jQuery('#nonmembers_only').is(":checked") == true) {
|
92 |
jQuery('#members_only_container').hide('fast');
|
93 |
jQuery('#nonmembers_only_options').show();
|
94 |
+
} else if (jQuery('#members_only').is(":checked") == true) {
|
95 |
jQuery('#nonmembers_only_container').hide('fast');
|
96 |
jQuery('#members_only_options').show();
|
97 |
}
|
templates/options.php
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$wpac_members_blog_redirect = get_option( 'wpac_members_blog_redirect', '' );
|
3 |
+
$wpac_members_only_blog = get_option( 'wpac_members_only_blog', FALSE );
|
4 |
+
$wpac_show_in_menus = get_option( 'wpac_show_in_menus', 'with_access' );
|
5 |
+
$wpac_default_post_state = get_option( 'wpac_default_post_state', 'public' );
|
6 |
+
$wpac_default_page_state = get_option( 'wpac_default_page_state', 'public' );
|
7 |
+
$wpac_default_members_redirect = get_option( 'wpac_default_members_redirect' , '' );
|
8 |
+
$wpac_show_posts_in_search = get_option( 'wpac_show_posts_in_search', FALSE );
|
9 |
+
$wpac_show_post_excerpts_in_search = get_option( 'wpac_show_post_excerpts_in_search', FALSE );
|
10 |
+
$wpac_show_pages_in_search = get_option( 'wpac_show_pages_in_search', FALSE );
|
11 |
+
$wpac_show_page_excerpts_in_search = get_option( 'wpac_show_page_excerpts_in_search', FALSE );
|
12 |
+
?><div class="wrap">
|
13 |
+
<div class="icon32" id="icon-options-general"><br /></div>
|
14 |
+
<h2><?php _e( 'WordPress Access Control Settings', 'wpac' ); ?></h2>
|
15 |
+
|
16 |
+
<?php if ( isset( $admin_message ) && ! empty( $admin_message ) ) { ?>
|
17 |
+
<div class="updated below-h2" id="message"><p><?php echo $admin_message; ?></p></div>
|
18 |
+
<?php } ?>
|
19 |
+
|
20 |
+
<?php if ( isset( $admin_error ) && ! empty( $admin_error ) ) { ?>
|
21 |
+
<div class="error below-h2" id="error"><p><?php echo $admin_error; ?></p></div>
|
22 |
+
<?php } ?>
|
23 |
+
|
24 |
+
<form action="options-general.php?page=wpac-options" method="post">
|
25 |
+
<input type="hidden" value="wpac-options" name="options_page" />
|
26 |
+
<input type="hidden" value="update" name="action" />
|
27 |
+
<?php wp_nonce_field( 'wpac_options_save' ); ?>
|
28 |
+
|
29 |
+
<h3 class="title"><?php _e( 'Shortcodes', 'wpac' ); ?></h3>
|
30 |
+
|
31 |
+
<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>
|
32 |
+
|
33 |
+
<h3 class="title"><?php _e( 'General Options', 'wpac' ); ?></h3>
|
34 |
+
|
35 |
+
<table class="form-table">
|
36 |
+
<tbody>
|
37 |
+
<tr>
|
38 |
+
<th scope="row">
|
39 |
+
<label for="wpac_members_only_blog"><?php _e( 'Make Blog Members Only', 'wpac' ); ?></label>
|
40 |
+
</th>
|
41 |
+
|
42 |
+
<td>
|
43 |
+
<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>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
|
47 |
+
<tr>
|
48 |
+
<th scope="row">
|
49 |
+
<label for="wpac_members_blog_redirect"><?php _e( 'Members Blog Redirect', 'wpac' ); ?></label>
|
50 |
+
</th>
|
51 |
+
|
52 |
+
<td>
|
53 |
+
<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" />
|
54 |
+
<span class="description"><?php printf( __( 'Where to redirect non-members when they try to visit the blog. %1$s
|
55 |
+
Defaults to WordPress login page (%2$s)%1$s
|
56 |
+
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>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
|
60 |
+
<tr>
|
61 |
+
<th scope="row">
|
62 |
+
<label for="wpac_members_only_blog"><?php _e( 'Custom Post Types', 'wpac' ); ?></label>
|
63 |
+
</th>
|
64 |
+
|
65 |
+
<td>
|
66 |
+
<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>
|
67 |
+
<?php
|
68 |
+
global $wp_post_types;
|
69 |
+
$wpac_custom_post_types = get_option( 'wpac_custom_post_types', array() );
|
70 |
+
|
71 |
+
foreach ( $wp_post_types as $post_type => $details ) {
|
72 |
+
if ( in_array( $post_type, array( 'post', 'page', 'attachment', 'revision', 'nav_menu_item' ) ) ) {
|
73 |
+
continue;
|
74 |
+
}
|
75 |
+
|
76 |
+
if ( in_array( $post_type, $wpac_custom_post_types ) ) {
|
77 |
+
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 />';
|
78 |
+
} else {
|
79 |
+
echo '<label><input type="checkbox" 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 />';
|
80 |
+
}
|
81 |
+
}
|
82 |
+
?>
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
</tbody>
|
86 |
+
</table>
|
87 |
+
|
88 |
+
<h3 class="title"><?php _e( 'Menu Options', 'wpac' ); ?></h3>
|
89 |
+
|
90 |
+
<table class="form-table">
|
91 |
+
<tbody>
|
92 |
+
<tr>
|
93 |
+
<th scope="row">
|
94 |
+
<?php _e( 'Display In Menus', 'wpac' ); ?>
|
95 |
+
</th>
|
96 |
+
<td>
|
97 |
+
<p class="description"><?php _e( 'By default, should pages and posts be displayed in your menu even if the user doesn\'t have access to them? Items will always show up for users with access to them', 'wpac' ); ?></p>
|
98 |
+
<label><input <?php checked( $wpac_show_in_menus, 'with_access' ); ?> type="radio" value="with_access" name="wpac_show_in_menus" /> <span><?php _e( 'Only show menu items to users with access to them', 'wpac' ); ?></span></label><br />
|
99 |
+
<label><input <?php checked( $wpac_show_in_menus, 'always' ); ?> type="radio" value="always" name="wpac_show_in_menus" /> <span><?php _e( 'Always show all menu items even if the user cannot access them', 'wpac' ); ?></span></label>
|
100 |
+
</td>
|
101 |
+
</tr>
|
102 |
+
</tbody>
|
103 |
+
</table>
|
104 |
+
|
105 |
+
|
106 |
+
<h3 class="title"><?php _e( 'Post/Page Default Options', 'wpac' ); ?></h3>
|
107 |
+
|
108 |
+
<p>
|
109 |
+
<?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.' ); ?>
|
110 |
+
</p>
|
111 |
+
|
112 |
+
<table class="form-table">
|
113 |
+
<tbody>
|
114 |
+
<tr>
|
115 |
+
<th scope="row">
|
116 |
+
<?php _e( 'Default Post State', 'wpac' ); ?>
|
117 |
+
</th>
|
118 |
+
<td>
|
119 |
+
<label><input <?php checked( $wpac_default_post_state, 'public' ); ?> type="radio" value="public" name="default_post_state" /> <span><?php _e( 'Public', 'wpac' ); ?></span></label><br />
|
120 |
+
<label><input <?php checked( $wpac_default_post_state, 'members' ); ?> type="radio" value="members" name="default_post_state" /> <span><?php _e( 'Members Only', 'wpac' ); ?></span></label><br />
|
121 |
+
<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 />
|
122 |
+
</td>
|
123 |
+
</tr>
|
124 |
+
|
125 |
+
<tr>
|
126 |
+
<th scope="row">
|
127 |
+
<?php _e( 'Posts: Only Accessible By', 'wpac' ); ?>
|
128 |
+
</th>
|
129 |
+
<td>
|
130 |
+
<?php
|
131 |
+
global $wp_roles;
|
132 |
+
$roles = $wp_roles->get_names();
|
133 |
+
$checked_roles = (array) get_option( 'wpac_posts_default_restricted_to', array() );
|
134 |
+
|
135 |
+
foreach ( $roles as $role => $label ) {
|
136 |
+
if ( in_array( $role, $checked_roles ) ) {
|
137 |
+
echo '<input type="checkbox" name="wpac_posts_default_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '<br />';
|
138 |
+
} else {
|
139 |
+
echo '<input type="checkbox" name="wpac_posts_default_restricted_to[]" value="' . $role . '" /> ' . $label . '<br />';
|
140 |
+
}
|
141 |
+
}
|
142 |
+
?>
|
143 |
+
<span class="description"><?php _e( 'Defaults to all roles', 'wpac' ); ?></span>
|
144 |
+
</td>
|
145 |
+
</tr>
|
146 |
+
|
147 |
+
<tr>
|
148 |
+
<th scope="row">
|
149 |
+
<?php _e( 'Default Page State', 'wpac' ); ?>
|
150 |
+
</th>
|
151 |
+
<td>
|
152 |
+
<label><input <?php checked( $wpac_default_page_state, 'public' ); ?> type="radio" value="public" name="default_page_state" /> <span><?php _e( 'Public', 'wpac' ); ?></span></label><br />
|
153 |
+
<label><input <?php checked( $wpac_default_page_state, 'members' ); ?> type="radio" value="members" name="default_page_state" /> <span><?php _e( 'Members Only', 'wpac' ); ?></span></label><br />
|
154 |
+
<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 />
|
155 |
+
</td>
|
156 |
+
</tr>
|
157 |
+
|
158 |
+
<tr>
|
159 |
+
<th scope="row">
|
160 |
+
<?php _e( 'Pages: 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_pages_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_pages_default_restricted_to[]" checked="checked" value="' . $role . '" /> ' . $label . '<br />';
|
171 |
+
} else {
|
172 |
+
echo '<input type="checkbox" name="wpac_pages_default_restricted_to[]" value="' . $role . '" /> ' . $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 |
+
<label for="wpac_default_members_redirect"><?php _e( 'Default Redirect For Members Only Pages', 'wpac' ); ?></label>
|
183 |
+
</th>
|
184 |
+
<td>
|
185 |
+
<input type="text" class="regular-text" value="<?php esc_attr_e( $wpac_default_members_redirect ); ?>" id="wpac_default_members_redirect" name="wpac_default_members_redirect" />
|
186 |
+
<span class="description">
|
187 |
+
<?php /* translators: Text in the brackets (%1$s) is a link to the default login page */ printf( __( 'Defaults to WordPress login page (%1$s)%2$sAfter a user logs in they will be redirected back to the page they attempted to view', 'wpac' ), '<a href="' . wp_login_url() . '">' . wp_login_url() . '</a>', '<br />' ); ?>
|
188 |
+
</span>
|
189 |
+
</td>
|
190 |
+
</tr>
|
191 |
+
</tbody>
|
192 |
+
</table>
|
193 |
+
|
194 |
+
<h3 class="title"><?php _e( 'Search/Archive Options', 'wpac' ); ?></h3>
|
195 |
+
|
196 |
+
<p>
|
197 |
+
<?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).
|
198 |
+
<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
|
199 |
+
post state to Members Only, then set the Search Options to show restricted posts in search results and show post excerpts.', 'wpac' ); ?>
|
200 |
+
</p>
|
201 |
+
|
202 |
+
<table class="form-table">
|
203 |
+
<tbody>
|
204 |
+
<tr>
|
205 |
+
<th scope="row">
|
206 |
+
<?php _e( 'Search Options', 'wpac' ); ?>
|
207 |
+
</th>
|
208 |
+
<td>
|
209 |
+
<label><input type="checkbox" <?php checked( $wpac_show_posts_in_search, 1 ); ?> value="yes" name="show_posts_in_search" /> <span><?php _e( 'Show restricted posts in search results?', 'wpac' ); ?></span></label><br />
|
210 |
+
<label><input type="checkbox" <?php checked( $wpac_show_post_excerpts_in_search, 1 ); ?> value="yes" name="show_post_excerpts_in_search" /> <span><?php _e( 'Show restricted post excerpts in search results?', 'wpac' ); ?></span></label><br />
|
211 |
+
<label><input type="checkbox" <?php checked( $wpac_show_pages_in_search, 1 ); ?> value="yes" name="show_pages_in_search" /> <span><?php _e( 'Show restricted pages in search results?', 'wpac' ); ?></span></label><br />
|
212 |
+
<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 />
|
213 |
+
</td>
|
214 |
+
</tr>
|
215 |
+
|
216 |
+
<tr>
|
217 |
+
<th scope="row">
|
218 |
+
<label for="post_excerpt_text"><?php _e( 'Search Excerpt (Posts)', 'wpac' ); ?></label>
|
219 |
+
</th>
|
220 |
+
<td>
|
221 |
+
<fieldset>
|
222 |
+
<legend class="screen-reader-text"><?php _e( 'Search Excerpt (Posts)', 'wpac' ); ?></legend>
|
223 |
+
|
224 |
+
<p>
|
225 |
+
<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>
|
226 |
+
</p>
|
227 |
+
|
228 |
+
<p>
|
229 |
+
<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>
|
230 |
+
</p>
|
231 |
+
</fieldset>
|
232 |
+
</td>
|
233 |
+
</tr>
|
234 |
+
|
235 |
+
<tr>
|
236 |
+
<th scope="row">
|
237 |
+
<label for="page_excerpt_text"><?php _e( 'Search Excerpt (Pages)', 'wpac' ); ?></label>
|
238 |
+
</th>
|
239 |
+
<td>
|
240 |
+
<fieldset>
|
241 |
+
<legend class="screen-reader-text"><?php _e( 'Search Excerpt (Pages)', 'wpac' ); ?>)</legend>
|
242 |
+
|
243 |
+
<p>
|
244 |
+
<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>
|
245 |
+
</p>
|
246 |
+
|
247 |
+
<p>
|
248 |
+
<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>
|
249 |
+
</p>
|
250 |
+
</fieldset>
|
251 |
+
</td>
|
252 |
+
</tr>
|
253 |
+
</tbody>
|
254 |
+
</table>
|
255 |
+
|
256 |
+
<p class="submit"><input type="submit" value="<?php _e( 'Save Changes', 'wpac' ); ?>" class="button-primary" id="submit" name="submit" /></p>
|
257 |
+
</form>
|
258 |
+
</div>
|
wordpress-access-control.php
CHANGED
@@ -1,22 +1,33 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Plugin Name: WordPress Access Control
|
4 |
* Plugin URI: http://brandonwamboldt.ca/plugins/members-only-menu-plugin/
|
5 |
* Author: Brandon Wamboldt
|
6 |
* Author URI: http://brandonwamboldt.ca/
|
7 |
-
* Version: 2
|
8 |
-
* Description:
|
9 |
*/
|
10 |
|
11 |
add_action( 'wp', array( 'WordPressAccessControl', 'check_for_members_only' ) );
|
12 |
add_action( 'wp', array( 'WordPressAccessControl', 'check_for_nonmembers_only' ) );
|
13 |
add_action( 'admin_init', array( 'WordPressAccessControl', 'admin_init' ) );
|
|
|
14 |
add_action( 'add_meta_boxes', array( 'WordPressAccessControl', 'add_wp_access_meta_boxes' ) );
|
15 |
add_action( 'save_post', array( 'WordPressAccessControl', 'save_postdata' ) );
|
16 |
add_action( 'manage_pages_custom_column', array( 'WordPressAccessControl', 'show_column' ) );
|
17 |
|
18 |
add_filter( 'get_pages', array( 'WordPressAccessControl', 'get_pages' ) );
|
19 |
add_filter( 'manage_edit-page_columns', array( 'WordPressAccessControl', 'add_column' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
// We check to see if the class exists because it isn't part of pre WordPress 3 systems
|
22 |
if ( class_exists( 'Walker_Nav_Menu' ) ) {
|
@@ -55,7 +66,7 @@ if ( class_exists( 'Walker_Nav_Menu' ) ) {
|
|
55 |
{
|
56 |
global $wp_query;
|
57 |
|
58 |
-
if ( WordPressAccessControl::check_conditions( $item->object_id ) ) {
|
59 |
if ( ! $this->in_private ) {
|
60 |
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
61 |
|
@@ -89,7 +100,7 @@ if ( class_exists( 'Walker_Nav_Menu' ) ) {
|
|
89 |
|
90 |
function end_el( & $output, $item, $depth )
|
91 |
{
|
92 |
-
if ( WordPressAccessControl::check_conditions( $item->object_id ) ) {
|
93 |
if ( ! $this->in_private ) {
|
94 |
$output .= "</li>\n";
|
95 |
}
|
@@ -214,6 +225,128 @@ class WordPressAccessControl
|
|
214 |
function admin_init()
|
215 |
{
|
216 |
wp_enqueue_style( 'wpac-style', plugin_dir_url( __FILE__ ) . 'public/css/wpac.css' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
|
219 |
function add_column( $columns )
|
@@ -245,7 +378,7 @@ class WordPressAccessControl
|
|
245 |
if ( is_user_logged_in() ) {
|
246 |
get_currentuserinfo();
|
247 |
|
248 |
-
$allowed_roles = maybe_unserialize( get_post_meta( $page_id, '_wpac_restricted_to',
|
249 |
|
250 |
if ( empty( $allowed_roles ) ) {
|
251 |
$allowed_roles_tmp = $wp_roles->get_names();
|
@@ -259,40 +392,58 @@ class WordPressAccessControl
|
|
259 |
$intersections = array_intersect( $current_user->roles, $allowed_roles );
|
260 |
|
261 |
if ( empty( $intersections ) ) {
|
262 |
-
$role =
|
263 |
} else {
|
264 |
-
$role =
|
265 |
}
|
266 |
} else {
|
267 |
-
$role =
|
268 |
}
|
269 |
|
270 |
-
$is_members_only = get_post_meta( $page_id, '_wpac_is_members_only',
|
271 |
-
$is_nonmembers_only = get_post_meta( $page_id, '_wpac_is_nonmembers_only',
|
272 |
|
273 |
if ( ( is_user_logged_in() && $is_members_only && $role ) || ( ! is_user_logged_in() && $is_nonmembers_only ) || ( ! $is_members_only && ! $is_nonmembers_only ) ) {
|
274 |
-
return
|
275 |
} else {
|
276 |
-
return
|
277 |
}
|
278 |
}
|
279 |
|
280 |
function check_for_members_only()
|
281 |
{
|
|
|
|
|
282 |
if ( is_admin() ) return;
|
283 |
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
if ( get_post_meta( $post->ID, '_wpac_is_members_only', true ) && ! WordPressAccessControl::check_conditions( $post->ID ) ) {
|
287 |
-
|
|
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
|
|
|
|
|
|
293 |
}
|
294 |
-
|
295 |
-
exit();
|
296 |
}
|
297 |
}
|
298 |
|
@@ -314,10 +465,79 @@ class WordPressAccessControl
|
|
314 |
exit();
|
315 |
}
|
316 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
function add_wp_access_meta_boxes()
|
319 |
{
|
320 |
-
$
|
|
|
321 |
|
322 |
foreach ( $supported_pages as $page_type ) {
|
323 |
add_meta_box( 'wpac_controls_meta', 'WordPress Access Control', array( 'WordPressAccessControl', 'add_wpac_meta_box' ), $page_type, 'side', 'high' );
|
@@ -327,17 +547,26 @@ class WordPressAccessControl
|
|
327 |
function add_wpac_meta_box()
|
328 |
{
|
329 |
global $post;
|
330 |
-
|
331 |
$is_members_only = get_post_meta( $post->ID, '_wpac_is_members_only', true );
|
332 |
$is_nonmembers_only = get_post_meta( $post->ID, '_wpac_is_nonmembers_only', true );
|
333 |
-
|
334 |
-
if ( $
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
$is_members_only = 'checked="checked"';
|
336 |
}
|
337 |
|
338 |
-
if ( $is_nonmembers_only == 'true' ) {
|
339 |
$is_nonmembers_only = 'checked="checked"';
|
340 |
}
|
|
|
|
|
|
|
341 |
|
342 |
include( dirname( __FILE__ ) . '/templates/meta_box.php' );
|
343 |
}
|
@@ -378,13 +607,25 @@ class WordPressAccessControl
|
|
378 |
update_post_meta( $post_id, '_wpac_members_redirect_to', $_POST['wpac_members_redirect_to'] );
|
379 |
}
|
380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
if ( isset( $_POST['wpac_nonmembers_redirect_to'] ) ) {
|
382 |
update_post_meta( $post_id, '_wpac_nonmembers_redirect_to', $_POST['wpac_nonmembers_redirect_to'] );
|
383 |
}
|
384 |
|
385 |
return $post_id;
|
386 |
}
|
387 |
-
|
388 |
function wp_nav_menu_args( $args )
|
389 |
{
|
390 |
$args['walker'] = new WPAC_Nav_Menu_Walker();
|
@@ -427,4 +668,36 @@ class WordPressAccessControl
|
|
427 |
|
428 |
return $pages;
|
429 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Plugin Name: WordPress Access Control
|
4 |
* Plugin URI: http://brandonwamboldt.ca/plugins/members-only-menu-plugin/
|
5 |
* Author: Brandon Wamboldt
|
6 |
* Author URI: http://brandonwamboldt.ca/
|
7 |
+
* Version: 3.0.2
|
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 |
|
11 |
add_action( 'wp', array( 'WordPressAccessControl', 'check_for_members_only' ) );
|
12 |
add_action( 'wp', array( 'WordPressAccessControl', 'check_for_nonmembers_only' ) );
|
13 |
add_action( 'admin_init', array( 'WordPressAccessControl', 'admin_init' ) );
|
14 |
+
add_action( 'admin_menu', array( 'WordPressAccessControl', 'admin_menu' ) );
|
15 |
add_action( 'add_meta_boxes', array( 'WordPressAccessControl', 'add_wp_access_meta_boxes' ) );
|
16 |
add_action( 'save_post', array( 'WordPressAccessControl', 'save_postdata' ) );
|
17 |
add_action( 'manage_pages_custom_column', array( 'WordPressAccessControl', 'show_column' ) );
|
18 |
|
19 |
add_filter( 'get_pages', array( 'WordPressAccessControl', 'get_pages' ) );
|
20 |
add_filter( 'manage_edit-page_columns', array( 'WordPressAccessControl', 'add_column' ) );
|
21 |
+
add_filter( 'the_excerpt', array( 'WordPressAccessControl', 'remove_excerpt' ) );
|
22 |
+
add_filter( 'the_posts', array( 'WordPressAccessControl', 'remove_restricted_posts' ), 100, 2 );
|
23 |
+
add_filter( 'plugin_row_meta', array( 'WordPressAccessControl', 'plugin_row_meta' ), 10, 5 );
|
24 |
+
|
25 |
+
add_shortcode( 'member', array( 'WordPressAccessControl', 'shortcode_members' ) );
|
26 |
+
add_shortcode( 'members', array( 'WordPressAccessControl', 'shortcode_members' ) );
|
27 |
+
add_shortcode( 'non-members', array( 'WordPressAccessControl', 'shortcode_nonmembers' ) );
|
28 |
+
add_shortcode( 'nonmembers', array( 'WordPressAccessControl', 'shortcode_nonmembers' ) );
|
29 |
+
add_shortcode( 'non-member', array( 'WordPressAccessControl', 'shortcode_nonmembers' ) );
|
30 |
+
add_shortcode( 'nonmember', array( 'WordPressAccessControl', 'shortcode_nonmembers' ) );
|
31 |
|
32 |
// We check to see if the class exists because it isn't part of pre WordPress 3 systems
|
33 |
if ( class_exists( 'Walker_Nav_Menu' ) ) {
|
66 |
{
|
67 |
global $wp_query;
|
68 |
|
69 |
+
if ( WordPressAccessControl::check_conditions( $item->object_id ) || get_option( 'wpac_show_in_menus', 'with_access' ) == 'always' ) {
|
70 |
if ( ! $this->in_private ) {
|
71 |
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
72 |
|
100 |
|
101 |
function end_el( & $output, $item, $depth )
|
102 |
{
|
103 |
+
if ( WordPressAccessControl::check_conditions( $item->object_id ) || get_option( 'wpac_show_in_menus', 'with_access' ) == 'always' ) {
|
104 |
if ( ! $this->in_private ) {
|
105 |
$output .= "</li>\n";
|
106 |
}
|
225 |
function admin_init()
|
226 |
{
|
227 |
wp_enqueue_style( 'wpac-style', plugin_dir_url( __FILE__ ) . 'public/css/wpac.css' );
|
228 |
+
|
229 |
+
// Load translation files
|
230 |
+
if ( ! load_plugin_textdomain( 'wpac', '/wp-content/languages/' ) ) {
|
231 |
+
load_plugin_textdomain( 'wpac', '/wp-content/plugins/wordpress-access-control/languages/', 'wordpress-access-control/languages/' );
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
function admin_menu()
|
236 |
+
{
|
237 |
+
add_options_page( 'WordPress Access Control Settings', 'Members Only', 'manage_options', 'wpac-options', array( 'WordPressAccessControl', 'options_page' ) );
|
238 |
+
}
|
239 |
+
|
240 |
+
function options_page()
|
241 |
+
{
|
242 |
+
// Save options?
|
243 |
+
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'update' ) {
|
244 |
+
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'wpac_options_save' ) ) {
|
245 |
+
$admin_error = __( 'Security check failed, please try again', 'wpac' );
|
246 |
+
} else {
|
247 |
+
|
248 |
+
// Make the blog members only
|
249 |
+
if ( isset( $_REQUEST['wpac_members_only_blog'] ) && $_REQUEST['wpac_members_only_blog'] == 'yes' ) {
|
250 |
+
update_option( 'wpac_members_only_blog', TRUE );
|
251 |
+
} else {
|
252 |
+
update_option( 'wpac_members_only_blog', FALSE );
|
253 |
+
}
|
254 |
+
|
255 |
+
// Members blog redirect link
|
256 |
+
if ( isset( $_REQUEST['wpac_members_blog_redirect'] ) ) {
|
257 |
+
update_option( 'wpac_members_blog_redirect', esc_url( $_REQUEST['wpac_members_blog_redirect'] ) );
|
258 |
+
} else {
|
259 |
+
delete_option( 'wpac_members_blog_redirect' );
|
260 |
+
}
|
261 |
+
|
262 |
+
// Support custom post types
|
263 |
+
if ( isset( $_REQUEST['wpac_custom_post_types'] ) && is_array( $_REQUEST['wpac_custom_post_types'] ) ) {
|
264 |
+
update_option( 'wpac_custom_post_types', $_REQUEST['wpac_custom_post_types'] );
|
265 |
+
} else {
|
266 |
+
delete_option( 'wpac_custom_post_types' );
|
267 |
+
}
|
268 |
+
|
269 |
+
// Show in the menu settings
|
270 |
+
if ( isset( $_REQUEST['wpac_show_in_menus'] ) && $_REQUEST['wpac_show_in_menus'] == 'always' ) {
|
271 |
+
update_option( 'wpac_show_in_menus', 'always' );
|
272 |
+
} else {
|
273 |
+
update_option( 'wpac_show_in_menus', 'with_access' );
|
274 |
+
}
|
275 |
+
|
276 |
+
// Default post state setting
|
277 |
+
if ( isset( $_REQUEST['default_post_state'] ) && in_array( $_REQUEST['default_post_state'], array( 'public', 'members', 'nonmembers' ) ) ) {
|
278 |
+
update_option( 'wpac_default_post_state', $_REQUEST['default_post_state'] );
|
279 |
+
} else {
|
280 |
+
update_option( 'wpac_default_post_state', 'public' );
|
281 |
+
}
|
282 |
+
|
283 |
+
// Default post roles
|
284 |
+
if ( isset( $_REQUEST['wpac_posts_default_restricted_to'] ) && is_array( $_REQUEST['wpac_posts_default_restricted_to'] ) ) {
|
285 |
+
update_option( 'wpac_posts_default_restricted_to', $_REQUEST['wpac_posts_default_restricted_to'] );
|
286 |
+
} else {
|
287 |
+
update_option( 'wpac_posts_default_restricted_to', array() );
|
288 |
+
}
|
289 |
+
|
290 |
+
// Default page state setting
|
291 |
+
if ( isset( $_REQUEST['default_page_state'] ) && in_array( $_REQUEST['default_page_state'], array( 'public', 'members', 'nonmembers' ) ) ) {
|
292 |
+
update_option( 'wpac_default_page_state', $_REQUEST['default_page_state'] );
|
293 |
+
} else {
|
294 |
+
update_option( 'wpac_default_page_state', 'public' );
|
295 |
+
}
|
296 |
+
|
297 |
+
// Default page roles
|
298 |
+
if ( isset( $_REQUEST['wpac_pages_default_restricted_to'] ) && is_array( $_REQUEST['wpac_pages_default_restricted_to'] ) ) {
|
299 |
+
update_option( 'wpac_pages_default_restricted_to', $_REQUEST['wpac_pages_default_restricted_to'] );
|
300 |
+
} else {
|
301 |
+
update_option( 'wpac_pages_default_restricted_to', array() );
|
302 |
+
}
|
303 |
+
|
304 |
+
// Default redirect
|
305 |
+
if ( isset( $_REQUEST['wpac_default_members_redirect'] ) && ! empty( $_REQUEST['wpac_default_members_redirect'] ) ) {
|
306 |
+
update_option( 'wpac_default_members_redirect', $_REQUEST['wpac_default_members_redirect'] );
|
307 |
+
} else {
|
308 |
+
update_option( 'wpac_default_members_redirect', '' );
|
309 |
+
}
|
310 |
+
|
311 |
+
// Search Options
|
312 |
+
if ( isset( $_REQUEST['show_posts_in_search'] ) && $_REQUEST['show_posts_in_search'] == 'yes' ) {
|
313 |
+
update_option( 'wpac_show_posts_in_search', TRUE );
|
314 |
+
} else {
|
315 |
+
update_option( 'wpac_show_posts_in_search', FALSE );
|
316 |
+
}
|
317 |
+
|
318 |
+
if ( isset( $_REQUEST['show_post_excerpts_in_search'] ) && $_REQUEST['show_post_excerpts_in_search'] == 'yes' ) {
|
319 |
+
update_option( 'wpac_show_post_excerpts_in_search', TRUE );
|
320 |
+
} else {
|
321 |
+
update_option( 'wpac_show_post_excerpts_in_search', FALSE );
|
322 |
+
}
|
323 |
+
|
324 |
+
if ( isset( $_REQUEST['show_pages_in_search'] ) && $_REQUEST['show_pages_in_search'] == 'yes' ) {
|
325 |
+
update_option( 'wpac_show_pages_in_search', TRUE );
|
326 |
+
} else {
|
327 |
+
update_option( 'wpac_show_pages_in_search', FALSE );
|
328 |
+
}
|
329 |
+
|
330 |
+
if ( isset( $_REQUEST['show_page_excerpts_in_search'] ) && $_REQUEST['show_page_excerpts_in_search'] == 'yes' ) {
|
331 |
+
update_option( 'wpac_show_page_excerpts_in_search', TRUE );
|
332 |
+
} else {
|
333 |
+
update_option( 'wpac_show_page_excerpts_in_search', FALSE );
|
334 |
+
}
|
335 |
+
|
336 |
+
// Custom excerpts
|
337 |
+
if ( isset( $_REQUEST['page_excerpt_text'] ) ) {
|
338 |
+
update_option( 'wpac_page_excerpt_text', $_REQUEST['page_excerpt_text'] );
|
339 |
+
}
|
340 |
+
|
341 |
+
if ( isset( $_REQUEST['post_excerpt_text'] ) ) {
|
342 |
+
update_option( 'wpac_post_excerpt_text', $_REQUEST['post_excerpt_text'] );
|
343 |
+
}
|
344 |
+
|
345 |
+
$admin_message = '<strong>' . __( 'Settings Saved.') . '</strong>';
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
include( dirname( __FILE__ ) . '/templates/options.php' );
|
350 |
}
|
351 |
|
352 |
function add_column( $columns )
|
378 |
if ( is_user_logged_in() ) {
|
379 |
get_currentuserinfo();
|
380 |
|
381 |
+
$allowed_roles = maybe_unserialize( get_post_meta( $page_id, '_wpac_restricted_to', TRUE ) );
|
382 |
|
383 |
if ( empty( $allowed_roles ) ) {
|
384 |
$allowed_roles_tmp = $wp_roles->get_names();
|
392 |
$intersections = array_intersect( $current_user->roles, $allowed_roles );
|
393 |
|
394 |
if ( empty( $intersections ) ) {
|
395 |
+
$role = FALSE;
|
396 |
} else {
|
397 |
+
$role = TRUE;
|
398 |
}
|
399 |
} else {
|
400 |
+
$role = TRUE;
|
401 |
}
|
402 |
|
403 |
+
$is_members_only = get_post_meta( $page_id, '_wpac_is_members_only', TRUE );
|
404 |
+
$is_nonmembers_only = get_post_meta( $page_id, '_wpac_is_nonmembers_only', TRUE );
|
405 |
|
406 |
if ( ( is_user_logged_in() && $is_members_only && $role ) || ( ! is_user_logged_in() && $is_nonmembers_only ) || ( ! $is_members_only && ! $is_nonmembers_only ) ) {
|
407 |
+
return TRUE;
|
408 |
} else {
|
409 |
+
return FALSE;
|
410 |
}
|
411 |
}
|
412 |
|
413 |
function check_for_members_only()
|
414 |
{
|
415 |
+
global $post;
|
416 |
+
|
417 |
if ( is_admin() ) return;
|
418 |
|
419 |
+
// Check for a members only blog
|
420 |
+
$blog_is_members_only = get_option( 'wpac_members_only_blog', FALSE );
|
421 |
+
|
422 |
+
if ( $blog_is_members_only && ! is_user_logged_in() ) {
|
423 |
+
if ( is_home() || is_archive() || is_search() || is_feed() ) {
|
424 |
+
$redirect_to = get_option( 'wpac_members_blog_redirect', wp_login_url( $_SERVER['REQUEST_URI'] ) );
|
425 |
|
426 |
+
if ( empty( $redirect_to ) ) {
|
427 |
+
$redirect_to = wp_login_url( $_SERVER['REQUEST_URI'] );
|
428 |
+
}
|
429 |
+
|
430 |
+
header( 'Location: ' . add_query_arg( 'redirect_to', $_SERVER['REQUEST_URI'], $redirect_to ) );
|
431 |
+
exit();
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
if ( get_post_meta( $post->ID, '_wpac_is_members_only', true ) && ! WordPressAccessControl::check_conditions( $post->ID ) ) {
|
436 |
+
if ( is_singular() ) {
|
437 |
+
$redirect_to = get_post_meta( $post->ID, '_wpac_members_redirect_to', true );
|
438 |
|
439 |
+
if ( empty( $redirect_to ) ) {
|
440 |
+
header( 'Location: ' . get_bloginfo( 'wpurl' ) . '/wp-login.php?redirect_to=' . $_SERVER['REQUEST_URI'] );
|
441 |
+
} else {
|
442 |
+
header( 'Location: ' . add_query_arg( 'redirect_to', $_SERVER['REQUEST_URI'], $redirect_to ) );
|
443 |
+
}
|
444 |
+
|
445 |
+
exit();
|
446 |
}
|
|
|
|
|
447 |
}
|
448 |
}
|
449 |
|
465 |
exit();
|
466 |
}
|
467 |
}
|
468 |
+
|
469 |
+
function remove_excerpt( $excerpt )
|
470 |
+
{
|
471 |
+
if ( is_admin() ) return $excerpt;
|
472 |
+
|
473 |
+
global $post;
|
474 |
+
|
475 |
+
if ( get_post_meta( $post->ID, '_wpac_is_members_only', true ) && ! WordPressAccessControl::check_conditions( $post->ID ) ) {
|
476 |
+
$show_excerpt = get_post_meta( $post->ID, '_wpac_show_excerpt_in_search', true );
|
477 |
+
|
478 |
+
if ( ! is_singular() && $show_excerpt != 'yes' ) {
|
479 |
+
if ( $post->post_type == 'post' ) {
|
480 |
+
$excerpt = get_option( 'wpac_post_excerpt_text', __( 'To view the contents of this post, you must be authenticated and have the required access level.', 'wpac' ) );
|
481 |
+
} else {
|
482 |
+
$excerpt = get_option( 'wpac_page_excerpt_text', __( 'To view the contents of this page, you must be authenticated and have the required access level.', 'wpac' ) );
|
483 |
+
}
|
484 |
+
|
485 |
+
return wpautop( $excerpt );
|
486 |
+
} else {
|
487 |
+
return $excerpt;
|
488 |
+
}
|
489 |
+
}
|
490 |
+
|
491 |
+
return $excerpt;
|
492 |
+
}
|
493 |
+
|
494 |
+
function remove_restricted_posts( $posts, $query = FALSE )
|
495 |
+
{
|
496 |
+
if ( ! is_singular() && ! is_admin() ) {
|
497 |
+
$new_posts = array();
|
498 |
+
|
499 |
+
foreach ( $posts as $post ) {
|
500 |
+
// The page is members only and we do NOT have access to it
|
501 |
+
if ( get_post_meta( $post->ID, '_wpac_is_members_only', true ) && ! WordPressAccessControl::check_conditions( $post->ID ) ) {
|
502 |
+
if ( get_post_meta( $post->ID, '_wpac_show_in_search', true ) != 1 ) {
|
503 |
+
continue;
|
504 |
+
}
|
505 |
+
}
|
506 |
+
|
507 |
+
// The page is non-members only and we do NOT have access to it
|
508 |
+
if ( get_post_meta( $post->ID, '_wpac_is_nonmembers_only', true ) && ! WordPressAccessControl::check_conditions( $post->ID ) ) {
|
509 |
+
if ( get_post_meta( $post->ID, '_wpac_show_in_search', true ) != 1 ) {
|
510 |
+
continue;
|
511 |
+
}
|
512 |
+
}
|
513 |
+
|
514 |
+
// Remove results where the search term is in a [member] or [nonmember] tag and we don't have access
|
515 |
+
$st = get_search_query();
|
516 |
+
$content = do_shortcode( $post->post_content );
|
517 |
+
|
518 |
+
|
519 |
+
if ( ! empty( $st ) && is_search() && ! stristr( $content, $st ) ) {
|
520 |
+
continue;
|
521 |
+
}
|
522 |
+
|
523 |
+
$new_posts[] = $post;
|
524 |
+
}
|
525 |
+
|
526 |
+
$query->found_posts = count( $new_posts );
|
527 |
+
$query->max_num_pages = ceil( count( $new_posts ) / $query->query_vars['posts_per_page'] );
|
528 |
+
$query->posts = $new_posts;
|
529 |
+
$query->post_count = count( $new_posts );
|
530 |
+
|
531 |
+
return $new_posts;
|
532 |
+
}
|
533 |
+
|
534 |
+
return $posts;
|
535 |
+
}
|
536 |
|
537 |
function add_wp_access_meta_boxes()
|
538 |
{
|
539 |
+
$enabled_post_types = get_option( 'wpac_custom_post_types', array() );
|
540 |
+
$supported_pages = apply_filters( 'wp_access_supported_pages', array_merge( array( 'page', 'post' ), $enabled_post_types ) );
|
541 |
|
542 |
foreach ( $supported_pages as $page_type ) {
|
543 |
add_meta_box( 'wpac_controls_meta', 'WordPress Access Control', array( 'WordPressAccessControl', 'add_wpac_meta_box' ), $page_type, 'side', 'high' );
|
547 |
function add_wpac_meta_box()
|
548 |
{
|
549 |
global $post;
|
550 |
+
|
551 |
$is_members_only = get_post_meta( $post->ID, '_wpac_is_members_only', true );
|
552 |
$is_nonmembers_only = get_post_meta( $post->ID, '_wpac_is_nonmembers_only', true );
|
553 |
+
|
554 |
+
if ( $post->post_type == 'post' ) {
|
555 |
+
$wpac_default_post_state = get_option( 'wpac_default_post_state', 'public' );
|
556 |
+
} else {
|
557 |
+
$wpac_default_post_state = get_option( 'wpac_default_page_state', 'public' );
|
558 |
+
}
|
559 |
+
|
560 |
+
if ( $is_members_only == 'true' || ( $post->post_status == 'auto-draft' && $wpac_default_post_state == 'members' ) ) {
|
561 |
$is_members_only = 'checked="checked"';
|
562 |
}
|
563 |
|
564 |
+
if ( $is_nonmembers_only == 'true' || ( $post->post_status == 'auto-draft' && $wpac_default_post_state == 'nonmembers' ) ) {
|
565 |
$is_nonmembers_only = 'checked="checked"';
|
566 |
}
|
567 |
+
|
568 |
+
$wpac_show_in_search = get_post_meta( $post->ID, '_wpac_show_in_search', true );
|
569 |
+
$wpac_show_excerpt_in_search = get_post_meta( $post->ID, '_wpac_show_excerpt_in_search', true );
|
570 |
|
571 |
include( dirname( __FILE__ ) . '/templates/meta_box.php' );
|
572 |
}
|
607 |
update_post_meta( $post_id, '_wpac_members_redirect_to', $_POST['wpac_members_redirect_to'] );
|
608 |
}
|
609 |
|
610 |
+
if ( isset( $_POST['wpac_show_in_search'] ) ) {
|
611 |
+
update_post_meta( $post_id, '_wpac_show_in_search', 1 );
|
612 |
+
} else {
|
613 |
+
update_post_meta( $post_id, '_wpac_show_in_search', 0 );
|
614 |
+
}
|
615 |
+
|
616 |
+
if ( isset( $_POST['wpac_show_excerpt_in_search'] ) ) {
|
617 |
+
update_post_meta( $post_id, '_wpac_show_excerpt_in_search', 1 );
|
618 |
+
} else {
|
619 |
+
update_post_meta( $post_id, '_wpac_show_excerpt_in_search', 0 );
|
620 |
+
}
|
621 |
+
|
622 |
if ( isset( $_POST['wpac_nonmembers_redirect_to'] ) ) {
|
623 |
update_post_meta( $post_id, '_wpac_nonmembers_redirect_to', $_POST['wpac_nonmembers_redirect_to'] );
|
624 |
}
|
625 |
|
626 |
return $post_id;
|
627 |
}
|
628 |
+
|
629 |
function wp_nav_menu_args( $args )
|
630 |
{
|
631 |
$args['walker'] = new WPAC_Nav_Menu_Walker();
|
668 |
|
669 |
return $pages;
|
670 |
}
|
671 |
+
|
672 |
+
function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status )
|
673 |
+
{
|
674 |
+
if ( $plugin_file == str_replace( '.php', '/', basename( __FILE__ ) ) . basename( __FILE__ ) ) {
|
675 |
+
$plugin_meta[] = '<a href="options-general.php?page=wpac-options">' . __( 'Visit options page', 'wpac' ) . '</a>';
|
676 |
+
$plugin_meta[] = '<a href="' . plugin_dir_url( __FILE__ ) . 'documentation/index.html">' . __( 'Plugin Documentation', 'wpac' ) . '</a>';
|
677 |
+
}
|
678 |
+
|
679 |
+
return $plugin_meta;
|
680 |
+
}
|
681 |
+
|
682 |
+
function shortcode_members( $attributes, $content = NULL )
|
683 |
+
{
|
684 |
+
global $post;
|
685 |
+
|
686 |
+
if ( is_user_logged_in() ) {
|
687 |
+
return wpautop( do_shortcode( $content ) );
|
688 |
+
}
|
689 |
+
|
690 |
+
return '';
|
691 |
+
}
|
692 |
+
|
693 |
+
function shortcode_nonmembers( $attributes, $content = NULL )
|
694 |
+
{
|
695 |
+
global $post;
|
696 |
+
|
697 |
+
if ( ! is_user_logged_in() ) {
|
698 |
+
return wpautop( do_shortcode( $content ) );
|
699 |
+
}
|
700 |
+
|
701 |
+
return '';
|
702 |
+
}
|
703 |
}
|