Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
New version 1.7
Browse files Browse the repository at this point in the history
git-svn-id: https://plugins.svn.wordpress.org/frontend-admin-menu/tags/1.7@1164798 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information
studiosweb committed May 21, 2015
0 parents commit ba8dcbc
Show file tree
Hide file tree
Showing 13 changed files with 1,320 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions README.txt
@@ -0,0 +1,74 @@
=== Frontend admin menu ===
Contributors: Alberto Pérez
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UJ7J929GYWKLY
Tags: admin menu, menu frontend, admin menu frontend, manage menu frontend, roles menu, administration menu
Requires at least: 3.4
Tested up to: 4.2.2
Stable tag: 1.7
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

== Description ==

With this plugin you can create menus for administration and assign roles and then display them in the frontend / backend of the website. This plugin greatly streamlines workflow managers

**BASIC OPTIONS**

* **Manage your administration menu links**
Creates a menu by role and assign it to him. After this users can manage everything more agile

* **Hide / Show admin bar**
With this plugin you can enable or disable the top bar WordPress admin

* **Enable admin menu to backend**
You can also hide the menu on the left by default WordPress admin area and display the menu that you have created for each role


== Installation ==

This section describes how to install the plugin and get it working.

1. Uncompress the download package
2. Upload folder including all files the `/wp-content/plugins/` directory
3. Activate the plugin through the 'Plugins' menu in WordPress


== Screenshots ==

1. Manage your menus
2. Assign a menu to each of the roles
3. Admin menu
4. Create a menu of administration for each of the roles
5. If you enable the last option , all users except the administrator can view the corresponding menu in the administration and the original admin menu is hiding.

== Changelog ==

= Version 1.7 =
* Add: Links manage menu in admin page
* Add: Modifications of visibility on mapping menu to roles
* Add: Some traductions
* Fixed: CSS text align of mapping menu to roles table

= Version 1.6 =
* Fixed: Activation hook

= Version 1.5 =
* Fixed: Position admin menu plugin

= Version 1.4 =
* Fixed: JS menu icons arrow

= Version 1.3 =
* Fixed: CSS id frontend-admin-menu

= Version 1.2 =
* Fixed: Hide backend menu items

= Version 1.1 =
* Add: Show menu in backend.
* Add: Hide / Show admin bar in backend.
* Add: Hide backend menu items

= Version 1.0 =
* initial version

95 changes: 95 additions & 0 deletions admin/css/styles.css
@@ -0,0 +1,95 @@
#frontend-admin-menu-backend {
width:100%;
}

#frontend-admin-menu-backend ul {
margin:0;
padding:0;
}

#frontend-admin-menu-backend li {
list-style-type: square;
}

#frontend-admin-menu-backend table {
width:100%;
}

#frontend-admin-menu-backend .wgc-box-2 table td:first-child {
width:15%;
text-align: right;
}

#frontend-admin-menu-backend textarea,
#frontend-admin-menu-backend input[type="text"] {
width:80%;
}

#frontend-admin-menu-backend textarea {
min-height: 100px;
}

#frontend-admin-menu-backend #gs-middle {
width:100%;
float:left;
}
#frontend-admin-menu-backend #gs-middle .container {
float:left;
width:100%;
}

#frontend-admin-menu-backend .wgc-box {
border: 1px solid #dfdfdf;
border-radius: 3px;
margin: 10px 0;
position: relative;
box-shadow: 0 0 10px #f2f2f2;
width: 100%;
float: left;
background: #ffffff;
}

#frontend-admin-menu-backend .wgc-box .header {
height: 28px;
margin: 0px;
padding: 0px 10px;
border-top: 1px solid #fff;
border-bottom: 1px solid #dfdfdf;
font: normal normal bold 12px/29px Arial, serif;
color: #333;
text-shadow: 0px 1px 0px #fff;
text-align: left;
position: relative;
line-height: 28px;
border-radius: 3px 3px 0 0;
background: #f7f7f7;
background: -webkit-linear-gradient(to bottom, #f7f7f7 0%, #e6e6e6 100%);
background: -moz-linear-gradient(to bottom, #f7f7f7 0%, #e6e6e6 100%);
background: -o-linear-gradient(to bottom, #f7f7f7 0%, #e6e6e6 100%);
background: -ms-linear-gradient(to bottom, #f7f7f7 0%, #e6e6e6 100%);
background: linear-gradient(to bottom, #f7f7f7 0%, #e6e6e6 100%);
}

#frontend-admin-menu-backend .wgc-box .header.medium {
height: 38px;
line-height: 38px;
}

#frontend-admin-menu-backend .wgc-box .header h4 {
margin: 0;
padding: 0;
float: left;
font-family: Arial;
font-weight: bold;
font-size: 12px;
line-height: inherit;
color: #333;
text-shadow: 0px 1px 0px #fff;
text-align: left;
}

#frontend-admin-menu-backend .wgc-box-body {
padding: 1%;
float: left;
width: 98%;
}
Binary file added admin/images/frontend_admin_menu-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 126 additions & 0 deletions admin/includes/gs-middle-options-page.php
@@ -0,0 +1,126 @@
<?php
$roles = get_editable_roles();
$menus = frontend_admin_menu_menus();

if( ! empty( $_POST['Submit'] ) && $_POST['Submit'] == 'Save options' ) {

$frontend_admin_menu_status = sanitize_text_field ( isset( $_POST['frontend_admin_menu_status'] ) ? esc_html( trim( $_POST['frontend_admin_menu_status'] ) ) : null );
$frontend_admin_menu_admin_bar = sanitize_text_field ( isset( $_POST['frontend_admin_menu_admin_bar'] ) ? esc_html( trim( $_POST['frontend_admin_menu_admin_bar'] ) ) : null );
$frontend_admin_menu_admin_menu_backend = sanitize_text_field ( isset( $_POST['frontend_admin_menu_admin_menu_backend'] ) ? esc_html( trim( $_POST['frontend_admin_menu_admin_menu_backend'] ) ) : null );

$frontend_admin_menu_mapping = array();
foreach ( $roles as $key => $rol ) {
$frontend_admin_menu_mapping[$key] = sanitize_text_field ( isset( $_POST['frontend_admin_menu_mapping_' . $key] ) ? esc_html( trim( $_POST['frontend_admin_menu_mapping_' . $key] ) ) : null );
update_option( 'frontend_admin_menu_mapping_' . $key, $frontend_admin_menu_mapping[$key]);
}
update_option( 'frontend_admin_menu_status', $frontend_admin_menu_status );
update_option( 'frontend_admin_menu_admin_bar', $frontend_admin_menu_admin_bar );
update_option( 'frontend_admin_menu_admin_menu_backend', $frontend_admin_menu_admin_menu_backend);

print '<div class="updated">';
_e( 'Options saved.' );
print '</div>';

}

$frontend_admin_menu_status = get_option( 'frontend_admin_menu_status' );
$frontend_admin_menu_admin_bar = get_option( 'frontend_admin_menu_admin_bar' );
$frontend_admin_menu_admin_menu_backend = get_option( 'frontend_admin_menu_admin_menu_backend' );


if ( $frontend_admin_menu_status > 0 ) {

$checked_status = "checked";

} else {

$checked_status = false;

}

if ( $frontend_admin_menu_admin_bar > 0 ) {

$checked_admin_bar = "checked";

} else {

$checked_admin_bar = false;

}

if ( $frontend_admin_menu_admin_menu_backend > 0 ) {

$checked_backend_menu = "checked";

} else {

$checked_backend_menu = false;

}
?>

<div class="container">
<form name="frontend_admin_menu_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI'] ); ?>">
<div class="wgc-box wgc-box-1">
<div class="header medium">
<?php _e( '<h4>Basic options</h4>', 'frontend-admin-menu' ); ?>
</div>
<div class="wgc-box-body">
<table>
<tr>
<td><input type="checkbox" name="frontend_admin_menu_status" id="frontend_admin_menu_status" value="1" <?php print $checked_status; ?> /></td>
<td><label for="frontend_admin_menu_status"><?php _e( 'Enabled frontend admin menu? <i>(Remember to mapping a menu to rol)</i>', 'frontend-admin-menu' ); ?></label></td>
</tr>
<tr>
<td><input type="checkbox" name="frontend_admin_menu_admin_bar" id="frontend_admin_menu_admin_bar" value="1" <?php print $checked_admin_bar; ?> /></td>
<td><label for="frontend_admin_menu_admin_bar"><?php _e( 'Hide admin bar? <i>(Reload page after save)</i>', 'frontend-admin-menu' ); ?></label></td>
</tr>
<tr>
<td><input type="checkbox" name="frontend_admin_menu_admin_menu_backend" id="frontend_admin_menu_admin_menu_backend" value="1" <?php print $checked_backend_menu; ?> /></td>
<td><label for="frontend_admin_menu_admin_menu_backend"><?php _e( 'Enable admin backend menu to all roles? <i>(This isn´t apply to Administrator)</i>', 'frontend-admin-menu' ); ?></label></td>
</tr>
</table>
</div>
</div>
<div class="wgc-box wgc-box-2">
<div class="header medium">
<?php _e( '<h4>Mapping menu to roles</h4>', 'frontend-admin-menu' ); ?>
( <a href="<?php echo admin_url(); ?>nav-menus.php">Manage your menus</a> - <a href="<?php echo admin_url(); ?>nav-menus.php?action=edit&menu=0">Create new menu</a> )
</div>
<div class="wgc-box-body">
<table>
<?php
$frontend_admin_menu_mapping_option = array();
foreach ( $roles as $key => $rol ) {
$currentmenu = get_option( 'frontend_admin_menu_mapping_' . $key );
print '<tr>';
print '<td>';
print _e( 'Choose a menu to', 'frontend-admin-menu' ).' '.$rol['name'].': ';
print '</td>';
print '<td>';
print '<select name="frontend_admin_menu_mapping_' . $key . '" id="frontend_admin_menu_mapping_' . $key . '">';
print '<option value=""> -- No menu selected -- </option>';
foreach ( $menus as $val => $menu ) {
if ( $currentmenu == $menu->slug) {
$selectedmenu = 'selected';
} else {
$selectedmenu = false;
}
print '<option value="' . $menu->slug . '" ' . $selectedmenu . '>' . $menu->name . '</option>';
}
print '</select>';
print '</td>';
print '</tr>';
}
?>
</table>
</div>
</div>
<div class="block">
<p class="submit">
<input type="submit" class="button button-primary" name="Submit" id="Submit" value="<?php _e( 'Save options', 'frontend-admin-menu' ); ?>" />
</p>
</div>
</form>
</div> <!-- container -->

10 changes: 10 additions & 0 deletions admin/options_admin_page.php
@@ -0,0 +1,10 @@
<div class="wrap">
<div id="frontend-admin-menu-backend">
<?php _e( '<h2>Frontend admin menu - Options</h2>', 'frontend-admin-menu' ); ?>
<div id="gs-middle">
<?php require_once( FRONTEND_ADMIN_MENU_DIR . "admin/includes/gs-middle-options-page.php" ); ?>
</div>
</div>
</div>


0 comments on commit ba8dcbc

Please sign in to comment.