WordPress.org

Ready to get started?Download WordPress

Forums

Flamingo
[resolved] Flamigo Roles and Capabilities ? (4 posts)

  1. MarialKa
    Member
    Posted 1 year ago #

    Hi, thanks to share this plugin

    I'm trying to allow author / editor ;-) to view, edit... address book and messages but needs help

    NB: I use contact form 7

    May be, we need to add something in the wp-config php file, isn't? but I don't know what... in fact

    Many thanks in advance

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

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    No, you can't change the capability settings in the wp-config.php like Contact Form 7. Instead try adding this code to your theme's functions.php:

    remove_filter( 'map_meta_cap', 'flamingo_map_meta_cap' );
    add_filter( 'map_meta_cap', 'mycustom_flamingo_map_meta_cap', 9, 4 );
    
    function mycustom_flamingo_map_meta_cap( $caps, $cap, $user_id, $args ) {
        $meta_caps = array(
            'flamingo_edit_contacts' => 'publish_posts',
            'flamingo_edit_contact' => 'publish_posts',
            'flamingo_delete_contact' => 'publish_posts',
            'flamingo_edit_inbound_messages' => 'publish_posts',
            'flamingo_delete_inbound_message' => 'publish_posts',
            'flamingo_delete_inbound_messages' => 'publish_posts',
            'flamingo_spam_inbound_message' => 'publish_posts',
            'flamingo_unspam_inbound_message' => 'publish_posts' );
    
        $caps = array_diff( $caps, array_keys( $meta_caps ) );
    
        if ( isset( $meta_caps[$cap] ) )
            $caps[] = $meta_caps[$cap];
    
        return $caps;
    }
  3. MarialKa
    Member
    Posted 1 year ago #

    Perfect ;-) Many thanks for this quick reply

    it's working with latest version of your plugin, contact form 7 and WP 3.5 for now... in my case

    Really great for my using ;-) thank you

  4. WebRessource
    Member
    Posted 5 months ago #

    Hi Takayuki Miyoshi,

    great plugin ! Really useful.

    if I create a role whose only ability is to see his profile,
    how is it possible to allow this role to view and export messages and emails from Flamingo ?

    Do I write the same code as above in functions.php ?
    I don't understand what represent the parameters 9 and 4 in the function add_filter()...

    Thank you for your answer :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic