• I didn’t like how Flamingo was managed in admin when all I really wanted was a “Submissions” link added to Contact Form 7’s submenu. Here’s some code that fixed that for me, just pop it in your functions.php file or use the Code Snippets plugin.

    add_action( 'admin_menu', '_wp_flamingo_humility', 999 );
    function _wp_flamingo_humility() {
    
      // Only do if Contact Form 7 is active
      if ( !is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) return;
    
      // More descriptive CF7 menu label
      $wpcf7_menu = _get_menu_index_by_slug( 'wpcf7' );
      $GLOBALS['menu'][$wpcf7_menu][0] = __('Forms', 'textdomain');
    
      // Optional: Hide CF7 "Integration" submenu
      remove_submenu_page( 'wpcf7', 'wpcf7-integration' );
    
      // Only do if Flamingo is active
      if ( !is_plugin_active( 'flamingo/flamingo.php' ) ) return;
    
      // Drop default Flamingo admin menu
      remove_menu_page('flamingo');
    
      // Add "Inbound Messages" link to CF7 Menu with better menu label
      add_submenu_page(
        'wpcf7',
        __( 'Flamingo Inbound Messages', 'flamingo' ),
        __( 'Submissions', 'flamingo' ),
        'flamingo_edit_inbound_messages',
        'admin.php?page=flamingo_inbound'
      );
    }
    
    // Fix menu highlighting for Flamingo when moved to CF7 submenu
    add_filter( 'parent_file', '_wp_flamingo_menu_highlight' );
    function _wp_flamingo_menu_highlight( $parent_file ) {
      if (isset($_GET['page']) && $_GET['page'] == 'flamingo_inbound'){
        $GLOBALS['plugin_page'] = 'wpcf7';
        $GLOBALS['submenu_file'] = 'admin.php?page=flamingo_inbound';
      }
    
      return $parent_file;
    }
    
    // Helper function to find admin menu index by slug
    function _get_menu_index_by_slug( $location = '' ) {
      foreach ( $GLOBALS['menu'] as $index => $menu_item ) {
        if ( $location === $menu_item[2] ) {
          return $index;
        }
      }
      return false;
    }

    This is just a *bump* of a tip I posted a few years ago.

  • The topic ‘Better integrate Flamingo’s admin menu with Contact Form 7’ is closed to new replies.