Exemple #1
0
function nggallery_admin_roles()
{
    if (isset($_POST['update_cap'])) {
        check_admin_referer('ngg_addroles');
        // now set or remove the capability
        ngg_set_capability($_POST['general'], "NextGEN Gallery overview");
        ngg_set_capability($_POST['tinymce'], "NextGEN Use TinyMCE");
        ngg_set_capability($_POST['add_gallery'], "NextGEN Upload images");
        ngg_set_capability($_POST['manage_gallery'], "NextGEN Manage gallery");
        ngg_set_capability($_POST['manage_others'], "NextGEN Manage others gallery");
        ngg_set_capability($_POST['manage_tags'], "NextGEN Manage tags");
        ngg_set_capability($_POST['edit_album'], "NextGEN Edit album");
        ngg_set_capability($_POST['change_style'], "NextGEN Change style");
        ngg_set_capability($_POST['change_options'], "NextGEN Change options");
        nggGallery::show_message(__('Updated capabilities', "nggallery"));
    }
    ?>
	<div class="wrap">
    <?php 
    screen_icon('nextgen-gallery');
    ?>
	<h2><?php 
    _e('Roles / capabilities', 'nggallery');
    ?>
</h2>
	<p><?php 
    _e('Select the lowest role which should be able to access the following capabilities. NextCellent Gallery supports the standard roles from WordPress.', 'nggallery');
    ?>
 <br />
	   <?php 
    _e('For a more flexible user management you can use the', 'nggallery');
    ?>
 <a href="http://wordpress.org/extend/plugins/capsman/" target="_blank">Capability Manager</a>.</p>
	<form name="addroles" id="addroles" method="POST" accept-charset="utf-8" >
		<?php 
    wp_nonce_field('ngg_addroles');
    ?>
			<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="general"><?php 
    _e('NextCellent Gallery overview', 'nggallery');
    ?>
</label></th>
				<td><select name="general" id="general"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Gallery overview'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="tinymce"><?php 
    _e('Use TinyMCE Button / Add Media', 'nggallery');
    ?>
</label></th>
				<td><select name="tinymce" id="tinymce"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Use TinyMCE'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="add_gallery"><?php 
    _e('Add gallery / Upload images', 'nggallery');
    ?>
</label></th>
				<td><select name="add_gallery" id="add_gallery"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Upload images'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="manage_gallery"><?php 
    _e('Manage gallery', 'nggallery');
    ?>
</label></th>
				<td><select name="manage_gallery" id="manage_gallery"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Manage gallery'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="manage_others"><?php 
    _e('Manage others gallery', 'nggallery');
    ?>
</label></th>
				<td><select name="manage_others" id="manage_others"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Manage others gallery'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="manage_tags"><?php 
    _e('Manage tags', 'nggallery');
    ?>
</label></th>
				<td><select name="manage_tags" id="manage_tags"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Manage tags'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="edit_album"><?php 
    _e('Edit Album', 'nggallery');
    ?>
</label></th>
				<td><select name="edit_album" id="edit_album"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Edit album'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="change_style"><?php 
    _e('Change style', 'nggallery');
    ?>
</label></th>
				<td><select name="change_style" id="change_style"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Change style'));
    ?>
</select></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="change_options"><?php 
    _e('Change options', 'nggallery');
    ?>
</label></th>
				<td><select name="change_options" id="change_options"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Change options'));
    ?>
</select></td>
			</tr>
			</table>
			<div class="submit"><input type="submit" class="button-primary" name= "update_cap" value="<?php 
    _e('Update capabilities', 'nggallery');
    ?>
"/></div>
	</form>
	</div>
<?php 
}
Exemple #2
0
function nggallery_admin_roles()
{
    if (!empty($_POST)) {
        check_admin_referer('ngg_addroles');
        // now set or remove the capability
        ngg_set_capability($_POST['general'], "NextGEN Gallery overview");
        ngg_set_capability($_POST['tinymce'], "NextGEN Use TinyMCE");
        ngg_set_capability($_POST['add_gallery'], "NextGEN Upload images");
        ngg_set_capability($_POST['manage_gallery'], "NextGEN Manage gallery");
        ngg_set_capability($_POST['manage_others'], "NextGEN Manage others gallery");
        ngg_set_capability($_POST['manage_tags'], "NextGEN Manage tags");
        ngg_set_capability($_POST['edit_album'], "NextGEN Edit album");
        ngg_set_capability($_POST['change_style'], "NextGEN Change style");
        ngg_set_capability($_POST['change_options'], "NextGEN Change options");
        ngg_set_capability($_POST['attach_interface'], "NextGEN Attach Interface");
    }
    ?>
	<div class="wrap">
	<p><?php 
    _e('Select the lowest role which should be able to access the following capabilities. NextGEN Gallery supports the standard roles from WordPress.', 'nggallery');
    ?>
 <br />
	   <?php 
    _e('For a more flexible user management you can use the', 'nggallery');
    ?>
 <a href="http://wordpress.org/extend/plugins/capsman/" target="_blank">Capability Manager</a>.</p>
		<?php 
    wp_nonce_field('ngg_addroles');
    ?>
			<table class="form-table">
			<tr valign="top">
				<th scope="row"><?php 
    _e('Main NextGEN Gallery overview', 'nggallery');
    ?>
:</th>
				<td><label for="general"><select name="general" id="general"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Gallery overview'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Use TinyMCE Button / Upload tab', 'nggallery');
    ?>
:</th>
				<td><label for="tinymce"><select name="tinymce" id="tinymce"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Use TinyMCE'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Add gallery / Upload images', 'nggallery');
    ?>
:</th>
				<td><label for="add_gallery"><select name="add_gallery" id="add_gallery"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Upload images'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Manage gallery', 'nggallery');
    ?>
:</th>
				<td><label for="manage_gallery"><select name="manage_gallery" id="manage_gallery"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Manage gallery'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Manage others gallery', 'nggallery');
    ?>
:</th>
				<td><label for="manage_others"><select name="manage_others" id="manage_others"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Manage others gallery'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Manage tags', 'nggallery');
    ?>
:</th>
				<td><label for="manage_tags"><select name="manage_tags" id="manage_tags"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Manage tags'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Edit Album', 'nggallery');
    ?>
:</th>
				<td><label for="edit_album"><select name="edit_album" id="edit_album"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Edit album'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Change style', 'nggallery');
    ?>
:</th>
				<td><label for="change_style"><select name="change_style" id="change_style"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Change style'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('Change options', 'nggallery');
    ?>
:</th>
				<td><label for="change_options"><select name="change_options" id="change_options"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Change options'));
    ?>
</select></label></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
    _e('NextGEN Attach Interface', 'nggallery');
    ?>
:</th>
				<td><label for="attach_interface"><select name="attach_interface" id="attach_interface"><?php 
    wp_dropdown_roles(ngg_get_role('NextGEN Attach Interface'));
    ?>
</select></label></td>
			</tr>
			</table>
	</div>
<?php 
}