How to hide a plugin metabox for non admins when a user adds a new post

I’ve been able to disable all the meta boxes for non admin in their backend but I’m having problems with Facebook AWD All in one which creates a widget seen by all the users when they create new posts.
How can I disable it? Is there some sort of command that is good for any widget created by plugins that I can add in my functions.php if I know the shortcode of the plugin?
I need your help!
Thanks…

http://wordpress.org/extend/plugins/facebook-awd/

Read More

I use the following code to remove meta boxes

######################################################################
# remove evreything from add a new post
######################################################################
if (is_admin()) :
function remove_post_meta_boxes() {
 if(!current_user_can('administrator')) {
  remove_meta_box('tagsdiv-post_tag', 'post', 'normal');
//remove_meta_box('categorydiv', 'post', 'normal');
  remove_meta_box('postimagediv', 'post', 'normal');
  remove_meta_box('authordiv', 'post', 'normal');
  remove_meta_box('postexcerpt', 'post', 'normal');
  remove_meta_box('trackbacksdiv', 'post', 'normal');
  remove_meta_box('commentstatusdiv', 'post', 'normal');
  remove_meta_box('postcustom', 'post', 'normal');
  remove_meta_box('commentstatusdiv', 'post', 'normal');
  remove_meta_box('commentsdiv', 'post', 'normal');
  remove_meta_box('revisionsdiv', 'post', 'normal');
  remove_meta_box('authordiv', 'post', 'normal');
  remove_meta_box('slugdiv', 'post', 'normal');
 }
}

add_action( 'admin_menu', 'remove_post_meta_boxes' );
endif;

This is the code of the metabox

Facebook AWD Manager

    <div class="AWD_facebook_wrap">

        <h2>Like Button</h2>
            <div class="alert alert-info">
                <div class="AWD_facebook_likebutton"><div class="fb-like" data-href="http://www.dogsheaven.net/?p=703" data-send="0" data-layout="standard" data-width="250" data-show-faces="0" data-action="like" data-colorscheme="light" data-font="arial" data-ref=""></div></div>
            </div>
        <div class="row">

    <div class="span3">
        <label for="awd_fcbk_option_like_button_redefine">Redefine globals settings ?</label>
        <select id="awd_fcbk_option_like_button_redefine" name="awd_fcbk_option_like_button[redefine]" class="span3" >
        <option value="0" selected="selected" >No</option><option value="1"  >Yes</option>
        </select> 
    </div>

    <div class="span3">
        <label for="awd_fcbk_option_like_button_enabled">Activate ?</label>
        <select id="awd_fcbk_option_like_button_enabled" name="awd_fcbk_option_like_button[enabled]" class="span3" >
        <option value="0"  >No</option><option value="1" selected="selected" >Yes</option>
        </select> 
    </div>

    <div class="span3">
        <label for="awd_fcbk_option_like_button_place">Where ?</label>
        <select id="awd_fcbk_option_like_button_place" name="awd_fcbk_option_like_button[place]" class="span3" >
        <option value="top" selected="selected" >Top</option><option value="bottom"  >Bottom</option><option value="both"  >Both</option>
        </select> 
    </div>
        </div>
    </div></div>

Related posts

Leave a Reply

1 comment

  1. You can try to add this line to your code example for the admin_menu filter:

    remove_meta_box('awd_fcbk_awd_mini_form_metabox', 'post', 'side');
    

    where awd_fcbk is the plugin slug.

    Edit:

    This is the metabox that I’m targeting from the plugin source code:

    //Like button manager on post page type
                add_meta_box($this->plugin_slug . "_awd_mini_form_metabox", __('Facebook AWD Manager', $this->ptd) . ' <img style="vertical-align:middle;" style="vertical-align:middle;" src="' . $this->plugin_url_images . 'facebook-mini.png" alt="facebook logo"/>', array(&$this, 'post_manager_content'), $type, 'side', 'core');