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 +98 -38 1.62.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,10 +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 -
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>
41 45 <table class="form-table">
42 46 <tr>
43 47
44 48 <td>
@@ -261,58 +265,112 @@
261 265 <?php
262 266 }
263 267 ?>
264 268
265 -<?php //************************* help page *************************// ?>
266 - <?php if( $active_tab == 'help' ) { ?>
267 - <form method="post" action="options.php">
268 269
269 - <table class="form-table">
270 +<?php //************************* Management Info *************************// ?>
271 + <?php if( $active_tab == 'management_information' ) {
272 + ?>
270 273
274 + <?php settings_fields( 'rpg_group_settings' ); ?>
275 +
276 + <table class="form-table">
277 +
278 + <tr valign="top">
279 +
280 + </tr>
281 + <?php
282 + $count=count ($rpg_groups) ;
283 + for ($i = 0 ; $i < $count ; ++$i) {
284 + $g=$i+1 ;
285 + $name="group".$g ;
286 + $item="rpg_groups[".$name."]" ;
287 + ?>
288 + <!------------------------- Group --------------------------------------------->
271 289 <tr valign="top">
272 - <th colspan="2">
273 -
274 - <h3>Forum Visibility Settings</h3>
290 + <th><?php echo $name ?></th>
291 + <td>
292 + Group name :
293 + <?php echo esc_html( $rpg_groups[$name] ).'<br>' ; ?>
294 + No. users in this group :
295 + <?php
296 + global $wpdb;
297 + $users=$wpdb->get_col("select ID from $wpdb->users") ;
298 + $countu=0 ;
299 + foreach ($users as $user) {
300 +
301 + $check= get_user_meta( $user, 'private_group',true);
302 + if ($check==$name) $countu++ ;
303 + }
304 + echo $countu ;
305 + ?>
306 +
275 307
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>
308 + <br>Forums in this group :
309 + <?php global $wpdb;
310 + $forum = bbp_get_forum_post_type() ;
311 + $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='$forum'") ;
312 + $countu=0 ;
313 + echo '<ul><i>' ;
314 + foreach ($forums as $forum) {
315 + $meta = (array)get_post_meta( $forum, '_private_group', false );
316 + foreach ($meta as $meta2) {
317 + if ($meta2==$name) {
318 + $ftitle=bbp_forum_title($forum) ;
319 + echo '<li>'.$ftitle.'</li>' ;
320 + $countu++ ;
321 + }
322 + }
323 +
324 + }
325 + echo '</ul></i>' ;
303 326
304 - </form>
327 + echo 'No. forums that have this group set : '.$countu ;
328 + ?>
329 + </td></tr>
330 + <?php }
331 +
332 + ?>
333 +
334 + </table>
335 +
336 + </form>
305 337 </div><!--end sf-wrap-->
306 338 </div><!--end wrap-->
339 +
307 340 <?php
308 341 }
309 342 ?>
343 +
310 344 <?php
345 +//**** user management
346 +if ($active_tab == 'user_management' ) {
347 +$group = 'all' ;
348 +pg_user_management($group) ;
311 349 }
350 +?>
312 351
352 +<?php
353 +//**** Help
354 +if ($active_tab == 'help' ) {
355 +pg_help();
356 +}
313 357 ?>
358 +
314 359 <?php
360 +//**** role assignment
361 +if ($active_tab == 'role_assignment' ) {
362 +pg_role_assignment() ;
363 +}
364 +//end of tab function
365 +}
366 +
367 +
368 +
369 +
370 +
371 +
372 +
315 373 // register the plugin settings
316 374 function rpg_register_settings() {
317 375
318 376 register_setting( 'rpg_forum_settings', 'rpg_settingsf' );
@@ -317,8 +375,9 @@
317 375
318 376 register_setting( 'rpg_forum_settings', 'rpg_settingsf' );
319 377 register_setting( 'rpg_general_settings', 'rpg_settingsg' );
320 378 register_setting( 'rpg_group_settings', 'rpg_groups' );
379 + register_setting( 'rpg_roles_settings', 'rpg_roles' );
321 380 }
322 381 //call register settings function
323 382 add_action( 'admin_init', 'rpg_register_settings' );
324 383
@@ -360,4 +419,5 @@
360 419 global $rpg_groups ;
361 420 $item6 = $rpg_groups['activate_new_group'] ;
362 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' ;
363 422 }
423 +