mannieschumpert
10/27/2013 - 10:06 PM

When using Gravity Forms on a client project, you might want the client to be able to view and manipulate form entries, without giving them

When using Gravity Forms on a client project, you might want the client to be able to view and manipulate form entries, without giving them administrator access. The user_has_cap filter allows us to add capabilities without changing the role in the database. This gist allows users with the editor role to view and manipulate form entries.

<?php
/**
 * Add Gravity Forms capabilities
 */
add_filter('user_has_cap',
function( $caps ){
	if (! empty( $caps['edit_pages'] ) ) { // user has edit capabilities
		$caps['gravityforms_delete_entries'] = true;
		$caps['gravityforms_edit_entries'] = true;
		$caps['gravityforms_edit_entry_notes'] = true;
		$caps['gravityforms_view_entries'] = true;
		$caps['gravityforms_view_entry_notes'] = true;
        }
	return $caps;
});