PluginProbe
wpForo Forum / 1.1.2
wpForo Forum v1.1.2
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
wpforo / wpf-admin / options-tabs / accesses.php

accesses.php in wpForo Forum 1.1.2, at wpf-admin/options-tabs/accesses.php

73 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4 if( !current_user_can('administrator') ) exit;
5 ?>
6
7 <?php if( !isset($_GET['action']) ): ?>
8 <?php $accesses = $wpforo->perm->get_accesses() ?>
9 <h2 style="margin-top:0px; margin-bottom:20px;"><a href="?page=wpforo-settings&tab=accesses&action=add" class="add-new-h2"><?php _e('Add New Forum Access', 'wpforo'); ?></a></h2>
10 <table id="usergroup_table" class="wp-list-table widefat fixed posts" cellspacing="0">
11 <thead>
12 <tr>
13 <th scope="col" id="title" class="manage-column column-title sorted desc" style="padding:10px; font-size:14px; padding-left:15px; font-weight:bold;"><span><?php _e('Access names', 'wpforo'); ?></span></th>
14 </tr>
15 </thead>
16 <tbody id="the-list">
17 <?php foreach($accesses as $key => $access) : ?>
18 <?php $bgcolor = ( $key % 2 ) ? '#FFFFFF' : '#FCFCFC' ; ?>
19 <tr id="post-2" class="post-1 type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" valign="top">
20 <td class="post-title page-title column-title" style="border-bottom:1px dotted #CCCCCC; padding-left:20px; background:<?php echo esc_attr($bgcolor) ?>;">
21 <strong class="row-title">
22 <a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>" title="<?php echo esc_attr($access['title']) ?>">
23 <?php _e( $access['title'], 'wpforo') ?>
24 </a>
25 <p class="wpf-info">
26 <?php if($access['title'] == 'Read only access') { _e('This access is usually used for ', 'wpforo'); echo '<span style="color:#F45B00"><b>'; _e('Guests', 'wpforo'); echo '</b></span> '; _e('usergroup', 'wpforo'); } ?>
27 <?php if($access['title'] == 'Standard access') { _e('This access is usually used for ', 'wpforo'); echo '<span style="color:#F45B00"><b>'; _e('Registered', 'wpforo'); echo '</b></span> '; _e('usergroup', 'wpforo'); } ?>
28 <?php if($access['title'] == 'Full access') { _e('This access is usually used for ', 'wpforo'); echo '<span style="color:#F45B00"><b>'; _e('Admin', 'wpforo'); echo '</b></span> '; _e('usergroup', 'wpforo'); } ?>
29 </p>
30 </strong>
31 <div class="row-actions">
32 <span class="edit"><a href="?page=wpforo-settings&tab=accesses&action=edit&access=<?php echo esc_attr($access['access']) ?>"><?php _e('edit', 'wpforo'); ?></a> |</span>
33 <?php if( $access['accessid'] > 5 ): ?>
34 <span class="trash"><a class="submitdelete" href="<?php echo wp_nonce_url( '?page=wpforo-settings&tab=accesses&action=del&accessid=' . esc_attr($access['accessid']) , 'wpforo_access_delete' ) ?>" onclick = "if (! confirm('<?php _e('Are you sure you want to remove this access set? Usergroups which attached to this access will lost all forum permissions.'); ?>')) { return false; }" ><?php _e('delete', 'wpforo'); ?></a></span>
35 <?php endif; ?>
36 </div>
37 </td>
38 </tr>
39 <?php endforeach ?>
40 </tbody>
41 </table>
42 <?php elseif( isset($_GET['action']) && ( $_GET['action'] == 'edit' || $_GET['action'] == 'add' ) ) : ?>
43 <div class="form-wrap">
44 <div class="form-wrap">
45 <form id="add_access" action="" method="post">
46 <?php wp_nonce_field( 'wpforo-access-addedit' ); ?>
47 <input type="hidden" name="access[action]" value="<?php echo ( $_GET['action'] == 'add' ? 'add' : 'edit' ) ?>" />
48 <input type="hidden" name="access[key]" value="<?php echo ( isset($_GET['access']) ? esc_attr(sanitize_text_field($_GET['access'])) : '' ) ?>" />
49 <label class="wpf-label-big"><?php _e('Access name', 'wpforo'); ?></label>
50 <?php if( isset( $_GET['access'] ) ){ $access = $wpforo->perm->get_access( $_GET['access'] );} ?>
51 <input name="access[name]" type="text" size="40" required="TRUE" value="<?php echo ( $_GET['action'] == 'edit' ? esc_attr($access['title']) : '') ?>" style="background:#FDFDFD; width:30%; min-width:320px;">
52 <p>&nbsp;</p>
53
54 <?php
55 $access_key = ( isset( $_GET['access'] ) ? $_GET['access'] : 0 );
56 $cans = $wpforo->perm->forum_cans_form( $access_key ); ?>
57 <?php $n = 0; foreach( $cans as $can => $data ): ?>
58 <?php if( $n%4 == 0 ): ?>
59 </table>
60 <table class="wpf-table-box-left" style="margin-right:15px; margin-bottom:15px; min-width:320px;">
61 <?php endif; ?>
62 <tr>
63 <th class="wpf-dw-td-nowrap"><label class="wpf-td-label" for="wpf-can-<?php echo esc_attr($can) ?>"><?php echo esc_html( __( $data['name'], 'wpforo' ) ) ?></label></th>
64 <td class="wpf-dw-td-value" style="text-align:center;"><input id="wpf-can-<?php echo esc_attr($can) ?>" type="checkbox" name="cans[<?php echo esc_attr($can) ?>]" value="1" <?php echo ( $data['value'] ) ? 'checked="checked"' : ''; ?>></td>
65 </tr>
66 <?php $n++; endforeach ?>
67 </table>
68 <div class="clear"></div>
69 <input type="submit" class="button button-primary forum_submit" value="<?php echo ( $_GET['action'] == 'add' ? __('Save', 'wpforo') : __('Update', 'wpforo') ) ?>">
70 </form>
71 </div>
72 </div>
73 <?php endif ?>