PluginProbe
Private groups / 2.3
Private groups v2.3
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
← All changes | includes/settings.php +48 -67 1.72.3 View file →
@@ -7,8 +7,9 @@
7 7 global $rpg_settingsf ;
8 8 global $rpg_settingsg ;
9 9 global $rpg_groups;
10 10 global $rpg_group_last ;
11 + global $rpg_roles ;
11 12
12 13
13 14 ?>
14 15 <div class="wrap">
@@ -24,9 +25,10 @@
24 25
25 26 <?php //tests if we have selected a tab ?>
26 27 <?php
27 28 if( isset( $_GET[ 'tab' ] ) ) {
28 - $active_tab = $_GET[ 'tab' ];}
29 + if ($active_tab == 'user_management') pg_user_management($tab) ;
30 + $active_tab = $_GET[ 'tab' ];}
29 31 else {$active_tab= 'forum_visibility_settings';
30 32 } // end if
31 33 ?>
32 34
@@ -35,11 +37,12 @@
35 37
36 38 <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 39 <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 40 <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 - <a href="?page=bbp-private-group-settings&tab=management_information" class="nav-tab <?php echo $active_tab == 'Management_information' ? 'nav-tab-active' : ''; ?>">Management Information</a></h2>
41 -
41 + <a href="?page=bbp-private-group-settings&tab=help" class="nav-tab <?php echo $active_tab == 'help' ? 'nav-tab-active' : ''; ?>">Help</a>
42 + <a href="?page=bbp-private-group-settings&tab=management_information" class="nav-tab <?php echo $active_tab == 'Management_information' ? 'nav-tab-active' : ''; ?>">Management Information</a>
43 + <a href="?page=bbp-private-group-settings&tab=user_management" class="nav-tab <?php echo $active_tab == 'user_management' ? 'nav-tab-active' : ''; ?>">User Management</a>
44 + <a href="?page=bbp-private-group-settings&tab=role_assignment" class="nav-tab <?php echo $active_tab == 'role_assignment' ? 'nav-tab-active' : ''; ?>">Assign groups to roles</a></h2>
42 45 <table class="form-table">
43 46 <tr>
44 47
45 48 <td>
@@ -262,64 +265,19 @@
262 265 <?php
263 266 }
264 267 ?>
265 268
266 -<?php //************************* help page *************************// ?>
267 - <?php if( $active_tab == 'help' ) { ?>
268 - <form method="post" action="options.php">
269 269
270 - <table class="form-table">
270 +<?php //************************* Management Info *************************// ?>
271 + <?php if( $active_tab == 'management_information' ) {
272 + ?>
271 273
272 - <tr valign="top">
273 - <th colspan="2">
274 -
275 - <h3>Forum Visibility Settings</h3>
276 -
277 -<p>You have various display options</p>
278 -
279 -<h4><span style="color:blue">Only logged in users see group forums, and even then only ones that they have access to.</span></h4>
280 -
281 -<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>
282 -
283 -<p><i>To set : </i>Do not set the visibility below.</p>
284 -
285 -<h4><span style="color:blue">All forum titles (and optionally descriptions) visible to both logged on and non-logged on users.</span></h4>
286 -
287 -<p><i>Description: </i>Users and non-users will be able to see that group forums exist, but not access topics/replies.</p>
288 -
289 -<p><i>Possible Usage : </i>show that lots of forums exist, with ability to go to “sign-up” page.</p>
290 -
291 -<p><i>To set: </i>Set visibility to public below and set forums to public in each forum’s attributes (dashboard>forums).</p>
292 -
293 -<h4><span style="color:blue">Public forums titles (and optionally descriptions) visible to logged on and non-logged on users.
294 -Private forums set visible to logged on users</span></h4>
295 -
296 -<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>
297 -
298 -<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>
299 -
300 -<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>
301 -
302 - </th>
303 - </tr>
304 - <a href="http://www.rewweb.co.uk/wp-content/uploads/2014/04/private-group-roles1.jpg"><img src="http://www.rewweb.co.uk/wp-content/uploads/2014/04/private-group-roles1.jpg"/> </a>
305 - </form>
306 - </div><!--end sf-wrap-->
307 - </div><!--end wrap-->
308 -<?php
309 -}
310 -?>
311 -
312 -<?php //************************* Management Info *************************// ?>
313 - <?php if( $active_tab == 'management_information' ) { ?>
314 - <form method="post" action="options.php">
315 -
316 274 <?php settings_fields( 'rpg_group_settings' ); ?>
317 275
318 276 <table class="form-table">
319 277
320 278 <tr valign="top">
321 - <th colspan="2"><p> This section is planned for future releases - at the moment it just shows you no. users and forums.</p></th>
279 +
322 280 </tr>
323 281 <?php
324 282 $count=count ($rpg_groups) ;
325 283 for ($i = 0 ; $i < $count ; ++$i) {
@@ -343,35 +301,37 @@
343 301 $check= get_user_meta( $user, 'private_group',true);
344 302 if ($check==$name) $countu++ ;
345 303 }
346 304 echo $countu ;
305 + ?>
347 306
348 - ?>
349 - <br>No. forums that have this group set :
307 +
308 + <br>Forums in this group :
350 309 <?php global $wpdb;
351 - $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='forum'") ;
352 - //var_dump ($forums) ;
310 + $forum = bbp_get_forum_post_type() ;
311 + $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='$forum'") ;
353 312 $countu=0 ;
313 + echo '<ul><i>' ;
354 314 foreach ($forums as $forum) {
355 315 $meta = (array)get_post_meta( $forum, '_private_group', false );
356 - //var_dump ($meta) ;
357 - //echo '<br>' ;
358 316 foreach ($meta as $meta2) {
359 317 if ($meta2==$name) {
318 + $ftitle=bbp_forum_title($forum) ;
319 + echo '<li>'.$ftitle.'</li>' ;
360 320 $countu++ ;
361 - //echo $meta2 ;
362 321 }
363 322 }
364 323
365 324 }
366 - echo $countu ;
325 + echo '</ul></i>' ;
326 +
327 + echo 'No. forums that have this group set : '.$countu ;
367 328 ?>
368 329 </td></tr>
369 330 <?php }
370 331
371 332 ?>
372 -
373 -
333 +
374 334 </table>
375 335
376 336 </form>
377 337 </div><!--end sf-wrap-->
@@ -380,18 +340,37 @@
380 340 <?php
381 341 }
382 342 ?>
383 343
344 +<?php
345 +//**** user management
346 +if ($active_tab == 'user_management' ) {
347 +$group = 'all' ;
348 +pg_user_management($group) ;
349 +}
350 +?>
384 351
352 +<?php
353 +//**** Help
354 +if ($active_tab == 'help' ) {
355 +pg_help();
356 +}
357 +?>
385 358
359 +<?php
360 +//**** role assignment
361 +if ($active_tab == 'role_assignment' ) {
362 +pg_role_assignment() ;
363 +}
364 +//end of tab function
365 +}
386 366
387 367
388 368
389 -<?php
390 -}
391 369
392 -?>
393 -<?php
370 +
371 +
372 +
394 373 // register the plugin settings
395 374 function rpg_register_settings() {
396 375
397 376 register_setting( 'rpg_forum_settings', 'rpg_settingsf' );
@@ -396,8 +375,9 @@
396 375
397 376 register_setting( 'rpg_forum_settings', 'rpg_settingsf' );
398 377 register_setting( 'rpg_general_settings', 'rpg_settingsg' );
399 378 register_setting( 'rpg_group_settings', 'rpg_groups' );
379 + register_setting( 'rpg_roles_settings', 'rpg_roles' );
400 380 }
401 381 //call register settings function
402 382 add_action( 'admin_init', 'rpg_register_settings' );
403 383
@@ -439,4 +419,5 @@
439 419 global $rpg_groups ;
440 420 $item6 = $rpg_groups['activate_new_group'] ;
441 421 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' ;
442 422 }
423 +