PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Add a submenu item that shows specific form entries to the WP admin menu?

  1. My client wants to hide most of the functionality of GF for their 'editor' users but give them access to the entries. I was able to restrict access using the Members plugin, and figured out how to add a menu item, but they'd specifically like it to show just entries for a specific form (id=4).

    Here's the code that's working to add a sub-menu to the Media menu that links to all entries. Is there any way to specify a form id in the callback here?

    add_action('admin_menu', 'my_add_pages');
    function my_add_pages(){
    add_submenu_page('upload.php', __("Entries", "gravityforms"), __("Entries", "gravityforms"), "gravityforms_view_entries", "my_gf_entries", array("RGForms", "all_leads_page"));


    Posted 9 years ago on Tuesday August 17, 2010 | Permalink
  2. And, I just found this wasn't completely working - using the drop down to filter the form entries shows an error...

    Posted 9 years ago on Tuesday August 17, 2010 | Permalink
  3. It's not currently possible to restrict entries for a specific form with changing the core Gravity Forms code, which we don't recommend as it makes upgrading problematic. That would require role management capabilities within Gravity Forms itself and that doesn't currently exist. Right now we only restrict by primary functionality.

    Posted 9 years ago on Wednesday August 18, 2010 | Permalink
  4. brasofilo

    I was able to solve this as follows:

    First, created a role basic_contributor with gravityforms_view_entries capability.

    And used this code, see comments.

    add_action( 'admin_head', 'gf_single_form_entries' );
    function gf_single_form_entries()
    	global $pagenow,$submenu;
    	// Remove submenu items Entries and Help
    	unset( $submenu['gf_entries'][0], $submenu['gf_entries'][1] );
    	// Check if correct page and capability
    		'admin.php' != $pagenow
    		or 'gf_entries' != $_GET['page']
    		or !current_user_can( 'basic_contributor' )
    	// If not our Form ID, redirect to it
    	if( $_GET['id'] != 5 )
    		wp_redirect( '/wp-admin/admin.php?page=gf_entries&id=5' );
    	// CSS to hide the Switch dropdown field, Bulk Actions field and button, and Checkbox column
    	<style>#gf_form_toolbar, div.tablenav, th.check-column input {display:none}</style>

    Screenshots: before and after

    Posted 7 years ago on Tuesday November 20, 2012 | Permalink
  5. Thank you for updating this topic.

    Posted 7 years ago on Tuesday November 20, 2012 | Permalink

This topic has been resolved and has been closed to new replies.