| @@ -7,11 +7,10 @@ | ||
| 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 ; | |
| 12 | - | |
| 13 | 11 | |
| 12 | + | |
| 14 | 13 | ?> |
| 15 | 14 | <div class="wrap"> |
| 16 | 15 | <div id="upb-wrap" class="upb-help"> |
| 17 | 16 | <h2><?php _e('Private Group Settings', 'bbp-private-groups'); ?></h2> |
| @@ -25,9 +24,9 @@ | ||
| 25 | 24 | |
| 26 | 25 | <?php //tests if we have selected a tab ?> |
| 27 | 26 | <?php |
| 28 | 27 | if( isset( $_GET[ 'tab' ] ) ) { |
| 29 | - if ( !empty($active_tab) && $active_tab == 'user_management') pg_user_management($tab) ; | |
| 28 | + if ($active_tab == 'user_management') pg_user_management($tab) ; | |
| 30 | 29 | $active_tab = $_GET[ 'tab' ];} |
| 31 | 30 | else {$active_tab= 'forum_visibility_settings'; |
| 32 | 31 | } // end if |
| 33 | 32 | ?> |
| @@ -33,58 +32,33 @@ | ||
| 33 | 32 | ?> |
| 34 | 33 | |
| 35 | 34 | <?php // sets up the tabs ?> |
| 36 | 35 | <h2 class="nav-tab-wrapper"> |
| 37 | - <a href="?page=bbp-private-group-settings&tab=group_name_settings" class="nav-tab <?php echo $active_tab == 'group_name_settings' ? 'nav-tab-active' : ''; ?>"><?php _e('Group Name Settings' , 'bbp-private-groups' ) ; ?></a> | |
| 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' : ''; ?>"><?php _e('Forum Visibility settings' , 'bbp-private-groups' ) ; ?></a> | |
| 39 | - <a href="?page=bbp-private-group-settings&tab=topic_permissions" class="nav-tab <?php echo $active_tab == 'topic_permissions' ? 'nav-tab-active' : ''; ?>"><?php _e('Topic Permissions' , 'bbp-private-groups' ) ; ?></a> | |
| 40 | - <a href="?page=bbp-private-group-settings&tab=role_assignment" class="nav-tab <?php echo $active_tab == 'role_assignment' ? 'nav-tab-active' : ''; ?>"><?php _e('Assign groups to roles' , 'bbp-private-groups' ) ; ?></a> | |
| 41 | - <a href="?page=bbp-private-group-settings&tab=disable_groups" class="nav-tab <?php echo $active_tab == 'disable_groups' ? 'nav-tab-active' : ''; ?>"><?php _e('Disable Groups' , 'bbp-private-groups' ) ; ?></a> | |
| 42 | - <a href="?page=bbp-private-group-settings&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>"><?php _e('General Settings' , 'bbp-private-groups' ) ; ?></a> | |
| 43 | - <a href="?page=bbp-private-group-settings&tab=user_management" class="nav-tab <?php echo $active_tab == 'user_management' ? 'nav-tab-active' : ''; ?>"><?php _e('User Management' , 'bbp-private-groups' ) ; ?></a> | |
| 44 | - <a href="?page=bbp-private-group-settings&tab=widget_warning" class="nav-tab <?php echo $active_tab == 'widget_warning' ? 'nav-tab-active' : ''; ?>"><?php _e('Widget Warning !' , 'bbp-private-groups' ) ; ?></a> | |
| 45 | - <a href="?page=bbp-private-group-settings&tab=shortcode_warning" class="nav-tab <?php echo $active_tab == 'shortcode_warning' ? 'nav-tab-active' : ''; ?>"><?php _e('Shortcode Warning !' , 'bbp-private-groups' ) ; ?></a> | |
| 46 | - <a href="?page=bbp-private-group-settings&tab=management_information" class="nav-tab <?php echo $active_tab == 'Management_information' ? 'nav-tab-active' : ''; ?>"><?php _e('Management Information' , 'bbp-private-groups' ) ; ?></a> | |
| 47 | - <a href="?page=bbp-private-group-settings&tab=plugin-info" class="nav-tab <?php echo $active_tab == 'plugin-info' ? 'nav-tab-active' : ''; ?>"><?php _e('Plugin Information' , 'bbp-private-groups' ) ; ?></a> | |
| 48 | - <a href="?page=bbp-private-group-settings&tab=help" class="nav-tab <?php echo $active_tab == 'help' ? 'nav-tab-active' : ''; ?>"><?php _e('Help' , 'bbp-private-groups' ) ; ?></a> | |
| 49 | - <a href="?page=bbp-private-group-settings&tab=programmershelp" class="nav-tab <?php echo $active_tab == 'programmershelp' ? 'nav-tab-active' : ''; ?>"><?php _e('Programmers Help' , 'bbp-private-groups' ) ; ?></a></h2> | |
| 50 | - | |
| 51 | - <?php | |
| 52 | - if (class_exists('bbPress_Notify_noSpam') && !class_exists('bbpnns_private_groups_bridge')) | |
| 53 | - echo '<h1>WARNING !!! You have bbPress Notify (No Spam) active. This plugin will send <b>all</b> topics and replies to users as set and private groups does not filter these.<br> | |
| 54 | - Either <br> 1. Ensure that you understand this before using (maybe only use for those allowed to see everything eg admins) | |
| 55 | - or <br> 2. add <a href="https://usestrict.net/product/bbpress-notify-no-spam-private-groups-bridge/" target="_new">bbpnns_private_groups_bridge</a> to get the add-on so that bbpnns and private groups work together.</h1>' ; | |
| 56 | - ?> | |
| 57 | 36 | |
| 58 | - <?php | |
| 59 | - if (function_exists('notify_new_topic') ) | |
| 60 | - echo '<h1>WARNING !!! You have an old plugin bbPress Notify active. It is strongly recommended that you use <a href="https://en-gb.wordpress.org/plugins/bbpress-notify-nospam/" target="_new">bbPress Notify (No Spam)</a> instead which is supported. | |
| 61 | - <br>HOWEVER Both plugins will send <b>all</b> topics and replies to users as set and private groups does not filter these.<br> | |
| 62 | - Either <br> 1. Ensure that you understand this before using (maybe only use for those allowed to see everything eg admins) | |
| 63 | - or <br> 2. add <a href="https://usestrict.net/product/bbpress-notify-no-spam-private-groups-bridge/" target="_new">bbpnns_private_groups_bridge\</a> as well as <a href="https://en-gb.wordpress.org/plugins/bbpress-notify-nospam/" target="_new">bbPress Notify (No Spam)</a> to get the add-on so that bbpnns and private groups work together.</h1>' ; | |
| 64 | - | |
| 65 | - ?> | |
| 66 | - | |
| 67 | - | |
| 68 | - | |
| 69 | - | |
| 37 | + <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> | |
| 38 | + <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> | |
| 39 | + <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> | |
| 40 | + <a href="?page=bbp-private-group-settings&tab=help" class="nav-tab <?php echo $active_tab == 'help' ? 'nav-tab-active' : ''; ?>">Help</a> | |
| 41 | + <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> | |
| 42 | + <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></h2> | |
| 70 | 43 | <table class="form-table"> |
| 71 | - <tr> | |
| 44 | + <tr> | |
| 45 | + | |
| 72 | 46 | <td> |
| 73 | - <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> | |
| 74 | - <input type="hidden" name="cmd" value="_s-xclick" /> | |
| 75 | - <input type="hidden" name="hosted_button_id" value="GEMT7XS7C8PS4" /> | |
| 76 | - <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" /> | |
| 77 | - <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1" /> | |
| 78 | - </form> | |
| 79 | - </td> | |
| 80 | - <td> | |
| 81 | - <?php _e('If you find this plugin useful, please consider donating just a few dollars to help me develop and maintain it. You support will be appreciated', 'bbp-style-pack'); ?> | |
| 82 | - </td> | |
| 83 | - | |
| 84 | - </tr> | |
| 85 | - </table> | |
| 47 | + <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> | |
| 48 | +<input type="hidden" name="cmd" value="_s-xclick"> | |
| 49 | +<input type="hidden" name="hosted_button_id" value="S6PZGWPG3HLEA"> | |
| 50 | +<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."> | |
| 51 | +<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1"> | |
| 52 | +</form> | |
| 53 | +</td><td> | |
| 54 | +<?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'); ?> | |
| 86 | 55 | |
| 56 | + | |
| 57 | +</td> | |
| 58 | +</tr> | |
| 59 | +</table> | |
| 60 | + | |
| 87 | 61 | <?php //************************* Forum Visibility settings *************************// ?> |
| 88 | 62 | |
| 89 | 63 | <?php if( $active_tab == 'forum_visibility_settings' ) { ?> |
| 90 | 64 | <form method="post" action="options.php"> |
| @@ -96,9 +70,9 @@ | ||
| 96 | 70 | <!-------------------------------Forum visibility ----------------------------------------> |
| 97 | 71 | |
| 98 | 72 | <tr valign="top"> |
| 99 | 73 | <th><h3><?php _e('Forum Visibility', 'bbp-private-groups'); ?></h3></th> |
| 100 | - <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> <?php _e ('See help tab for more information' , 'bbp-private-groups') ; ?></b></p></td> | |
| 74 | + <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> | |
| 101 | 75 | </tr> |
| 102 | 76 | |
| 103 | 77 | <!-- checkbox to activate --> |
| 104 | 78 | <tr valign="top"> |
| @@ -126,9 +100,9 @@ | ||
| 126 | 100 | <tr valign="top"> |
| 127 | 101 | <th><?php _e('URL of redirect page for NON-LOGGED-IN', 'bbp-private-groups'); ?></th> |
| 128 | 102 | <td> |
| 129 | 103 | <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/> |
| 130 | - <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/> | |
| 104 | + <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/> | |
| 131 | 105 | </td> |
| 132 | 106 | </tr> |
| 133 | 107 | |
| 134 | 108 | <!-------------------------------Freshness settings ----------------------------------------> |
| @@ -176,14 +150,13 @@ | ||
| 176 | 150 | |
| 177 | 151 | <?php settings_fields( 'rpg_general_settings' ); ?> |
| 178 | 152 | |
| 179 | 153 | <table class="form-table"> |
| 180 | - | |
| 181 | - | |
| 182 | - <!------------------------------- Hide topic/reply counts ------------------------------------------> | |
| 154 | + <!------------------------------- Hide topic/reply counts ------------------------------------------> | |
| 183 | 155 | <tr valign="top"> |
| 184 | 156 | <th colspan="2"><h3><?php _e('Hide topic and reply counts', 'bbp-private-groups'); ?></h3></th> |
| 185 | 157 | </tr> |
| 158 | + | |
| 186 | 159 | <!-- checkbox to activate --> |
| 187 | 160 | <tr valign="top"> |
| 188 | 161 | <th><?php _e('Activate', 'bbp-private-groups'); ?></th> |
| 189 | 162 | <td> |
| @@ -189,20 +162,8 @@ | ||
| 189 | 162 | <td> |
| 190 | 163 | <?php activate_hide_counts_checkbox() ;?> |
| 191 | 164 | </td> |
| 192 | 165 | </tr> |
| 193 | - <!------------------------------- List Sub-forums as columns ------------------------------------------> | |
| 194 | - <tr valign="top"> | |
| 195 | - <th colspan="2"><h3><?php _e('List Sub-forums in Columns', 'bbp-private-groups'); ?></h3></th> | |
| 196 | - </tr> | |
| 197 | - | |
| 198 | - <!-- checkbox to activate --> | |
| 199 | - <tr valign="top"> | |
| 200 | - <th><?php _e('Activate', 'bbp-private-groups'); ?></th> | |
| 201 | - <td> | |
| 202 | - <?php activate_sub_forums_checkbox() ;?> | |
| 203 | - </td> | |
| 204 | - </tr> | |
| 205 | 166 | |
| 206 | 167 | <!------------------------------- Descriptions ------------------------------------------> |
| 207 | 168 | <tr valign="top"> |
| 208 | 169 | <th colspan="2"><h3><?php _e('Show Descriptions', 'bbp-private-groups'); ?></h3></th> |
| @@ -251,88 +212,180 @@ | ||
| 251 | 212 | |
| 252 | 213 | |
| 253 | 214 | <?php //************************* Group name settings *************************// ?> |
| 254 | 215 | <?php if( $active_tab == 'group_name_settings' ) { ?> |
| 255 | - <form method="post" action="options.php"> | |
| 256 | - <?php global $rpg_disable_groups ;?> | |
| 216 | + <form method="post" action="options.php"> | |
| 217 | + | |
| 257 | 218 | <?php settings_fields( 'rpg_group_settings' ); ?> |
| 258 | 219 | |
| 259 | 220 | <table class="form-table"> |
| 260 | 221 | |
| 261 | - <tr valign="top"> | |
| 262 | - <th colspan="3"> | |
| 263 | - <p> | |
| 264 | - <?php _e('This section allows you to set up groups. Enter a Description for each group eg gamers, teachers, group1 etc.' , 'bbp-private-groups' ) ; ?> | |
| 265 | - </p> | |
| 266 | - </th> | |
| 267 | - </tr> | |
| 268 | - <?php | |
| 269 | - if (!empty ($rpg_groups)) $count=count ($rpg_groups) ; | |
| 270 | - else $count = 1 ; | |
| 271 | - //a new group is added if $rpg_groups['activate_new_group'] is set, as this becomes part of the count, so it looks like we have an extra group in the count | |
| 272 | - if ($count==1) $count=2 ; | |
| 273 | - for ($i = 0 ; $i < $count ; ++$i) { | |
| 274 | - $g=$i+1 ; | |
| 275 | - $display=__( 'Group', 'bbp-private-groups' ).$g ; | |
| 276 | - $name="group".$g ; | |
| 277 | - $item="rpg_groups[".$name."]" ; | |
| 278 | - $value = (!empty ($rpg_groups[$name]) ? $rpg_groups[$name] : '' ) ; | |
| 279 | - ?> | |
| 280 | - <!------------------------- Group ---------------------------------------------> | |
| 222 | + <tr valign="top"> | |
| 223 | + <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> | |
| 224 | + </tr> | |
| 225 | + <?php | |
| 226 | + $count=count ($rpg_groups) ; | |
| 227 | + if ($count==1) $count=2 ; | |
| 228 | + for ($i = 0 ; $i < $count ; ++$i) { | |
| 229 | + $g=$i+1 ; | |
| 230 | + $name="group".$g ; | |
| 231 | + $item="rpg_groups[".$name."]" ; | |
| 232 | + ?> | |
| 233 | + <!------------------------- Group ---------------------------------------------> | |
| 281 | 234 | <tr valign="top"> |
| 282 | - <th> | |
| 283 | - <?php echo $display ?> | |
| 284 | - </th> | |
| 285 | - | |
| 286 | - <td> | |
| 287 | - <?php echo '<input id="'.$item.'" class="medium-text" name="'.$item.'" type="text" value="'.esc_html( $value ).'"<br>' ; ?> | |
| 288 | - | |
| 289 | - <?php | |
| 290 | - if (!empty ($rpg_disable_groups[$name] ) ) { | |
| 291 | - _e('This group is disabled - to re-enable use the \'Disable Groups\' tab', 'bbp-private-groups' ) ; | |
| 292 | - } | |
| 293 | - | |
| 294 | - ?> | |
| 295 | - </td> | |
| 235 | + <th><?php echo $name ?></th> | |
| 236 | + <td> | |
| 237 | + <?php echo '<input id="'.$item.'" class="large-text" name="'.$item.'" type="text" value="'.esc_html( $rpg_groups[$name] ).'"<br>' ; | |
| 238 | + ?> | |
| 239 | + </td> | |
| 296 | 240 | </tr> |
| 297 | - <?php | |
| 298 | - } | |
| 241 | + <?php } | |
| 299 | 242 | |
| 300 | - ?> | |
| 301 | - <!-- checkbox to activate new group --> | |
| 243 | + ?> | |
| 244 | + <!-- checkbox to activate new group --> | |
| 302 | 245 | <tr valign="top"> |
| 303 | - <th> | |
| 304 | - <?php _e('Add new group', 'bbp-private-groups'); ?> | |
| 305 | - </th> | |
| 306 | - | |
| 307 | - <td> | |
| 308 | - <?php activate_new_group() ;?> | |
| 246 | + <th><?php _e('Add new group', 'bbp-private-groups'); ?></th> | |
| 247 | + <td> | |
| 248 | + <?php activate_new_group() ;?> | |
| 309 | 249 | |
| 310 | - </td> | |
| 250 | + </td> | |
| 311 | 251 | </tr> |
| 312 | 252 | |
| 313 | 253 | |
| 314 | - </table> | |
| 315 | - <!-- save the options --> | |
| 316 | - <p class="submit"> | |
| 317 | - <input type="submit" class="button-primary" value="<?php _e( 'Save Groups', 'bbp-private-groups' ); ?>" /> | |
| 318 | - </p> | |
| 319 | - </form> | |
| 320 | - </div><!--end sf-wrap--> | |
| 254 | + </table> | |
| 255 | + <!-- save the options --> | |
| 256 | + <p class="submit"> | |
| 257 | + <input type="submit" class="button-primary" value="<?php _e( 'Save Groups', 'bbp-private-groups' ); ?>" /> | |
| 258 | + </p> | |
| 259 | + </form> | |
| 260 | + </div><!--end sf-wrap--> | |
| 321 | 261 | </div><!--end wrap--> |
| 322 | 262 | |
| 323 | 263 | <?php |
| 324 | 264 | } |
| 325 | - | |
| 265 | +?> | |
| 326 | 266 | |
| 267 | +<?php //************************* help page *************************// ?> | |
| 268 | + <?php if( $active_tab == 'help' ) { ?> | |
| 269 | + <form method="post" action="options.php"> | |
| 327 | 270 | |
| 271 | + <table class="form-table"> | |
| 272 | + | |
| 273 | + <tr valign="top"> | |
| 274 | + <th colspan="2"> | |
| 275 | + | |
| 276 | + <h3>Forum Visibility Settings</h3> | |
| 328 | 277 | |
| 329 | -//**** management info | |
| 330 | -if( $active_tab == 'management_information' ) { | |
| 331 | -management_info () ; | |
| 278 | +<p>You have various display options</p> | |
| 332 | 279 | |
| 280 | +<h4><span style="color:blue">Only logged in users see group forums, and even then only ones that they have access to.</span></h4> | |
| 333 | 281 | |
| 282 | +<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> | |
| 283 | + | |
| 284 | +<p><i>To set : </i>Do not set the visibility.</p> | |
| 285 | + | |
| 286 | +<h4><span style="color:blue">All forum titles (and optionally descriptions) visible to both logged on and non-logged on users.</span></h4> | |
| 287 | + | |
| 288 | +<p><i>Description: </i>Users and non-users will be able to see that group forums exist, but not access topics/replies.</p> | |
| 289 | + | |
| 290 | +<p><i>Possible Usage : </i>show that lots of forums exist, with ability to go to “sign-up” page.</p> | |
| 291 | + | |
| 292 | +<p><i>To set: </i>Set visibility to public below and set forums to public in each forum’s attributes (dashboard>forums).</p> | |
| 293 | + | |
| 294 | +<h4><span style="color:blue">Public forums titles (and optionally descriptions) visible to logged on and non-logged on users. | |
| 295 | +Private forums set visible to logged on users</span></h4> | |
| 296 | + | |
| 297 | +<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> | |
| 298 | + | |
| 299 | +<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> | |
| 300 | + | |
| 301 | +<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> | |
| 302 | + | |
| 303 | + </th> | |
| 304 | + </tr> | |
| 305 | + <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> | |
| 306 | + </form> | |
| 307 | + </div><!--end sf-wrap--> | |
| 308 | + </div><!--end wrap--> | |
| 309 | +<?php | |
| 334 | 310 | } |
| 311 | +?> | |
| 312 | + | |
| 313 | +<?php //************************* Management Info *************************// ?> | |
| 314 | + <?php if( $active_tab == 'management_information' ) { | |
| 315 | + ?> | |
| 316 | + | |
| 317 | + <?php settings_fields( 'rpg_group_settings' ); ?> | |
| 318 | + | |
| 319 | + <table class="form-table"> | |
| 320 | + | |
| 321 | + <tr valign="top"> | |
| 322 | + | |
| 323 | + </tr> | |
| 324 | + <?php | |
| 325 | + $count=count ($rpg_groups) ; | |
| 326 | + for ($i = 0 ; $i < $count ; ++$i) { | |
| 327 | + $g=$i+1 ; | |
| 328 | + $name="group".$g ; | |
| 329 | + $item="rpg_groups[".$name."]" ; | |
| 330 | + ?> | |
| 331 | + <!------------------------- Group ---------------------------------------------> | |
| 332 | + <tr valign="top"> | |
| 333 | + <th><?php echo $name ?></th> | |
| 334 | + <td> | |
| 335 | + Group name : | |
| 336 | + <?php echo esc_html( $rpg_groups[$name] ).'<br>' ; ?> | |
| 337 | + No. users in this group : | |
| 338 | + <?php | |
| 339 | + global $wpdb; | |
| 340 | + $users=$wpdb->get_col("select ID from $wpdb->users") ; | |
| 341 | + $countu=0 ; | |
| 342 | + foreach ($users as $user) { | |
| 343 | + | |
| 344 | + $check= get_user_meta( $user, 'private_group',true); | |
| 345 | + if ($check==$name) $countu++ ; | |
| 346 | + } | |
| 347 | + echo $countu ; | |
| 348 | + ?> | |
| 349 | + | |
| 350 | + | |
| 351 | + <br>Forums in this group : | |
| 352 | + <?php global $wpdb; | |
| 353 | + $forum = bbp_get_forum_post_type() ; | |
| 354 | + $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='$forum'") ; | |
| 355 | + $countu=0 ; | |
| 356 | + echo '<ul><i>' ; | |
| 357 | + foreach ($forums as $forum) { | |
| 358 | + $meta = (array)get_post_meta( $forum, '_private_group', false ); | |
| 359 | + foreach ($meta as $meta2) { | |
| 360 | + if ($meta2==$name) { | |
| 361 | + $ftitle=bbp_forum_title($forum) ; | |
| 362 | + echo '<li>'.$ftitle.'</li>' ; | |
| 363 | + $countu++ ; | |
| 364 | + } | |
| 365 | + } | |
| 366 | + | |
| 367 | + } | |
| 368 | + echo '</ul></i>' ; | |
| 369 | + | |
| 370 | + echo 'No. forums that have this group set : '.$countu ; | |
| 371 | + ?> | |
| 372 | + </td></tr> | |
| 373 | + <?php } | |
| 374 | + | |
| 375 | + ?> | |
| 376 | + | |
| 377 | + </table> | |
| 378 | + | |
| 379 | + </form> | |
| 380 | + </div><!--end sf-wrap--> | |
| 381 | + </div><!--end wrap--> | |
| 382 | + | |
| 383 | +<?php | |
| 384 | +} | |
| 385 | +?> | |
| 386 | + | |
| 387 | +<?php | |
| 335 | 388 | //**** user management |
| 336 | 389 | if ($active_tab == 'user_management' ) { |
| 337 | 390 | $group = 'all' ; |
| 338 | 391 | pg_user_management($group) ; |
| @@ -337,53 +390,22 @@ | ||
| 337 | 390 | $group = 'all' ; |
| 338 | 391 | pg_user_management($group) ; |
| 339 | 392 | } |
| 340 | 393 | |
| 341 | -//**** Help | |
| 342 | -if ($active_tab == 'help' ) { | |
| 343 | -pg_help(); | |
| 344 | -} | |
| 345 | 394 | |
| 346 | -//**** Plugin Info | |
| 347 | -if ($active_tab == 'plugin-info' ) { | |
| 348 | -pg_plugin_info(); | |
| 349 | -} | |
| 350 | 395 | |
| 351 | -//**** role assignment | |
| 352 | -if ($active_tab == 'role_assignment' ) { | |
| 353 | -pg_role_assignment() ; | |
| 354 | -} | |
| 355 | 396 | |
| 356 | -//**** disable Groups | |
| 357 | -if ($active_tab == 'disable_groups' ) { | |
| 358 | -rpg_disable_groups() ; | |
| 359 | -} | |
| 360 | 397 | |
| 361 | 398 | |
| 362 | -//**** widget warning | |
| 363 | -if ($active_tab == 'widget_warning' ) { | |
| 364 | -pg_widget_warning() ; | |
| 399 | +//end of tab function | |
| 365 | 400 | } |
| 366 | 401 | |
| 367 | -//**** shortcode warning | |
| 368 | -if ($active_tab == 'shortcode_warning' ) { | |
| 369 | -pg_shortcode_warning() ; | |
| 370 | -} | |
| 371 | 402 | |
| 372 | -//**** topic permissions | |
| 373 | -if ($active_tab == 'topic_permissions' ) { | |
| 374 | -rpg_topic_permissions() ; | |
| 375 | -} | |
| 376 | 403 | |
| 377 | -//**** topic permissions | |
| 378 | -if ($active_tab == 'programmershelp' ) { | |
| 379 | -rpg_programmers_help() ; | |
| 380 | -} | |
| 381 | 404 | |
| 382 | -//end of tab function | |
| 383 | -} | |
| 384 | 405 | |
| 385 | 406 | |
| 407 | + | |
| 386 | 408 | // register the plugin settings |
| 387 | 409 | function rpg_register_settings() { |
| 388 | 410 | |
| 389 | 411 | register_setting( 'rpg_forum_settings', 'rpg_settingsf' ); |
| @@ -388,21 +410,16 @@ | ||
| 388 | 410 | |
| 389 | 411 | register_setting( 'rpg_forum_settings', 'rpg_settingsf' ); |
| 390 | 412 | register_setting( 'rpg_general_settings', 'rpg_settingsg' ); |
| 391 | 413 | register_setting( 'rpg_group_settings', 'rpg_groups' ); |
| 392 | - register_setting( 'rpg_roles_settings', 'rpg_roles' ); | |
| 393 | - register_setting( 'rpg_topic_permissions', 'rpg_topic_permissions' ); | |
| 394 | - register_setting( 'rpg_disable_groups', 'rpg_disable_groups' ); | |
| 395 | 414 | } |
| 396 | - | |
| 397 | 415 | //call register settings function |
| 398 | 416 | add_action( 'admin_init', 'rpg_register_settings' ); |
| 399 | 417 | |
| 400 | 418 | function rpg_settings_menu() { |
| 401 | - //allows filter for which capability can access the settings page - default = 'manage_options' | |
| 402 | - $cap = apply_filters('rpg_plugin_settings_capability','manage_options'); | |
| 419 | + | |
| 403 | 420 | // add settings page |
| 404 | - add_submenu_page('options-general.php', __('bbp Private Groups', 'bbp-private-groups'), __('bbp Private Groups', 'bbp-private-groups'), $cap, 'bbp-private-group-settings', 'rpg_settings_page'); | |
| 421 | + 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'); | |
| 405 | 422 | } |
| 406 | 423 | add_action('admin_menu', 'rpg_settings_menu'); |
| 407 | 424 | |
| 408 | 425 | /***************************** Checkbox functions **************************/ |
| @@ -407,51 +424,33 @@ | ||
| 407 | 424 | |
| 408 | 425 | /***************************** Checkbox functions **************************/ |
| 409 | 426 | function activate_forum_visibility_checkbox() { |
| 410 | 427 | global $rpg_settingsf ; |
| 411 | - $item5 = (!empty($rpg_settingsf['set_forum_visibility'] ) ? $rpg_settingsf['set_forum_visibility'] : ''); | |
| 412 | - //$item5 = $rpg_settingsf['set_forum_visibility'] ; | |
| 413 | - echo '<input name="rpg_settingsf[set_forum_visibility]" id="rpg_settingsf[set_forum_visibility]" type="checkbox" value="1" class="code" ' . checked( 1,$item5, false ) . ' />' ; | |
| 414 | - _e ('Click to activate forum visibility' , 'bbp-private-groups') ; | |
| 428 | + $item5 = $rpg_settingsf['set_forum_visibility'] ; | |
| 429 | + 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'; | |
| 415 | 430 | } |
| 416 | 431 | function freshness_checkbox() { |
| 417 | 432 | global $rpg_settingsf ; |
| 418 | - $item4 = (!empty($rpg_settingsf['set_freshness_message'] ) ? $rpg_settingsf['set_freshness_message'] : ''); | |
| 419 | - //$item4 = $rpg_settingsf['set_freshness_message'] ; | |
| 420 | - echo '<input name="rpg_settingsf[set_freshness_message]" id="rpg_settingsf[set_freshness_message]" type="checkbox" value="1" class="code" ' . checked( 1,$item4, false ) . ' />' ; | |
| 421 | - _e ('Click to activate a freshness message', 'bbp-private-groups' ); | |
| 433 | + $item4 = $rpg_settingsf['set_freshness_message'] ; | |
| 434 | + 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'; | |
| 422 | 435 | } |
| 423 | 436 | |
| 424 | - function activate_sub_forums_checkbox() { | |
| 425 | - global $rpg_settingsg ; | |
| 426 | - $item1 = (!empty( $rpg_settingsg['list_sub_forums_as_column']) ? $rpg_settingsg['list_sub_forums_as_column'] : ''); | |
| 427 | - //$item1 = $rpg_settingsg['list_sub_forums_as_column'] ; | |
| 428 | - echo '<input name="rpg_settingsg[list_sub_forums_as_column]" id="rpg_settingsg[list_sub_forums_as_column]" type="checkbox" value="1" class="code" ' . checked( 1,$item1, false ) . ' />' ; | |
| 429 | - _e ('List Sub-forums in column', 'bbp-private-groups' ); | |
| 430 | - } | |
| 431 | 437 | function activate_hide_counts_checkbox() { |
| 432 | 438 | global $rpg_settingsg ; |
| 433 | - $item1 = (!empty( $rpg_settingsg['hide_counts'] ) ? $rpg_settingsg['hide_counts'] : ''); | |
| 434 | - //$item1 = $rpg_settingsg['hide_counts'] ; | |
| 435 | - echo '<input name="rpg_settingsg[hide_counts]" id="rpg_settingsg[hide_counts]" type="checkbox" value="1" class="code" ' . checked( 1,$item1, false ) . ' />' ; | |
| 436 | - _e ('Hide topic and reply counts', 'bbp-private-groups' ); | |
| 439 | + $item1 = $rpg_settingsg['hide_counts'] ; | |
| 440 | + 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'; | |
| 437 | 441 | } |
| 438 | 442 | function activate_descriptions_checkbox() { |
| 439 | 443 | global $rpg_settingsg ; |
| 440 | - $item2 = (!empty( $rpg_settingsg['activate_descriptions'] ) ? $rpg_settingsg['activate_descriptions'] : ''); | |
| 441 | - //$item2 = $rpg_settingsg['activate_descriptions'] ; | |
| 442 | - echo '<input name="rpg_settingsg[activate_descriptions]" id="rpg_settingsg[activate_descriptions]" type="checkbox" value="1" class="code" ' . checked( 1,$item2, false ) . ' />' ; | |
| 443 | - _e ('Show sub-forum content (Descriptions) on main index - sub-forums will display in columns' , 'bbp-private-groups' ); | |
| 444 | + $item2 = $rpg_settingsg['activate_descriptions'] ; | |
| 445 | + 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'; | |
| 444 | 446 | } |
| 445 | 447 | function activate_private_prefix_checkbox() { |
| 446 | 448 | global $rpg_settingsg ; |
| 447 | - $item3 = (!empty( $rpg_settingsg['activate_remove_private_prefix'] ) ? $rpg_settingsg['activate_remove_private_prefix'] : ''); | |
| 448 | - //$item3 = $rpg_settingsg['activate_remove_private_prefix'] ; | |
| 449 | - 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 ) . ' />' ; | |
| 450 | - _e ('Remove Private prefix' , 'bbp-private-groups' ); | |
| 449 | + $item3 = $rpg_settingsg['activate_remove_private_prefix'] ; | |
| 450 | + 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'; | |
| 451 | 451 | } |
| 452 | 452 | function activate_new_group() { |
| 453 | 453 | global $rpg_groups ; |
| 454 | - $item6 = (!empty( $rpg_groups['activate_new_group'] ) ? $rpg_groups['activate_new_group'] : ''); | |
| 455 | - echo '<input name="rpg_groups[activate_new_group]" id="rpg_groups[activate_new_group]" type="checkbox" value="1" class="code" />' ; | |
| 456 | - _e ('Click and then press "save groups" to add a new group' , 'bbp-private-groups' ) ; | |
| 454 | + $item6 = $rpg_groups['activate_new_group'] ; | |
| 455 | + 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' ; | |
| 457 | 456 | } |