PluginProbe
wpForo Forum / 1.4.2
wpForo Forum v1.4.2
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 1.4.2 All 137 releases
wpforo / wpf-admin / usergroup.php

usergroup.php in wpForo Forum 1.4.2, at wpf-admin/usergroup.php

188 lines 12.3 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 <div id="wpf-admin-wrap" class="wrap"><div id="icon-users" class="icon32"><br /></div>
8 <h2 style="padding:30px 0px 10px 0px;line-height: 20px;"><?php _e( 'Usergroups', 'wpforo') ?> <a href="<?php echo admin_url( 'admin.php?page=wpforo-usergroups&action=add' ) ?>" class="add-new-h2"><?php _e( 'Add New', 'wpforo') ?></a></h2>
9 <?php $wpforo->notice->show(FALSE) ?>
10
11 <!-- ############################################################### Usergroup Main Form -->
12
13 <?php if( !isset($_GET['action']) || ( $_GET['action'] != 'add' && $_GET['action'] != 'del' && $_GET['action'] != 'edit') ) : ?>
14 <br/>
15 <table id="usergroup_table" class="wp-list-table widefat fixed posts" cellspacing="0">
16 <thead>
17 <tr>
18 <th width="130" scope="col" id="id" class="manage-column column-title" style="padding:10px; font-size:14px; padding-left:15px; font-weight:bold;"><span><?php _e( 'Usergroup id', 'wpforo') ?></span></th>
19 <th scope="col" id="title" class="manage-column column-title" style="padding:10px; font-size:14px; padding-left:15px; font-weight:bold;"><span><?php _e( 'Usergroup Name', 'wpforo') ?></span></th>
20 <th scope="col" id="count" class="manage-column column-title" style="padding:10px; font-size:14px; padding-left:15px; font-weight:bold;"><span><?php _e( 'Users Count', 'wpforo') ?></span></th>
21 <th scope="col" id="default" class="manage-column column-title" style="padding:10px; font-size:14px; padding-left:15px; font-weight:bold;"><span><?php _e( 'New Users Default Group', 'wpforo') ?></span></th>
22 </tr>
23 </thead>
24 <tbody id="the-list">
25 <?php $ugroups = $wpforo->usergroup->usergroup_list_data(); ?>
26 <?php foreach( $ugroups as $key => $ugroup ) : ?>
27 <?php $bgcolor = ( $key % 2 ) ? '#FFFFFF' : '#FCFCFC' ; ?>
28 <tr id="usergroup-<?php echo intval($ugroup['groupid']) ?>" class="format-standard hentry alternate iedit" valign="top">
29 <td class="post-title page-title column-title" style="border-bottom:1px dotted #CCCCCC; vertical-align:middle; padding-left:20px; background:<?php echo esc_html($bgcolor) ?>;">
30 <strong><?php echo $ugroup['groupid'] ?></strong>
31 <div class="row-actions">
32 <?php if( $ugroup['groupid'] != 1 ): ?>
33 <span class="edit"><a title="<?php _e( 'Edit this usergroup', 'wpforo') ?>" href="<?php echo admin_url( 'admin.php?page=wpforo-usergroups&gid=' . intval($ugroup['groupid']) . '&action=edit' ) ?>"><?php _e( 'Edit', 'wpforo') ?></a> |</span>
34 <?php if( $ugroup['groupid'] != 4 ): ?><span class="trash"><a class="submitdelete" title="<?php _e( 'Delete this usergroup', 'wpforo') ?>" href="<?php echo admin_url( 'admin.php?page=wpforo-usergroups&gid=' . intval($ugroup['groupid']) . '&action=del' ) ?>"><?php _e( 'Delete', 'wpforo') ?></a> |</span><?php endif; ?>
35 <?php endif; ?>
36 <span class="view"><a title="<?php _e( 'View users list in this usergroup', 'wpforo') ?>" href="<?php echo admin_url( 'admin.php?ids=&page=wpforo-members&s=&action=-1&groupid=' . intval($ugroup['groupid']) . '&paged=1&action2=-1' ) ?>" rel="permalink"><?php _e( 'View', 'wpforo') ?></a></span>
37 </div>
38 </td>
39 <td class="post-title page-title column-title" style="border-bottom:1px dotted #CCCCCC; padding-left:20px; background:<?php echo esc_attr($bgcolor) ?>;">
40 <?php $edit_url = ( $ugroup['groupid'] != 1 ? admin_url( 'admin.php?page=wpforo-usergroups&gid=' . $ugroup['groupid'] . '&action=edit' ) : '#') ?>
41 <strong>
42 <a class="row-title" href="<?php echo esc_url($edit_url) ?>" title="<?php _e( 'Usergroup Name', 'wpforo') ?>">
43 <?php echo esc_html($ugroup['name']) ?>
44 </a>
45 </strong>
46 </td>
47 <td class="column-title" style="border-bottom:1px dotted #CCCCCC; vertical-align:middle; padding-left:20px; background:<?php echo esc_html($bgcolor) ?>;">
48 <strong><a class="row-title" href="<?php echo admin_url( 'admin.php?ids=&page=wpforo-members&s=&action=-1&groupid=' . intval($ugroup['groupid']) . '&paged=1&action2=-1' ) ?>" title="<?php _e( 'Count of users in this usergroup', 'wpforo') ?>"><?php echo intval($ugroup['count']) ?></a></strong>
49 </td>
50 <td class="column-title" style="border-bottom:1px dotted #CCCCCC; vertical-align:middle; padding-left:20px; background:<?php echo esc_html($bgcolor) ?>;">
51 <strong style="color: #00a636">
52 <?php if( $ugroup['groupid'] == $wpforo->usergroup->default_groupid ) :
53 _e( 'is Default', 'wpforo' );
54 else : ?>
55 <a class="row-title" href="<?php echo admin_url('admin.php?page=wpforo-usergroups&default=' . intval($ugroup['groupid'])) ?>" title="<?php _e('DO NOT set this option on higher level user groups !!!', 'wpforo') ?>"><?php _e('Set as Default', 'wpforo') ?></a>
56 <?php endif ?>
57 </strong>
58 </td>
59 </tr>
60 <?php endforeach; ?>
61 </tbody>
62 </table>
63 <?php endif; ?>
64
65 <!-- ############################################################### Usergroup Main Form END -->
66
67 <!-- ############################################################### Add / Edit Usergroup Form -->
68
69 <?php if( isset($_GET['action']) && ( $_GET['action'] == 'add' || $_GET['action'] == 'edit' ) ): ?>
70
71 <div class="wpf-info-bar" style="margin-top:20px;">
72 <div class="form-wrap">
73 <form id="add_ug" action="" method="post">
74 <?php wp_nonce_field( 'wpforo-usergroup-addedit' ); ?>
75 <input type="hidden" name="usergroup[action]" value="<?php echo ( $_GET['action'] == 'add' ? 'add' : 'edit' ) ?>"/>
76 <div style="width:100%; margin-bottom:12px;">
77 <div style="display:block; float:left; padding-right:20px; width:30%; padding-bottom:15px;">
78 <div class="wpf-label-big">
79 <?php _e( 'Usergroup Name', 'wpforo'); if( isset($_GET['gid']) && $_GET['gid'] == 4 ) echo '<span>: ' . __('Guest', 'wpforo') . '</span><br><br>'; ?>
80 <?php
81 if(isset( $_GET['gid'] )){
82 $group = $wpforo->usergroup->get_usergroup($_GET['gid']);
83 $group_name = $group['name'];
84 }else{
85 $group = array();
86 $group_name = '';
87 }
88 ?>
89 </div>
90 <input name="usergroup[name]" <?php echo ( isset($_GET['gid']) && $_GET['gid'] == 4 ) ? 'type="hidden"' : 'type="text"'; ?> value="<?php echo esc_attr($group_name) ?>" required="TRUE" style="background:#FDFDFD; min-width:320px; display:block;"/>
91 </div>
92 <?php if( isset($_GET['gid']) && $_GET['gid'] == 4 ): ?>
93 <input type="hidden" name="usergroup[role]" value="" />
94 <?php else: ?>
95 <div style="display:block; float:left; width:20%; padding-bottom:15px; display:none;">
96 <div class="wpf-label-big"><?php _e('WordPress User Role', 'wpforo') ?></div>
97 <select name="usergroup[role]" style="background:#FDFDFD; display:block;">
98 <?php $selected = (!empty($group) && isset($group['role'])) ? $group['role'] : '' ; ?>
99 <?php wp_dropdown_roles( $selected ); ?>
100 </select>
101 </div>
102 <?php endif; ?>
103 <?php if( !isset( $_GET['gid'] ) ): ?>
104 <div style="display:block; float:left; width:40%;">
105 <div class="wpf-label-big"><?php _e('Default Forum Access', 'wpforo') ?></div>
106 <select name="usergroup[access]" style="background:#FDFDFD; display:block;">
107 <?php $accesses = $wpforo->perm->get_accesses(); ?>
108 <?php foreach( $accesses as $accesse ): ?>
109 <option value="<?php echo esc_attr($accesse['access']) ?>" <?php if( $accesse['access'] == 'standard' ) echo ' selected="selected"'; ?>><?php echo esc_html($accesse['title']) ?></option>
110 <?php endforeach ?>
111 </select>
112 <div class="wpf-info" style="line-height:17px; display:block; margin-top:6px;">
113 <?php _e('This is only used when a new Usergroup is created, it automatically gets the selected Forum Access in all forums.', 'wpforo') ?>
114 </div>
115 </div>
116 <?php endif; ?>
117 <div style="clear:both;"></div>
118 </div>
119
120 <?php $cans = $wpforo->perm->usergroup_cans_form( ( isset($_GET['gid'] ) ? $_GET['gid'] : FALSE ) ); ?>
121 <?php $n = 0; foreach( $cans as $can => $data ) : ?>
122 <?php if( $n%4 == 0 ): ?>
123 </table>
124 <table class="wpf-table-box-left" style="margin-right:15px; margin-bottom:15px; min-width:320px;">
125 <?php endif; ?>
126 <tr>
127 <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>
128 <td class="wpf-dw-td-value"><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>
129 </tr>
130 <?php $n++; endforeach; ?>
131 </table>
132 <div class="clear"></div>
133 <input type="submit" class="button button-primary forum_submit" value="<?php echo ( $_GET['action'] == 'add' ? __( 'add', 'wpforo') : __( 'save', 'wpforo') ); ?>">
134 </form>
135 </div>
136 </div>
137
138
139 <?php endif; ?>
140 <!-- ############################################################### END of Add / Edit Usergroup -->
141
142 <!-- ############################################################### DELETE Usergroup -->
143 <?php if( isset($_GET['action']) && $_GET['action'] == 'del') : ?>
144 <form action="" method="post">
145 <?php wp_nonce_field( 'wpforo-usergroup-delete' ); ?>
146 <input type="hidden" name="wpforo_delete" value="1"/>
147 <div class="form-wrap">
148 <div class="form-field form-required">
149 <div class="form-field">
150 <table>
151 <tr>
152 <td>
153 <label for="delete_ug" class="menu_delete" style="color: red;">
154 <?php _e( 'Delete Chosen Usergroup And Users', 'wpforo') ?>
155 </label>
156 </td>
157 <td width="20px">
158 <input id="delete_ug" type="radio" name="usergroup[delete]" value="1" onchange="mode_changer_ug('false');"/>
159 </td>
160 </tr>
161 <tr>
162 <td>
163 <label for="marge">
164 <?php _e( 'Delete Chosen Usergroup And Join Users To Other Usergroup', 'wpforo') ?>
165 </label>
166 </td>
167 <td>
168 <input id="marge" type="radio" name="usergroup[delete]" value="0" checked="" onchange="mode_changer_ug('true');"/>
169 </td>
170 </tr>
171 <tr>
172 <td>
173 <select id="ug_select" name="usergroup[mergeid]" class="postform" >
174 <?php $wpforo->usergroup->show_selectbox() ?>
175 </select>
176 <p><?php _e( 'Users will be join this usergroup', 'wpforo') ?></p>
177 </td>
178 </tr>
179 </table>
180 </div>
181 <input id="ug_submit" type="submit" name="usergroup[submit]" class="button button-primary forum_submit" value="<?php _e( 'Delete', 'wpforo') ?>" />
182 </div>
183 </div>
184 </form>
185 <?php endif; ?>
186 <!-- ############################################################### DELETE Usergroup -->
187
188