| 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 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( 'Usergroup Name', 'wpforo') ?></span></th> |
| 19 |
<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( 'Users Count', 'wpforo') ?></span></th> |
| 20 |
</tr> |
| 21 |
</thead> |
| 22 |
<tbody id="the-list"> |
| 23 |
<?php $ugroups = $wpforo->usergroup->usergroup_list_data(); ?> |
| 24 |
<?php foreach( $ugroups as $key => $ugroup ) : ?> |
| 25 |
<?php $bgcolor = ( $key % 2 ) ? '#FFFFFF' : '#FCFCFC' ; ?> |
| 26 |
<tr id="usergroup-<?php echo intval($ugroup['groupid']) ?>" class="format-standard hentry alternate iedit" valign="top"> |
| 27 |
<td class="post-title page-title column-title" style="border-bottom:1px dotted #CCCCCC; padding-left:20px; background:<?php echo esc_attr($bgcolor) ?>;"> |
| 28 |
<?php $edit_url = ( $ugroup['groupid'] != 1 ? admin_url( 'admin.php?page=wpforo-usergroups&gid=' . $ugroup['groupid'] . '&action=edit' ) : '#') ?> |
| 29 |
<strong> |
| 30 |
<a class="row-title" href="<?php echo esc_url($edit_url) ?>" title="<?php _e( 'Usergroup Name', 'wpforo') ?>"> |
| 31 |
<?php echo esc_html($ugroup['name']) ?> |
| 32 |
</a> |
| 33 |
</strong> |
| 34 |
<div class="row-actions"> |
| 35 |
<?php if( $ugroup['groupid'] != 1 ): ?> |
| 36 |
<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> |
| 37 |
<?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; ?> |
| 38 |
<?php endif; ?> |
| 39 |
<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> |
| 40 |
</div> |
| 41 |
</td> |
| 42 |
<td class="column-title" style="border-bottom:1px dotted #CCCCCC; vertical-align:middle; padding-left:20px; background:<?php echo esc_html($bgcolor) ?>;"> |
| 43 |
<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> |
| 44 |
</td> |
| 45 |
</tr> |
| 46 |
<?php endforeach; ?> |
| 47 |
</tbody> |
| 48 |
</table> |
| 49 |
<?php endif; ?> |
| 50 |
|
| 51 |
<!-- ############################################################### Usergroup Main Form END --> |
| 52 |
|
| 53 |
<!-- ############################################################### Add / Edit Usergroup Form --> |
| 54 |
|
| 55 |
<?php if( isset($_GET['action']) && ( $_GET['action'] == 'add' || $_GET['action'] == 'edit' ) ): ?> |
| 56 |
|
| 57 |
<div class="wpf-info-bar"> |
| 58 |
<div class="form-wrap"> |
| 59 |
<form id="add_ug" action="" method="post"> |
| 60 |
<?php wp_nonce_field( 'wpforo-usergroup-addedit' ); ?> |
| 61 |
<input type="hidden" name="usergroup[action]" value="<?php echo ( $_GET['action'] == 'add' ? 'add' : 'edit' ) ?>"/> |
| 62 |
<label class="wpf-label-big"><?php _e( 'Usergroup Name', 'wpforo'); if( isset($_GET['gid']) && $_GET['gid'] == 4 ) echo '<span>: ' . __('Guest', 'wpforo') . '</span><br><br>'; ?> </label> |
| 63 |
<?php |
| 64 |
if(isset( $_GET['gid'] )){ |
| 65 |
$group = $wpforo->usergroup->get_usergroup($_GET['gid']); |
| 66 |
$group_name = $group['name']; |
| 67 |
}else{ |
| 68 |
$group_name = ''; |
| 69 |
} |
| 70 |
?> |
| 71 |
<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; width:30%; min-width:320px; margin:20px 0px; display:block;"/> |
| 72 |
<?php $cans = $wpforo->perm->usergroup_cans_form( ( isset($_GET['gid'] ) ? $_GET['gid'] : FALSE ) ); ?> |
| 73 |
<?php $n = 0; foreach( $cans as $can => $data ) : ?> |
| 74 |
<?php if( $n%4 == 0 ): ?> |
| 75 |
</table> |
| 76 |
<table class="wpf-table-box-left" style="margin-right:15px; margin-bottom:15px; min-width:320px;"> |
| 77 |
<?php endif; ?> |
| 78 |
<tr> |
| 79 |
<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> |
| 80 |
<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> |
| 81 |
</tr> |
| 82 |
<?php $n++; endforeach; ?> |
| 83 |
</table> |
| 84 |
<div class="clear"></div> |
| 85 |
<input type="submit" class="button button-primary forum_submit" value="<?php echo ( $_GET['action'] == 'add' ? __( 'add', 'wpforo') : __( 'save', 'wpforo') ); ?>"> |
| 86 |
</form> |
| 87 |
</div> |
| 88 |
</div> |
| 89 |
|
| 90 |
|
| 91 |
<?php endif; ?> |
| 92 |
<!-- ############################################################### END of Add / Edit Usergroup --> |
| 93 |
|
| 94 |
<!-- ############################################################### DELETE Usergroup --> |
| 95 |
<?php if( isset($_GET['action']) && $_GET['action'] == 'del') : ?> |
| 96 |
<form action="" method="post"> |
| 97 |
<?php wp_nonce_field( 'wpforo-usergroup-delete' ); ?> |
| 98 |
<input type="hidden" name="wpforo_delete" value="1"/> |
| 99 |
<div class="form-wrap"> |
| 100 |
<div class="form-field form-required"> |
| 101 |
<div class="form-field"> |
| 102 |
<table> |
| 103 |
<tr> |
| 104 |
<td> |
| 105 |
<label for="delete_ug" class="menu_delete" style="color: red;"> |
| 106 |
<?php _e( 'Delete Chosen Usergroup And Users', 'wpforo') ?> |
| 107 |
</label> |
| 108 |
</td> |
| 109 |
<td width="20px"> |
| 110 |
<input id="delete_ug" type="radio" name="usergroup[delete]" value="1" onchange="mode_changer_ug('false');"/> |
| 111 |
</td> |
| 112 |
</tr> |
| 113 |
<tr> |
| 114 |
<td> |
| 115 |
<label for="marge"> |
| 116 |
<?php _e( 'Delete Chosen Usergroup And Join Users To Other Usergroup', 'wpforo') ?> |
| 117 |
</label> |
| 118 |
</td> |
| 119 |
<td> |
| 120 |
<input id="marge" type="radio" name="usergroup[delete]" value="0" checked="" onchange="mode_changer_ug('true');"/> |
| 121 |
</td> |
| 122 |
</tr> |
| 123 |
<tr> |
| 124 |
<td> |
| 125 |
<select id="ug_select" name="usergroup[mergeid]" class="postform" > |
| 126 |
<?php $wpforo->usergroup->show_selectbox() ?> |
| 127 |
</select> |
| 128 |
<p><?php _e( 'Users will be join this usergroup', 'wpforo') ?></p> |
| 129 |
</td> |
| 130 |
</tr> |
| 131 |
</table> |
| 132 |
</div> |
| 133 |
<input id="ug_submit" type="submit" name="usergroup[submit]" class="button button-primary forum_submit" value="<?php _e( 'Delete', 'wpforo') ?>" /> |
| 134 |
</div> |
| 135 |
</div> |
| 136 |
</form> |
| 137 |
<?php endif; ?> |
| 138 |
<!-- ############################################################### DELETE Usergroup --> |
| 139 |
|
| 140 |
|