PluginProbe
Private groups / 1.6
Private groups v1.6
trunk 1.5 1.6 1.7 1.8 1.8.1 1.9.1 1.9.2 2.0 2.0.1 2.2 2.3 2.4 2.5 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 116 releases
bbp-private-groups / includes / settings.php

settings.php in Private groups 1.6, at includes/settings.php

364 lines 15.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 //new file
4
5 function rpg_settings_page()
6 {
7 global $rpg_settingsf ;
8 global $rpg_settingsg ;
9 global $rpg_groups;
10 global $rpg_group_last ;
11
12
13 ?>
14 <div class="wrap">
15 <div id="upb-wrap" class="upb-help">
16 <h2><?php _e('Private Group Settings', 'bbp-private-groups'); ?></h2>
17 <?php
18 if ( ! isset( $_REQUEST['updated'] ) )
19 $_REQUEST['updated'] = false;
20 ?>
21 <?php if ( false !== $_REQUEST['updated'] ) : ?>
22 <div class="updated fade"><p><strong><?php _e( 'Group saved', 'bbp-private-groups'); ?> ); ?></strong></p></div>
23 <?php endif; ?>
24
25 <?php //tests if we have selected a tab ?>
26 <?php
27 if( isset( $_GET[ 'tab' ] ) ) {
28 $active_tab = $_GET[ 'tab' ];}
29 else {$active_tab= 'forum_visibility_settings';
30 } // end if
31 ?>
32
33 <?php // sets up the tabs ?>
34 <h2 class="nav-tab-wrapper">
35
36 <a href="?page=bbp-private-group-settings&tab=forum_visibility_settings" class="nav-tab <?php echo $active_tab == 'forum_visibility_settings' ? 'nav-tab-active' : ''; ?>">Forum Visibility settings</a>
37 <a href="?page=bbp-private-group-settings&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>">General Settings</a>
38 <a href="?page=bbp-private-group-settings&tab=group_name_settings" class="nav-tab <?php echo $active_tab == 'group_name_settings' ? 'nav-tab-active' : ''; ?>">Group Name Settings</a>
39 <a href="?page=bbp-private-group-settings&tab=help" class="nav-tab <?php echo $active_tab == 'help' ? 'nav-tab-active' : ''; ?>">Help</a></h2>
40
41 <table class="form-table">
42 <tr>
43
44 <td>
45 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
46 <input type="hidden" name="cmd" value="_s-xclick">
47 <input type="hidden" name="hosted_button_id" value="S6PZGWPG3HLEA">
48 <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
49 <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
50 </form>
51 </td><td>
52 <?php _e("If you find this plugin useful, please consider donating just a couple of dollars to help me develop and maintain it. You support will be appreciated", 'bbp-last-post'); ?>
53
54
55 </td>
56 </tr>
57 </table>
58
59 <?php //************************* Forum Visibility settings *************************// ?>
60
61 <?php if( $active_tab == 'forum_visibility_settings' ) { ?>
62 <form method="post" action="options.php">
63
64 <?php settings_fields( 'rpg_forum_settings' ); ?>
65
66 <table class="form-table">
67
68 <!-------------------------------Forum visibility ---------------------------------------->
69
70 <tr valign="top">
71 <th><h3><?php _e('Forum Visibility', 'bbp-private-groups'); ?></h3></th>
72 <td><p><?php _e('By default only users with access to a forum will see the forum titles in the indexes. However you may want everyone to see that a forum exists (ie see the title) but not be able to access topics and replies within this. In this case, set the forum visibility below. If you want only logged in users to see these forums exist, then also set the forum to private within the dashboard>forums settings', 'bbp-private-groups') ?> <b> See help tab for more information</b></p></td>
73 </tr>
74
75 <!-- checkbox to activate -->
76 <tr valign="top">
77 <th><?php _e('Activate', 'bbp-private-groups'); ?></th>
78 <td>
79 <?php activate_forum_visibility_checkbox() ;?>
80 </td>
81 </tr>
82
83 <!-------------------------------Redirect Pages ---------------------------------------->
84
85 <tr valign="top">
86 <th><h3><?php _e('Redirect Pages', 'bbp-private-groups'); ?></h3></th>
87 <td><p><?php _e('<b>If you have activated forum visibility above</b>, then users without access will see forums headings and descriptions. When they click these forum titles, they need to be sent somewhere, if only to say that they do not have access. However this is an excellent opportunity to "sign them up" so you can send them to say a register or buy access page. ', 'bbp-private-groups'); ?></p></td>
88 </tr>
89
90 <tr valign="top">
91 <th><?php _e('URL of redirect page for LOGGED-IN user', 'bbp-private-groups'); ?></th>
92 <td>
93 <input id="rpg_settingsf[redirect_page1]" class="large-text" name="rpg_settingsf[redirect_page1]" type="text" value="<?php echo isset( $rpg_settingsf['redirect_page1'] ) ? esc_html( $rpg_settingsf['redirect_page1'] ) : '';?>" /><br/>
94 <label class="description" for="rpg_settingsf[redirect_page]"><?php _e( 'Enter the full url (permalink) of the page to redirect users without access to eg http://www.mysite.com/sign-up. If you leave this blank, users will see your sites "404 not-found" page', 'bbp-private-groups' ); ?></label><br/>
95 </td>
96 </tr>
97
98 <tr valign="top">
99 <th><?php _e('URL of redirect page for NON-LOGGED-IN', 'bbp-private-groups'); ?></th>
100 <td>
101 <input id="rpg_settingsf[redirect_page2]" class="large-text" name="rpg_settingsf[redirect_page2]" type="text" value="<?php echo isset( $rpg_settingsf['redirect_page2'] ) ? esc_html( $rpg_settingsf['redirect_page2'] ) : '';?>" /><br/>
102 <label class="description" for="rpg_settingsf[redirect_page]"><?php _e( 'Enter the full url (permalink) of the page to redirect users without access to eg http://www.mysite.com/sign-up. This can be the same as the LOGGED-IN page, just giving the opportunity to have different pages if you want them ! If you leave this blank, users will be sent to the wordpress login page', 'bbp-private-groups' ); ?></label><br/>
103 </td>
104 </tr>
105
106 <!-------------------------------Freshness settings ---------------------------------------->
107
108 <tr valign="top">
109 <th><?php _e('Freshness Settings', 'bbp-private-groups'); ?></th>
110 <td><p><?php _e('<b>If you have activated forum visibility above</b>, for private group forums, when user does not have access, you can either show a message in freshness column, or leave it as the default time since last post. In both cases for users without access they will be taken to the redirect page above. ', 'bbp-private-groups'); ?></p></td>
111 </tr>
112
113 <!-- checkbox to activate -->
114 <tr valign="top">
115 <th><?php _e('Activate', 'bbp-private-groups'); ?></th>
116 <td>
117 <?php freshness_checkbox() ;?>
118 </td>
119 </tr>
120
121 <tr valign="top">
122 <th><?php _e('Freshness Message', 'bbp-private-groups'); ?></th>
123 <td>
124 <input id="rpg_settingsf[freshness_message]" class="large-text" name="rpg_settingsf[freshness_message]" type="text" value="<?php echo isset( $rpg_settingsf['freshness_message'] ) ? esc_html( $rpg_settingsf['freshness_message'] ) : '';?>" /><br/>
125 <label class="description" for="rpg_settingsf[redirect_page]"><?php _e( 'Enter the message to be shown e.g. Click here to sign up', 'bbp-private-groups' ); ?></label><br/>
126 </td>
127 </tr>
128
129 </table>
130
131 <!-- save the options -->
132 <p class="submit">
133 <input type="submit" class="button-primary" value="<?php _e( 'Save Options', 'bbp-private-groups' ); ?>" />
134 </p>
135
136 </form>
137 </div><!--end sf-wrap-->
138 </div><!--end wrap-->
139
140 <?php
141 }
142 ?>
143
144 <?php //************************* General settings *************************// ?>
145
146 <?php if( $active_tab == 'general_settings' ) { ?>
147 <form method="post" action="options.php">
148
149 <?php settings_fields( 'rpg_general_settings' ); ?>
150
151 <table class="form-table">
152 <!------------------------------- Hide topic/reply counts ------------------------------------------>
153 <tr valign="top">
154 <th colspan="2"><h3><?php _e('Hide topic and reply counts', 'bbp-private-groups'); ?></h3></th>
155 </tr>
156
157 <!-- checkbox to activate -->
158 <tr valign="top">
159 <th><?php _e('Activate', 'bbp-private-groups'); ?></th>
160 <td>
161 <?php activate_hide_counts_checkbox() ;?>
162 </td>
163 </tr>
164
165 <!------------------------------- Descriptions ------------------------------------------>
166 <tr valign="top">
167 <th colspan="2"><h3><?php _e('Show Descriptions', 'bbp-private-groups'); ?></h3></th>
168 </tr>
169
170 <!-- checkbox to activate -->
171 <tr valign="top">
172 <th><?php _e('Activate', 'bbp-private-groups'); ?></th>
173 <td>
174 <?php activate_descriptions_checkbox() ;?>
175 </td>
176 </tr>
177
178 <!------------------------------- Remove 'Private' prefix ------------------------------------------>
179 <tr valign="top">
180 <th colspan="2"><h3><?php _e("Remove 'Private' prefix", 'bbp-private-groups'); ?></h3></th>
181 </tr>
182
183 <!-- checkbox to activate -->
184 <tr valign="top">
185 <th><?php _e('Activate', 'bbp-private-groups'); ?></th>
186 <td>
187 <?php activate_private_prefix_checkbox() ;?>
188 </td>
189 </tr>
190 <tr valign="top">
191 <td></td><td><?php _e('By default bbPress shows the prefix "Private" before each private forum. Activate this checkbox to remove this prefix.', 'bbp-private-groups'); ?></td>
192 </tr>
193
194 </table>
195
196 <!-- save the options -->
197 <p class="submit">
198 <input type="submit" class="button-primary" value="<?php _e( 'Save Options', 'bbp-private-groups' ); ?>" />
199 </p>
200
201 </form>
202 </div><!--end sf-wrap-->
203 </div><!--end wrap-->
204
205 <?php
206 }
207 ?>
208
209
210
211
212 <?php //************************* Group name settings *************************// ?>
213 <?php if( $active_tab == 'group_name_settings' ) { ?>
214 <form method="post" action="options.php">
215
216 <?php settings_fields( 'rpg_group_settings' ); ?>
217
218 <table class="form-table">
219
220 <tr valign="top">
221 <th colspan="2"><p> This section allows you to set up groups. Enter a Description for each group eg gamers, teachers, group1 etc.</p></th>
222 </tr>
223 <?php
224 $count=count ($rpg_groups) ;
225 if ($count==1) $count=2 ;
226 for ($i = 0 ; $i < $count ; ++$i) {
227 $g=$i+1 ;
228 $name="group".$g ;
229 $item="rpg_groups[".$name."]" ;
230 ?>
231 <!------------------------- Group --------------------------------------------->
232 <tr valign="top">
233 <th><?php echo $name ?></th>
234 <td>
235 <?php echo '<input id="'.$item.'" class="large-text" name="'.$item.'" type="text" value="'.esc_html( $rpg_groups[$name] ).'"<br>' ;
236 ?>
237 </td>
238 </tr>
239 <?php }
240
241 ?>
242 <!-- checkbox to activate new group -->
243 <tr valign="top">
244 <th><?php _e('Add new group', 'bbp-private-groups'); ?></th>
245 <td>
246 <?php activate_new_group() ;?>
247
248 </td>
249 </tr>
250
251
252 </table>
253 <!-- save the options -->
254 <p class="submit">
255 <input type="submit" class="button-primary" value="<?php _e( 'Save Groups', 'bbp-private-groups' ); ?>" />
256 </p>
257 </form>
258 </div><!--end sf-wrap-->
259 </div><!--end wrap-->
260
261 <?php
262 }
263 ?>
264
265 <?php //************************* help page *************************// ?>
266 <?php if( $active_tab == 'help' ) { ?>
267 <form method="post" action="options.php">
268
269 <table class="form-table">
270
271 <tr valign="top">
272 <th colspan="2">
273
274 <h3>Forum Visibility Settings</h3>
275
276 <p>You have various display options</p>
277
278 <h4><span style="color:blue">Only logged in users see group forums, and even then only ones that they have access to.</span></h4>
279
280 <p><i>Description : </i> the default view. Allows up to 8 groups with unique combination of access to forums, but they only see those they have access to.</p>
281
282 <p><i>To set : </i>Do not set the visibility below.</p>
283
284 <h4><span style="color:blue">All forum titles (and optionally descriptions) visible to both logged on and non-logged on users.</span></h4>
285
286 <p><i>Description: </i>Users and non-users will be able to see that group forums exist, but not access topics/replies.</p>
287
288 <p><i>Possible Usage : </i>show that lots of forums exist, with ability to go to “sign-up” page.</p>
289
290 <p><i>To set: </i>Set visibility to public below and set forums to public in each forum’s attributes (dashboard>forums).</p>
291
292 <h4><span style="color:blue">Public forums titles (and optionally descriptions) visible to logged on and non-logged on users.
293 Private forums set visible to logged on users</span></h4>
294
295 <p><i>Description : </i>Non-logged in will only see group forums that are public, but not access topics/replies. Logged in users will see and access topics/replies for Private Group forums that are set to public, private forums that have no groups set will be accessible to all logged in users, but private group forums that the user does not belong to will be hidden. </p>
296
297 <p><i>Possible Usage : </i>Show some group forums exists, whilst keeping others visible only for private groups. Allows rich display options for each group, and user.</p>
298
299 <p><i>To set : </i>Set visibility to public below and set any private forums to private in that forum’s attributes (dashboard>forums). </p>
300
301 </th>
302 </tr>
303
304 </form>
305 </div><!--end sf-wrap-->
306 </div><!--end wrap-->
307 <?php
308 }
309 ?>
310 <?php
311 }
312
313 ?>
314 <?php
315 // register the plugin settings
316 function rpg_register_settings() {
317
318 register_setting( 'rpg_forum_settings', 'rpg_settingsf' );
319 register_setting( 'rpg_general_settings', 'rpg_settingsg' );
320 register_setting( 'rpg_group_settings', 'rpg_groups' );
321 }
322 //call register settings function
323 add_action( 'admin_init', 'rpg_register_settings' );
324
325 function rpg_settings_menu() {
326
327 // add settings page
328 add_submenu_page('options-general.php', __('bbp Private Groups', 'bbp-private-groups'), __('bbp Private Groups', 'bbp-private-groups'), 'manage_options', 'bbp-private-group-settings', 'rpg_settings_page');
329 }
330 add_action('admin_menu', 'rpg_settings_menu');
331
332 /***************************** Checkbox functions **************************/
333 function activate_forum_visibility_checkbox() {
334 global $rpg_settingsf ;
335 $item5 = $rpg_settingsf['set_forum_visibility'] ;
336 echo '<input name="rpg_settingsf[set_forum_visibility]" id="rpg_settingsf[set_forum_visibility]" type="checkbox" value="1" class="code" ' . checked( 1,$item5, false ) . ' /> Click to activate forum visibility';
337 }
338 function freshness_checkbox() {
339 global $rpg_settingsf ;
340 $item4 = $rpg_settingsf['set_freshness_message'] ;
341 echo '<input name="rpg_settingsf[set_freshness_message]" id="rpg_settingsf[set_freshness_message]" type="checkbox" value="1" class="code" ' . checked( 1,$item4, false ) . ' /> Click to activate a freshness message';
342 }
343
344 function activate_hide_counts_checkbox() {
345 global $rpg_settingsg ;
346 $item1 = $rpg_settingsg['hide_counts'] ;
347 echo '<input name="rpg_settingsg[hide_counts]" id="rpg_settingsg[hide_counts]" type="checkbox" value="1" class="code" ' . checked( 1,$item1, false ) . ' /> Hide topic and reply counts';
348 }
349 function activate_descriptions_checkbox() {
350 global $rpg_settingsg ;
351 $item2 = $rpg_settingsg['activate_descriptions'] ;
352 echo '<input name="rpg_settingsg[activate_descriptions]" id="rpg_settingsg[activate_descriptions]" type="checkbox" value="1" class="code" ' . checked( 1,$item2, false ) . ' /> Show forum content (Descriptions) on main index';
353 }
354 function activate_private_prefix_checkbox() {
355 global $rpg_settingsg ;
356 $item3 = $rpg_settingsg['activate_remove_private_prefix'] ;
357 echo '<input name="rpg_settingsg[activate_remove_private_prefix]" id="rpg_settingsg[activate_remove_private_prefix]" type="checkbox" value="1" class="code" ' . checked( 1,$item3, false ) . ' /> Remove Private prefix';
358 }
359 function activate_new_group() {
360 global $rpg_groups ;
361 $item6 = $rpg_groups['activate_new_group'] ;
362 echo '<input name="rpg_groups[activate_new_group]" id="rpg_groups[activate_new_group]" type="checkbox" value="1" class="code" /> Click and then press "save groups" to add a new group' ;
363 }
364