“sufficient permissions” error for admin after duplicating WP database to new install

So you’ve duplicated the tables in the DB, with the new set having the dev_ prefix? In that case, the problem is probably that you have not updated the fields within the duplicated tables that inherit that prefix. For instance, dev_usermeta will now have a meta_key called wp_capabilities. This needs to be dev_capabilities. Also, dev_options … Read more

How do I create a post_id column, for admin posts list?

You haven’t set $post_id so there is no reason is should display. If you have debugging enabled as you should when you are working, you would have spotted the error immediately. What you need to do is: add_action( ‘manage_posts_custom_column’, ‘populate_columns’ ); function populate_columns( $column ) { global $post; if ($column == ‘id’){ echo $post->ID; } … Read more

Admin user roles/permissions

The “Contributor” role has very little access to anything on the back end but can created posts. delete_posts edit_posts read http://codex.wordpress.org/Roles_and_Capabilities#Contributor For comparison, an ordinary “Subscriber” has the last of the three, so “Contributor” has only two extra capabilities. I am not quite sure what “access to specific plugins” means exactly but I am nearly … Read more

WordPress Plugin Admin Tab

Here is something I used: add_action( ‘admin_menu’, ‘manage_poll_menu’ ); function manage_poll_menu() { add_menu_page( ‘Manage Polls’, ‘Polls’, ‘manage_polls_cap’, ‘manage_polls’, ‘my_poll_options’, ” ); add_submenu_page( ‘manage_polls’, ‘Add New’, ‘Add New Poll’, ‘manage_polls_cap’, ‘add_new_poll’, ‘my_poll_options’ ); add_submenu_page( ‘manage_polls’, ‘Poll Sections’, ‘Poll Sections’, ‘manage_polls_cap’, ‘poll_sections’, ‘my_poll_options’ ); add_submenu_page( ‘manage_polls’, ‘Add New Poll Section’, ‘Add New Poll Section’, ‘manage_polls_cap’, ‘add_new_poll_section’, ‘my_poll_options’ … Read more

Dynamic WordPress Admin Panel

WordPress admin pages are typically created using add_menu_page() function that takes care of menu entry and calls custom function (provided by you) to generate content of the page. Obviously content of the page is arbitrary and should be easy to modify conditionally, using current_user_can() or other necessary checks.