PluginProbe
Private groups / 2.4
Private groups v2.4
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 +51 -67 1.72.4 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) {
@@ -340,38 +298,43 @@
340 298 $countu=0 ;
341 299 foreach ($users as $user) {
342 300
343 301 $check= get_user_meta( $user, 'private_group',true);
302 + //single user check
344 303 if ($check==$name) $countu++ ;
304 + //multiple group set
305 + if (strpos($check, '*'.$name.'*') !== FALSE) $countu++;
345 306 }
346 307 echo $countu ;
308 + ?>
347 309
348 - ?>
349 - <br>No. forums that have this group set :
310 +
311 + <br>Forums in this group :
350 312 <?php global $wpdb;
351 - $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='forum'") ;
352 - //var_dump ($forums) ;
313 + $forum = bbp_get_forum_post_type() ;
314 + $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='$forum'") ;
353 315 $countu=0 ;
316 + echo '<ul><i>' ;
354 317 foreach ($forums as $forum) {
355 318 $meta = (array)get_post_meta( $forum, '_private_group', false );
356 - //var_dump ($meta) ;
357 - //echo '<br>' ;
358 319 foreach ($meta as $meta2) {
359 320 if ($meta2==$name) {
321 + $ftitle=bbp_forum_title($forum) ;
322 + echo '<li>'.$ftitle.'</li>' ;
360 323 $countu++ ;
361 - //echo $meta2 ;
362 324 }
363 325 }
364 326
365 327 }
366 - echo $countu ;
328 + echo '</ul></i>' ;
329 +
330 + echo 'No. forums that have this group set : '.$countu ;
367 331 ?>
368 332 </td></tr>
369 333 <?php }
370 334
371 335 ?>
372 -
373 -
336 +
374 337 </table>
375 338
376 339 </form>
377 340 </div><!--end sf-wrap-->
@@ -380,18 +343,37 @@
380 343 <?php
381 344 }
382 345 ?>
383 346
347 +<?php
348 +//**** user management
349 +if ($active_tab == 'user_management' ) {
350 +$group = 'all' ;
351 +pg_user_management($group) ;
352 +}
353 +?>
384 354
355 +<?php
356 +//**** Help
357 +if ($active_tab == 'help' ) {
358 +pg_help();
359 +}
360 +?>
385 361
362 +<?php
363 +//**** role assignment
364 +if ($active_tab == 'role_assignment' ) {
365 +pg_role_assignment() ;
366 +}
367 +//end of tab function
368 +}
386 369
387 370
388 371
389 -<?php
390 -}
391 372
392 -?>
393 -<?php
373 +
374 +
375 +
394 376 // register the plugin settings
395 377 function rpg_register_settings() {
396 378
397 379 register_setting( 'rpg_forum_settings', 'rpg_settingsf' );
@@ -396,8 +378,9 @@
396 378
397 379 register_setting( 'rpg_forum_settings', 'rpg_settingsf' );
398 380 register_setting( 'rpg_general_settings', 'rpg_settingsg' );
399 381 register_setting( 'rpg_group_settings', 'rpg_groups' );
382 + register_setting( 'rpg_roles_settings', 'rpg_roles' );
400 383 }
401 384 //call register settings function
402 385 add_action( 'admin_init', 'rpg_register_settings' );
403 386
@@ -439,4 +422,5 @@
439 422 global $rpg_groups ;
440 423 $item6 = $rpg_groups['activate_new_group'] ;
441 424 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 425 }
426 +