Hi
I have made a plugin for a custom post type. The registered user (custom role) introduces the custom-post features through a form appearing in his admin dashboard, contained in a specific dashboard widget. I have customized the dashboard admin bar y menu, according to the role.
I gave “read” capabilities to the role. Hence, the user can edit his custom posts, as well as read the other users’ posts.
Everything is fine, but the “Add new” submenu. User can create a new custom post from such submenu, whilst I want them to introduce the data in the dashboard widget I created, instead. Both “Add” and “Edit” submenus are created when user has “read” capabilities.
I need to remove the “Add new” submenu, whilst keeping the rest unchanged.
I have reviewed several options, but none seems to fit my case, since I have a custom post.
I will appreciate any help!!!
Cheers,
Angel
Thanks!!. I will review your code.
Actually I had found a solution, removing completely the edit-add menu for the custom post and creating another menu for the edit only. It works. I hided the add-new h2 button also.
The code I wrote is (sorry for the Spanish!):
add_action( 'admin_menu', 'remove_menu_ofertas' ); // Quita todo el menu ofertas
function remove_menu_ofertas() {
remove_menu_page('edit.php?post_type=oferta');
}
add_action('admin_menu', 'edit_oferta_menu_page'); // Añade un menu que permite editar la oferta
function edit_oferta_menu_page() {
add_menu_page('edit oferta menu title', 'Edit oferta', 'edit_ofertas', 'edit.php?post_type=oferta&author=6', '', 0);
}
function hide_buttons() // Esconde la opcion de addnew en Editar oferta
{
global $current_screen;
echo '<style>.add-new-h2{display: none;}</style>';
}
add_action('admin_head','hide_buttons');
This solution seems to work properly. Thanks again!
The dashboard language is personalized according to each’ user preferences, as I wrote previously, using a plugin I made.
Angel
--
See the group blog at http://mwug.info
You received this message because you are subscribed to the Google
Groups "Manchester WordPress User Group" group.
To post to this group, send email to
manchester-word...@googlegroups.com
To unsubscribe from this group, send email to
manchester-wordpress-...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/manchester-wordpress-user-group
Hi Mike
I tried to follow your code, but after removing the “Add new” menu I can’t reach the edit menu: “You do not have sufficient permissions to access this page”
De: manchester-word...@googlegroups.com
[mailto:manchester-word...@googlegroups.com]
En nombre de Mike Little
Enviado el: 26 November 2012 17:24
Para: manchester-word...@googlegroups.com
Asunto: Re: [MWUG] removing
dashboard submenu in custom posts
On 17 November 2012 08:38, Angel Utset <angel...@gmail.com> wrote:
--
Hi Mike
I tried to follow your code, but after removing the “Add new” menu I can’t reach the edit menu: “You do not have sufficient permissions to access this page”