zartgesotten
8/3/2017 - 9:45 AM

Change rights for gravity forms administration, enable author to export or edit forms

Change rights for gravity forms administration, enable author to export or edit forms

<?php 
// get role by name (change 'editor' to a role)
$role = get_role( 'editor' );
// or get user by user ID (change $id to an id)
// $role = new WP_User( $id );
// or get user by username (change $name to a username)
// $role = new WP_User( null, '$name' );

// add core gravity form capabilities
// adjust as required
$role->add_cap( 'gravityforms_edit_forms' );
$role->add_cap( 'gravityforms_delete_forms' );
$role->add_cap( 'gravityforms_create_form' );
$role->add_cap( 'gravityforms_view_entries' );
$role->add_cap( 'gravityforms_edit_entries' );
$role->add_cap( 'gravityforms_delete_entries' );
$role->add_cap( 'gravityforms_view_settings' );
$role->add_cap( 'gravityforms_edit_settings' );
$role->add_cap( 'gravityforms_export_entries' );
$role->add_cap( 'gravityforms_view_entry_notes' );
$role->add_cap( 'gravityforms_edit_entry_notes' );
// $role->add_cap( 'gravityforms_feed' );
// $role->add_cap( 'gravityforms_uninstall' );

// gravity form add-on capabilities
// Campaign Monitor
// $role->add_cap( 'gravityforms_campaignmonitor' );
// $role->add_cap( 'gravityforms_campaignmonitor_uninstall' );

// Freshbooks
// $role->add_cap( 'gravityforms_freshbooks' );
// $role->add_cap( 'gravityforms_freshbooks_uninstall' );

// MailChimp
// $role->add_cap( 'gravityforms_mailchimp' );
// $role->add_cap( 'gravityforms_mailchimp_uninstall' );

// PayPal
// $role->add_cap( 'gravityforms_paypal' );
// $role->add_cap( 'gravityforms_paypal_uninstall' );

// User Registration
// $role->add_cap( 'gravityforms_user_registration' );
// $role->add_cap( 'gravityforms_user_registration_uninstall' );
?>