WordPress.org

Ready to get started?Download WordPress

Forums

Flamingo
How to restrict form data access to certain users? (3 posts)

  1. nuroweb
    Member
    Posted 1 year ago #

    Hello,

    I need to install this plugin to capture CF7 data into a databse. WP will have several admin users, but only 2-3 of them should be able to view the form data saved to the DB.

    I read about plugins that add access control features to WP, but they seem very complex to configure. Is there something simpler that can be done?

    Thanks!

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

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    Add this to your theme's functions.php file:

    add_filter( 'flamingo_map_meta_cap', 'your_flamingo_map_meta_cap' );
    
    function your_flamingo_map_meta_cap( $meta_caps ) {
    	$allowed_users = array( 'user1', 'user2', 'user3' );
    
    	if ( ! in_array( wp_get_current_user()->user_login, $allowed_users ) )
    		$meta_caps = array();
    
    	return $meta_caps;
    }

    Edit the $allowed_users = array( 'user1', 'user2', 'user3' ); line as you like.

  3. nuroweb
    Member
    Posted 1 year ago #

    Thanks a lot for the quick response. I'll try that out!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.