diff --git a/Gruntfile.js b/Gruntfile.js index f45e4c4..8625d53 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,6 +17,9 @@ module.exports = function ( grunt ) { dist : { files : { 'build/css/post-admin.css' : 'scss/post-admin.scss' + }, + options : { + sourcemap: 'none' } } }, diff --git a/build/css/post-admin.css b/build/css/post-admin.css index fd329a1..cbab9d3 100644 --- a/build/css/post-admin.css +++ b/build/css/post-admin.css @@ -2,4 +2,5 @@ display: block; margin-top: 1em; } -/*# sourceMappingURL=post-admin.css.map */ +.column-editorial-access-manager { + width: 20%; } diff --git a/build/css/post-admin.css.map b/build/css/post-admin.css.map deleted file mode 100644 index b304879..0000000 --- a/build/css/post-admin.css.map +++ /dev/null @@ -1,7 +0,0 @@ -{ -"version": 3, -"mappings": "AACC,yBAAM;EACL,OAAO,EAAE,KAAK;EACd,UAAU,EAAE,GAAG", -"sources": ["../../scss/post-admin.scss"], -"names": [], -"file": "post-admin.css" -} diff --git a/build/css/post-admin.min.css b/build/css/post-admin.min.css index 5ff92d0..042b9cf 100644 --- a/build/css/post-admin.min.css +++ b/build/css/post-admin.min.css @@ -1 +1 @@ -#eam_access_manager label{display:block;margin-top:1em} \ No newline at end of file +#eam_access_manager label{display:block;margin-top:1em}.column-editorial-access-manager{width:20%} \ No newline at end of file diff --git a/classes/class-editorial-access-manager.php b/classes/class-editorial-access-manager.php index 0f5e507..a2e1b00 100644 --- a/classes/class-editorial-access-manager.php +++ b/classes/class-editorial-access-manager.php @@ -20,6 +20,10 @@ public function setup() { add_action( 'save_post', array( $this, 'action_save_post' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'action_admin_enqueue_scripts' ) ); add_filter( 'map_meta_cap', array( $this, 'filter_map_meta_cap' ), 100, 4 ); + add_filter( 'manage_pages_columns', array( $this, 'manage_columns' ) ); + add_action( 'manage_pages_custom_column', array( $this, 'manage_custom_column' ), 10, 2 ); + add_filter( 'manage_posts_columns', array( $this, 'manage_columns' ) ); + add_action( 'manage_posts_custom_column', array( $this, 'manage_custom_column' ), 10, 2 ); } /** @@ -43,7 +47,17 @@ public function load_textdomain() { * @return array */ public function filter_map_meta_cap( $caps, $cap, $user_id, $args ) { - if ( 'edit_post' == $cap || 'publish_posts' == $cap || 'edit_others_posts' == $cap || 'edit_page' == $cap || 'publish_pages' == $cap || 'edit_others_pages' == $cap ) { + $eam_caps = array( + 'edit_page', + 'edit_post', + 'edit_others_pages', + 'edit_others_posts', + 'publish_posts', + 'publish_pages', + 'delete_page', + 'delete_post', + ); + if ( in_array( $cap, $eam_caps ) ) { $post_id = ( isset( $args[0] ) ) ? (int) $args[0] : null; if ( ! $post_id && ! empty( $_GET['post'] ) ) { @@ -102,7 +116,7 @@ public function filter_map_meta_cap( $caps, $cap, $user_id, $args ) { */ public function action_admin_enqueue_scripts( $hook ) { - if ( 'post.php' == $hook || 'post-new.php' == $hook ) { + if ( 'post.php' == $hook || 'post-new.php' == $hook || 'edit.php' == $hook ) { /** * Setup JS stuff */ @@ -188,6 +202,7 @@ public function action_save_post( $post_id ) { * @since 0.1.0 */ public function meta_box_access_manager( $post ) { + global $wp_roles; $post_type_object = get_post_type_object( get_post_type( $post->ID ) ); // By default every user and every role with the edit_others_posts cap can edit this post @@ -262,7 +277,7 @@ public function meta_box_access_manager( $post ) { selected disabled selected > - + roles[ $role_name ]['name'] ) ); ?> @@ -286,6 +301,63 @@ public function meta_box_access_manager( $post ) { ' . __( 'Roles', 'editorial-access-manager' ) . ':
'; + foreach ( $roles as $role ) { + if ( ! empty( $wp_roles->roles[ $role ]['name'] ) ) { + $role_names[] = translate_user_role( $wp_roles->roles[ $role ]['name'] ); + } + } + sort( $role_names ); + echo implode( ', ', $role_names ); + } + if ( 'users' == $eam ) { + $users = get_post_meta( $post_id, 'eam_allowed_users', true ); + $admins = get_users( array( 'role' => 'administrator', 'fields' => 'ID' ) ); + $users = array_merge( $users, $admins ); + $user_names = array(); + echo '' . __( 'Users', 'editorial-access-manager' ) . ':
'; + foreach ( $users as $user ) { + $user_object = get_userdata( $user ); + if ( ! empty( $user_object ) ) { + $user_names[] = $user_object->user_login; + } + } + sort( $user_names ); + echo implode( ', ', $user_names ); + } + } + } + } + /** * Return singleton instance of class * diff --git a/languages/editorial-access-manager-it_IT.mo b/languages/editorial-access-manager-it_IT.mo index 891b372..0c59126 100644 Binary files a/languages/editorial-access-manager-it_IT.mo and b/languages/editorial-access-manager-it_IT.mo differ diff --git a/languages/editorial-access-manager-it_IT.po b/languages/editorial-access-manager-it_IT.po index de73d71..5bdc1a9 100644 --- a/languages/editorial-access-manager-it_IT.po +++ b/languages/editorial-access-manager-it_IT.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: Editorial Access Manager v0.1.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2014-10-03 19:51:57+0000\n" +"PO-Revision-Date: 2014-10-03 23:12:10+0000\n" "Last-Translator: marco-chiesi \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -20,38 +20,45 @@ msgstr "" "X-Poedit-SearchPath-0: .\n" "X-Textdomain-Support: yes" -#: classes/class-editorial-access-manager.php:137 +#: classes/class-editorial-access-manager.php:141 #@ editorial-access-manager msgid "Editorial Access Manager" msgstr "Gestione accesso editoriale" -#: classes/class-editorial-access-manager.php:248 +#: classes/class-editorial-access-manager.php:253 #@ editorial-access-manager msgid "Enable custom access management by" msgstr "Criterio gestione accessi" -#: classes/class-editorial-access-manager.php:250 +#: classes/class-editorial-access-manager.php:255 #@ editorial-access-manager msgid "Off" -msgstr "Disattivata" +msgstr "Nessuno" -#: classes/class-editorial-access-manager.php:251 +#: classes/class-editorial-access-manager.php:256 +#: classes/class-editorial-access-manager.php:323 #@ editorial-access-manager msgid "Roles" msgstr "Ruoli" -#: classes/class-editorial-access-manager.php:252 +#: classes/class-editorial-access-manager.php:257 +#: classes/class-editorial-access-manager.php:337 #@ editorial-access-manager msgid "Users" msgstr "Utenti" -#: classes/class-editorial-access-manager.php:257 +#: classes/class-editorial-access-manager.php:262 #@ editorial-access-manager msgid "Manage access for roles:" msgstr "Gestione accesso ruoli:" -#: classes/class-editorial-access-manager.php:272 +#: classes/class-editorial-access-manager.php:277 #@ editorial-access-manager msgid "Manage access for users:" msgstr "Gestione accesso utenti:" +#: classes/class-editorial-access-manager.php:302 +#@ editorial-access-manager +msgid "Editorial access" +msgstr "Accesso editoriale" + diff --git a/languages/editorial-access-manager.pot b/languages/editorial-access-manager.pot index 20fb1aa..7f99319 100644 --- a/languages/editorial-access-manager.pot +++ b/languages/editorial-access-manager.pot @@ -53,6 +53,10 @@ msgstr "" msgid "Manage access for users:" msgstr "" +#: classes/class-editorial-access-manager.php:302 +msgid "Editorial access" +msgstr "" + #. Author URI of the plugin/theme msgid "http://www.taylorlovett.com" msgstr "" diff --git a/scss/post-admin.scss b/scss/post-admin.scss index af80ddc..ff27307 100644 --- a/scss/post-admin.scss +++ b/scss/post-admin.scss @@ -3,4 +3,8 @@ display: block; margin-top: 1em; } +} + +.column-editorial-access-manager { + width: 20%; } \ No newline at end of file