Gravity forms access for clients

Taken from Gist: https://gist.github.com/mannieschumpert/7188426

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.

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;
 });

Revisions

Tags:

No comments yet.

Leave a Reply