WordPress.org

Support

Support » Plugins and Hacks » Flamingo » [Resolved] Using the flamingo_map_meta_cap filter

[Resolved] Using the flamingo_map_meta_cap filter

  • I am attempting to allow editors to see the Flamingo posts. I have tried putting the following into a plugin:

    $fl_meta_caps = array(
        'flamingo_edit_contacts' => 'delete_page',
        'flamingo_edit_contact' => 'delete_page',
        'flamingo_delete_contact' => 'delete_page',
        'flamingo_edit_inbound_messages' => 'delete_page',
        'flamingo_delete_inbound_message' => 'delete_page',
        'flamingo_delete_inbound_messages' => 'delete_page',
        'flamingo_spam_inbound_message' => 'delete_page',
        'flamingo_unspam_inbound_message' => 'delete_page' );
    
    add_filter('flamingo_map_meta_cap', $fl_meta_caps);

    and it ends up giving the editor rights to admin-level capabilities.

    I have seen the example for specific users., but I would like to allow all editors this ability, but not authors.

    http://wordpress.org/plugins/flamingo/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takayuki Miyoshi

    @takayukister

    You are incorrectly using add_filter(). See http://codex.wordpress.org/Function_Reference/add_filter

    I had actually tried returning it via a function, but when that didn’t work I tried a couple more things. It is either the filters or map_meta_cap that I do not understand.

    It appears that the filter only needs an array returned, but I must be wrong.

    This function simply removes flamingo from all users capabilities.

    function fl_map_meta_cap($meta_caps){
    	$meta_caps = array(
    		'flamingo_edit_contacts' => 'delete_page',
    		'flamingo_edit_contact' => 'delete_page',
    		'flamingo_delete_contact' => 'delete_page',
    		'flamingo_edit_inbound_messages' => 'delete_page',
    		'flamingo_delete_inbound_message' => 'delete_page',
    		'flamingo_delete_inbound_messages' => 'delete_page',
    		'flamingo_spam_inbound_message' => 'delete_page',
    		'flamingo_unspam_inbound_message' => 'delete_page');
    
    	return $meta_caps;
    }
    add_filter('flamingo_map_meta_cap', 'fl_map_meta_cap');

    Resolved. I needed to change ‘delete_page’ to ‘delete_pages’

    function fl_map_meta_cap($meta_caps){
    	$meta_caps = array(
    		'flamingo_edit_contacts' => 'delete_pages',
    		'flamingo_edit_contact' => 'delete_pages',
    		'flamingo_delete_contact' => 'delete_pages',
    		'flamingo_edit_inbound_messages' => 'delete_pages',
    		'flamingo_delete_inbound_message' => 'delete_pages',
    		'flamingo_delete_inbound_messages' => 'delete_pages',
    		'flamingo_spam_inbound_message' => 'delete_pages',
    		'flamingo_unspam_inbound_message' => 'delete_pages');
    
    	return $meta_caps;
    }
    add_filter('flamingo_map_meta_cap', 'fl_map_meta_cap');

    Thank you Takayuki Miyoshi.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Using the flamingo_map_meta_cap filter’ is closed to new replies.
Skip to toolbar