WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Jun 01 2011

Adding Capabilities to Facebook Tabs Custom Post Type in Facebook Tab Manager

Recently, I needed to make my Facebook Tabs closed to my client. However, the plugin didn't do this, so digging into it, there was one minor change that needed to be made regarding capabilities and capability_type. For a reference, view Justin Tadlock's post, Meta capabilities for custom post types.

Since I use the Members plugin to help me with role management, I only had to make one minor change in the custom post type registration code. Around line 270, fbtab.php registers the Facebook Tab custom post type. To add capabilities and the capability_type delete the create_fbtab_post_type function and use this function instead.

[php]<?php
function create_fbtab_post_type() {
register_post_type( 'fbtab',
array(
'labels' => array(
'name' => __( 'Facebook Tabs' ),
'add_new_item' => __( 'Add New Facebook Tab' ),
'edit_item' => __( 'Edit Facebook Tab' ),
'new_item' => __( 'Facebook Tabs' ),
'singular_name' => __( 'Facebook Tab' )
),
'public' => true,
'exclude_from_search' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'fbtabs',
'capabilities' => array(
'publish_posts' => 'publish_fbtabs',
'edit_posts' => 'edit_fbtabs',
'edit_others_posts' => 'edit_others_fbtabs',
'delete_posts' => 'delete_fbtabs',
'delete_others_posts' => 'delete_others_fbtabs',
'read_private_posts' => 'read_private_fbtabs',
'edit_post' => 'edit_fbtabs',
'delete_post' => 'delete_fbtabs',
'read_post' => 'read_fbtabs',
),
'hierarchical' => true,
'has_archive' => true,
'menu_position' => 5,
'menu_icon' => plugins_url('/facebook.png',__FILE__),
'supports' => array('title','editor')
)
);

}
[/php]

Then I went into my Members plugin role management, created some capabilities based on the capabilities array. Then I locked out certain individuals. Wha la! For those who prefer the code to do this, please refer to Justin Tadlock's post, Meta capabilities for custom post types. It is "most excellent"! (I think I just dated myself!)

Written by Travis Smith · Categorized: WordPress

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in