wordpressgravity-forms-plugingravityforms

Despite separate GF Entry tables, are Entry IDs still unique in Gravity Forms


In a multisite installation using Gravity Forms, how are entry IDs managed by GFAPI? Are existing IDs reused or is there a mechanism in place to prevent overwriting? I understand that gf_entry tables are separated by site ID, eliminating potential conflicts, but I'm wondering if GFAPI has any safeguards to ensure unique IDs.

This question stems from when while comparing entries in the wp_gf_entry and wp_3_gf_entry tables, I noticed that the IDs seem to be unique between the two tables, this of course leads me to believe that IDs aren't reused. But I cannot be sure as I was not able to find documentation alluding to this fact.


Solution

  • No, there isn't a universal shared Entry ID across tables in a multi-site installation.

    When a new entry is created, the GFAPI generates a unique entry ID for it in that specific site's gf_entry table. With this in mind, it means that each site's entry ID could be the same across different sites within the multisite network.

    The best way to work with entries from different sites within a multisite network, while ensuring absolute uniqueness of IDs, is to use a combination of the site ID and entry ID. This combination can provide a unique identifier for each entry when working across multiple sites in the network.

    Below is an image of a SQL Query and a table below it showing that there are duplicates in the two tables.

    A picture of a SQL Query and a table below it showing that there are duplicates in the two tables