View Categories

How Gravity Forms Integration Works

GravityOps Forum is built on top of Gravity Forms, leveraging its powerful form creation and entry management capabilities to power a full-featured forum. This integration ensures a robust and familiar environment for developers and users.

The Gravity Forms Engine #

The plugin uses Gravity Forms to handle the submission and storage of all forum content.

  • Topic Submission: When a user creates a new topic, they are submitting a standard Gravity Form configured as a “Topic Form.”
  • Reply Submission: When a user posts a reply, they are submitting a standard Gravity Form configured as a “Reply Form.”
  • Login & Registration: The plugin utilizes mapped Gravity Forms to handle WordPress authentication and user creation.
  • Data Storage: Every topic and reply is a standard Gravity Forms entry.

Mapping and Logic #

The core logic of the plugin is centered on mapping:

  1. Form Assignment: In the Forms tab of the plugin settings, you assign specific Gravity Forms to serve as “Topics” and “Replies.” You can assign these globally or on a per-forum basis.
  2. Field Mapping: For each assigned form, you tell the plugin which fields correspond to forum data:
    • Topic Form Mapping: Maps fields for the Topic Title, Topic Content, Topic Tags, and optional Additional Fields.
    • Reply Form Mapping: Maps fields for the Reply Content and optional Additional Fields.
    • Login & Registration Mapping: Maps fields to WordPress credentials and user profile data (Email, Password, Nickname, etc.).

Entry Meta and Organization #

To organize these entries into a cohesive forum, the plugin uses Gravity Forms Entry Meta. When a form is submitted, the plugin automatically attaches the following metadata to the entry:

  • gofrm_is_topic: Identifies an entry as a forum topic.
  • gofrm_is_post: Identifies an entry as a forum reply.
  • gofrm_forum_id: The ID of the forum where the topic or reply was posted.
  • gofrm_topic_id: (For replies) The ID of the parent topic entry.
  • gofrm_tag: (For topics) Stores the tags assigned to the topic from the mapped field.
  • Reply totals are calculated dynamically from active reply entries at query/render time.
  • gofrm_last_post_at: (For topics) The MySQL timestamp of the most recent activity (topic creation or last reply).
  • gofrm_is_sticky: (For topics) Indicates if the topic is pinned to the top.
  • gofrm_is_locked: (For topics) Indicates if further replies are disallowed.
  • gofrm_locked_by_moderator: (For topics) Indicates if the topic was locked specifically by a moderator.
  • gofrm_view_count: (For topics) Stores the number of times the topic has been viewed.

Benefits of This Integration #

  • Customization: You can add any custom fields (e.g., “Category,” “Priority,” “Attachments”) to your Topic and Reply forms using the standard Gravity Forms editor.
  • Validation and Processing: All standard Gravity Forms features, such as conditional logic, validation rules, and notifications, work seamlessly with your forum.
  • Data Portability: Since forum content consists of standard entries, you can use existing Gravity Forms add-ons and tools (like GravityView or entry export) to interact with your forum data.