This repository has been archived by the owner on Nov 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
302 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,58 @@ | ||
<!-- Plugin Admin Main Page Template --> | ||
<h1><?php echo __( "WP Sticky Notes Settings: " )?></h1> | ||
<h1 class="wpst-admin-head"><?php echo __( "WP Sticky Notes Settings: " )?></h1> | ||
<br><br><br> | ||
<h2><?php echo __( "Permission Management" )?></h2><hr> | ||
<?php | ||
global $wpdb; | ||
global $role_to_change; | ||
// Get user roles array | ||
$USER_P = get_option( $wpdb->prefix.'user_roles' ); | ||
$groups = get_option( "wpst_allow_user_groups" ); | ||
$everyone = get_option( "wpst_allow_unauthorized" ); | ||
?> | ||
<form name="user-group-choose" action="" method="post"> | ||
<label><?php echo __( "Select user group which can create and see stickers" )?></label><div class="clear h10"></div> | ||
<select name="group[]" multiple > | ||
<?php foreach( $USER_P as $slug => $user_group ): if( $slug == 'administrator' ) continue; ?> | ||
<option <?php echo ( @in_array( $slug, $groups ) ) ? "selected" : ""; ?> value="<?php echo $slug?>"><?php echo $user_group["name"]?></option> | ||
|
||
<form name="group-permissions" action="" method="post"> | ||
<div style="float:left;"> | ||
<label><?php echo __( "Groups" )?></label><div class="clear h10"></div> | ||
<select id="wpst_perm_groups" name="wpst_group"> | ||
<?php foreach( $USER_P as $slug => $user_group ): if( $slug == "administrator" ) continue; ?> | ||
<option <?php echo ( $role_to_change == $slug ) ? "selected" : ""; ?> value="<?php echo $slug?>"><?php echo $user_group["name"]?></option> | ||
<?php endforeach?> | ||
<option value="everyone" <?php echo ( @in_array( "everyone", $groups ) ) ? "selected" : ""; ?> ><?php echo __("Everyone ( Includes unauthorized users )"); ?></option> | ||
<option <?php echo ( $role_to_change == 'everyone' ) ? "selected" : ""; ?> value="everyone"><?php echo __("Unauthorized users"); ?></option> | ||
</select> | ||
<div class="clear h10"></div> | ||
<input type="hidden" name="permissions_submit" value="1"> | ||
</div> | ||
<div style="float:left; margin-left:40px;"> | ||
<label><?php echo __( "Capabilities" )?></label><div class="clear h10"></div> | ||
<?php foreach( $USER_P as $slug => $user_group ): if( $slug == "administrator" ) continue; ?> | ||
<?php | ||
$temp_role = get_role( $slug ); | ||
?> | ||
<select id="<?php echo $slug?>_caps" name="<?php echo $slug?>[]" multiple class="wpst-caps-list hide" > | ||
<option <?php echo ( @array_key_exists( "wpst_read", $temp_role->capabilities ) ) ? "selected" : ""; ?> value="wpst_read"><?php echo __("Read")?></option> | ||
<option <?php echo ( @array_key_exists( "wpst_create", $temp_role->capabilities ) ) ? "selected" : ""; ?> value="wpst_create"><?php echo __("Create")?></option> | ||
<option <?php echo ( @array_key_exists( "wpst_edit", $temp_role->capabilities ) ) ? "selected" : ""; ?> value="wpst_edit"><?php echo __("Edit / Delete")?></option> | ||
</select> | ||
<?php endforeach?> | ||
|
||
<select id="everyone_caps" name="everyone[]" multiple class="wpst-caps-list hide" > | ||
<option <?php echo ( @in_array( "wpst_read", $everyone ) ) ? "selected" : ""; ?> value="wpst_read"><?php echo __("Read")?></option> | ||
<option <?php echo ( @in_array( "wpst_create", $everyone ) ) ? "selected" : ""; ?> value="wpst_create"><?php echo __("Create")?></option> | ||
<option <?php echo ( @in_array( "wpst_edit", $everyone ) ) ? "selected" : ""; ?> value="wpst_edit"><?php echo __("Edit / Delete")?></option> | ||
</select> | ||
</div> | ||
<div class="clear h10"></div> | ||
<span class="description"><?php echo __( "You can also edit permissions by user on <a href='/wp-admin/users.php'>user edit page</a>" )?></span> | ||
<div class="clear h10"></div> | ||
<button class="button action"><?php echo __( "Save" )?></button> | ||
</form> | ||
<div class="clear h30"></div> | ||
<div class="clear h30"></div> | ||
|
||
<script> | ||
( function( $ ) { | ||
$("#wpst_perm_groups").change(function(e) { | ||
$('.wpst-caps-list').hide(); | ||
$("#"+$('#wpst_perm_groups').val()+"_caps").show(); | ||
}); | ||
$("#wpst_perm_groups").change(); | ||
} )( jQuery ); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.