Title: Plugins for Admins
Last modified: August 19, 2016

---

# Plugins for Admins

 *  [drinkliverpool](https://wordpress.org/support/users/drinkliverpool/)
 * (@drinkliverpool)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/)
 * How can I make a plugin settings tab show only for logged in Admins?

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [ucfknight10](https://wordpress.org/support/users/ucfknight10/)
 * (@ucfknight10)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869088)
 * the link below will give you a function to determine whether a logged in user
   is of admin level or not. if so, the function will return true, otherwise, will
   return false. should be able to figure out from there. if not, let us know.
 * [http://csstyle.pastebin.com/7aMQpRya](http://csstyle.pastebin.com/7aMQpRya)
 *  Thread Starter [drinkliverpool](https://wordpress.org/support/users/drinkliverpool/)
 * (@drinkliverpool)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869094)
 * All my users are Authors as its a personal gallery blog. One of the plugins i
   use is called Q&A plugin([http://wordpress.org/extend/plugins/q-and-a/](http://wordpress.org/extend/plugins/q-and-a/)).
   When _**I**_ log in as an Admin, the FAQ setting tab appears directly under the
   COMMENTS button as it does when an Author logs in.
 * I want this FAQ settings tab to appear for an ADMIN ONLY.
 *  [ucfknight10](https://wordpress.org/support/users/ucfknight10/)
 * (@ucfknight10)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869097)
 * you’ll need to edit the plugin manually. are you familiar with php and the structure
   of a plugin?
 *  Thread Starter [drinkliverpool](https://wordpress.org/support/users/drinkliverpool/)
 * (@drinkliverpool)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869102)
 * To be honest, i’m not too clever with PHP, trying to teach myself with a PHP5
   book I bought but it just goes over my head. I know te VERY basics and that’s
   about it.
 * I would love someone totell me what to change in the files of this plugin. 😉
 *  [ucfknight10](https://wordpress.org/support/users/ucfknight10/)
 * (@ucfknight10)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869105)
 * but if someone tells you what to do, you wont learn, and that’s the whole point
   of the forums 😉
 * that being said.
 * check out this page: [http://codex.wordpress.org/Function_Reference/register_post_type](http://codex.wordpress.org/Function_Reference/register_post_type).
   it’s information about the function register_post_type, which you will see at
   the top of the q-and-a.php file. use the ‘show_in_menu’ and the function provided
   earlier to create a conditional for display the tab.
 * or, you could use a role manager plugin, and create a role specifically for the
   qa post type, and give only admins capabilities to add and edit that post type.
 *  Thread Starter [drinkliverpool](https://wordpress.org/support/users/drinkliverpool/)
 * (@drinkliverpool)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869107)
 * I give up. I just don’t understand it all. I tried messing around with what you
   said (to the limit of my understanding) and I also tried looking for a role manager
   plugin that’d do this but with no luck.
 * I’ll just use a different FAQ plugin where the settings are already admin only.
   Thanks anyway.
 *  [ucfknight10](https://wordpress.org/support/users/ucfknight10/)
 * (@ucfknight10)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869116)
 * oh it is possible to do what you want, i just didnt want to give the answer away
   from the start. we can make it work with this plugin, if you need to use that
   plugin.
 *  Thread Starter [drinkliverpool](https://wordpress.org/support/users/drinkliverpool/)
 * (@drinkliverpool)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869117)
 * I’d rather use that plugin mainly for aesthetic purposes.
 * I’d be eternally grateful if you could help me out and let me know what it is
   ur doing.
 * Pleeeeease
 *  [ucfknight10](https://wordpress.org/support/users/ucfknight10/)
 * (@ucfknight10)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869121)
 * ok. open q-and-a.php, find in the function definition of create_qa_post_types
   the call to function register_post_type. you’ll see an array, with labels ‘labels’,‘
   public’, ‘show_ui’, etc. go to the line starting with ‘supports’ (line 57), and
   add a comma to the end. add a new line, and copy and paste the code below into
   the blank line (now line 58).
 * `'show_in_menu' => (is_admin_login() ? true : false)`
 * when you’re done, the function call should look like this:
 *     ```
       register_post_type( 'qa_faqs',
       		array(
       			'labels' => array(
       				'name' => __( 'FAQs' ),
       				'singular_name' => __( 'FAQ' ),
       				'edit_item'	=>	__( 'Edit FAQ'),
       				'add_new_item'	=>	__( 'Add FAQ')
       			),
       			'public' => true,
       			'show_ui' => true,
       			'capability_type' => 'post',
       			'rewrite' => array( 'slug' => 'faq', 'with_front' => false ),
       			'taxonomies' => array( 'FAQs '),
       			'supports' => array('title','editor'),
       			'show_in_menu' => (is_admin_login() ? true : false)
       		)
       	);
       ```
   
 * make sure you add the function i provided above to the plugin at the top, or 
   in your theme’s functions.php. also note, that if you upgrade the plugin, you
   will have to make this change again (tho it may be different, seeing as how there
   are usually changes to the code when an upgrade is available).
 * hope that helps.
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869122)
 * If you’re going to edit the plugin, then i’d suggest doing it by adjusting the
   required capabilities set in the plugin.
 * First find this…
 *     ```
       function add_qa_option_page() {
       	// hook in the options page function
       	add_options_page('Q and A', 'Q and A', 6, __FILE__, 'qa_options_page');
       }
       ```
   
 * Update that to read..
 *     ```
       function add_qa_option_page() {
       	// hook in the options page function
       	add_options_page('Q and A', 'Q and A', 'manage_options', 'questions-and-answers', 'qa_options_page');
       }
       ```
   
 * ==============================
    YOU ONLY NEED THE ABOVE PART FOR THE SETTINGS
   PAGE ==============================
 * Then find the following…
 *     ```
       //
       	register_post_type( 'qa_faqs',
       		array(
       			'labels' => array(
       				'name' => __( 'FAQs' ),
       				'singular_name' => __( 'FAQ' ),
       				'edit_item'	=>	__( 'Edit FAQ'),
       				'add_new_item'	=>	__( 'Add FAQ')
       			),
       			'public' => true,
       			'show_ui' => true,
       			'capability_type' => 'post',
       			'rewrite' => array( 'slug' => 'faq', 'with_front' => false ),
       			'taxonomies' => array( 'FAQs '),
       			'supports' => array('title','editor')
       		)
       	);
       ```
   
 * Remove this part..
 *     ```
       'capability_type' => 'post',
       ```
   
 * And put this in it’s place..
 *     ```
       'capabilities' => array(
       	'publish_posts' => 'manage_options',
       	'edit_posts' => 'manage_options',
       	'edit_others_posts' => 'manage_options',
       	'delete_posts' => 'manage_options',
       	'delete_others_posts' => 'manage_options',
       	'read_private_posts' => 'manage_options',
       	'edit_post' => 'manage_options',
       	'delete_post' => 'manage_options',
       	'read_post' => 'manage_options',
       ),
       ```
   
 * The plugin will then work only for admins.
 *  Thread Starter [drinkliverpool](https://wordpress.org/support/users/drinkliverpool/)
 * (@drinkliverpool)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869125)
 * Excellent. Both soloutions worked. I have learned from this. 🙂
 *  [ucfknight10](https://wordpress.org/support/users/ucfknight10/)
 * (@ucfknight10)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869128)
 * Mark’s solution is def better. Thanks Mark.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Plugins for Admins’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 12 replies
 * 3 participants
 * Last reply from: [ucfknight10](https://wordpress.org/support/users/ucfknight10/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/plugins-for-admins/#post-1869128)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
