Title: ForgePress Country Choice Rules for Gravity Forms
Author: forgepress
Published: <strong>2025 年 9 月 16 日</strong>
Last modified: 2025 年 9 月 16 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/forgepress-country-choice-rules-for-
gravity-forms.svg)

# ForgePress Country Choice Rules for Gravity Forms

 作者：[forgepress](https://profiles.wordpress.org/forgepress/)

[下载](https://downloads.wordpress.org/plugin/forgepress-country-choice-rules-for-gravity-forms.1.3.2.zip)

 * [详情](https://cn.wordpress.org/plugins/forgepress-country-choice-rules-for-gravity-forms/#description)
 * [评价](https://cn.wordpress.org/plugins/forgepress-country-choice-rules-for-gravity-forms/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/forgepress-country-choice-rules-for-gravity-forms/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/forgepress-country-choice-rules-for-gravity-forms/#developers)

 [支持](https://wordpress.org/support/plugin/forgepress-country-choice-rules-for-gravity-forms/)

## 描述

**ForgePress Country Choice Rules for Gravity Forms** lets you define rules that
remove specific **choices** (radio, dropdown, checkbox options) for visitors from
selected countries. This happens **server-side** (secure), and you can configure
a **fallback choice** to auto-select when an option is removed.

### Highlights

 * **Per-country choice blocking** for radio, dropdown, and checkbox fields
 * **Multi-form / multi-field** rules (simple repeater UI)
 * **Fallback choice** (optional) if a blocked option is removed
 * **Server-side filtering** (not just CSS/JS hiding)
 * **Optional VPN/Proxy handling**:
    - _Do nothing_
    - _Show warning_ message
    - _Force a default country_ for rule evaluation
    - _Block submission_ with a custom message
 * **Cloudflare aware** (`CF-IPCountry`) with 1h caching for IP lookups
 * Lightweight and admin-friendly

> This plugin is **not** affiliated with or endorsed by Gravity Forms. It simply
> integrates with Gravity Forms via its standard hooks.

### How it works (in short)

 1. You add rules: **Form ID + Field ID + Choice Text/Value + Countries** (+ optional
    fallback).
 2. On render/validation, the plugin detects the visitor **country**.
 3. If a rule matches, the corresponding **choice(s) are removed** and an optional **
    fallback** is selected.

### External Services & Data Flow (Guideline 6)

This plugin may use third-party services to determine the visitor’s country and (
optionally) detect VPN/Proxy usage.

 * **Cloudflare (if your site is on Cloudflare):**
    We read the `CF-IPCountry` header
   provided by Cloudflare. No outbound request is made by this plugin. Privacy: 
   https://www.cloudflare.com/privacypolicy/
 * **ipapi.co (free)** _(default geolocation when Cloudflare is not present)_:
    
   The plugin requests `https://ipapi.co/{IP}/json/` to map visitor IP  country.**
   Data sent:** visitor IP only. **Retention:** result cached in WordPress for 1
   hour. Privacy: https://ipapi.co/privacy/
 * **Optional VPN/Proxy checks (opt-in by the site admin):**
    - **ipregistry.co** (if an API key is configured):
       **Data sent:** visitor IP
      to check proxy/VPN indicators. Privacy: https://ipregistry.co/privacy
    - **ipapi.com PRO** (if an API key is configured):
       **Data sent:** visitor IP
      with `security=1` to check VPN/Proxy/Tor. Privacy: https://ipapi.com/privacy

No form entries or personal form fields are sent to these providers. Admins can **
disable** optional VPN checks entirely.

**GDPR/Privacy:** Only an IP address may be sent to the selected provider(s) to 
derive country/VPN status. You should disclose this in your site privacy policy 
if enabled.

### Notes on Naming / Trademarks

This is an independent plugin **for** Gravity Forms and is not affiliated with or
endorsed by Gravity Forms. The name and readme make this relationship clear.

### Features in Detail

 * **Rule builder UI** under _Settings  ForgePress Country Choice Rules_
    - Add multiple rows; each row targets a **Form ID + Field ID**, the **choice
      label/value**, and a list of **countries (ISO-2)**.
    - Optionally set a **Fallback choice** to auto-select if the blocked option 
      is removed.
 * **Runtime enforcement**
    - Choices are removed on `gform_pre_render` and validated on `gform_validation`.
    - If a blocked value is posted manually, validation fails with a clear message.
 * **VPN/Proxy handling**
    - Admin can choose: _Do nothing_, _Show warning_, _Force country_, or _Block
      submission_.
    - Works without an API key (heuristics). With a key (ipregistry/ipapi PRO), 
      detection is more accurate.

## 安装

 1. Install and activate **Gravity Forms** first.
 2. Upload the plugin ZIP and activate **ForgePress Country Choice Rules for Gravity
    Forms**.
 3. Go to **Settings  ForgePress Country Choice Rules** to add rules.
 4. (Optional) Configure **VPN/Proxy handling** and provider API key(s).

## 常见问题

### Does this work without JavaScript?

Yes. Filtering is server-side.

### What happens if the user is on a VPN?

By default, geolocation is based on the detected IP, which may reflect the VPN’s
exit node. You can enable **VPN/Proxy handling**: show a warning, force a default
country for rule evaluation, or block the submission. For higher accuracy, add an
API key for _ipregistry_ or _ipapi PRO_.

### How do I find Field IDs and Choice values?

In the Gravity Forms editor, each field shows an **ID**. Choices have **text** and**
value**; match either (the plugin compares case-insensitively).

### Is this compatible with caching?

Yes. Country detection is per-request and cached (IP result for 1 hour). For full-
page caching, ensure your CDN/proxy varies cache by country (or bypass cache on 
form pages) if you need per-country differences on the same URL.

### Is there a performance impact?

Minimal. A single fast IP lookup is cached; Cloudflare country header avoids lookups
entirely.

## 评价

此插件暂无评价。

## 贡献者及开发者

「ForgePress Country Choice Rules for Gravity Forms」是开源软件。 以下人员对此插
件做出了贡献。

贡献者

 *   [ forgepress ](https://profiles.wordpress.org/forgepress/)

[帮助将「ForgePress Country Choice Rules for Gravity Forms」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/forgepress-country-choice-rules-for-gravity-forms)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/forgepress-country-choice-rules-for-gravity-forms/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/forgepress-country-choice-rules-for-gravity-forms/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/forgepress-country-choice-rules-for-gravity-forms/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/forgepress-country-choice-rules-for-gravity-forms/)。

## 更新日志

### 1.3.0

 * Initial public release under the new name/slug.
 * Country-based choice filtering with fallback selection.
 * Optional VPN/Proxy handling (warn/force/block).
 * Cloudflare header + ipapi.co fallback with 1h caching.
 * Admin UI for multi-form/multi-field rules.

## 额外信息

 *  版本 **1.3.2**
 *  最后更新：**1 年前**
 *  活跃安装数量 **不到10**
 *  WordPress 版本 ** 5.8 或更高版本 **
 *  已测试的最高版本为 **6.8.12**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/forgepress-country-choice-rules-for-gravity-forms/)
 * 标签
 * [choices](https://cn.wordpress.org/plugins/tags/choices/)[conditional logic](https://cn.wordpress.org/plugins/tags/conditional-logic/)
   [country](https://cn.wordpress.org/plugins/tags/country/)[geolocation](https://cn.wordpress.org/plugins/tags/geolocation/)
   [gravity forms](https://cn.wordpress.org/plugins/tags/gravity-forms/)
 *  [高级视图](https://cn.wordpress.org/plugins/forgepress-country-choice-rules-for-gravity-forms/advanced/)

## 评级

尚未提交反馈。

[您的评价](https://wordpress.org/support/plugin/forgepress-country-choice-rules-for-gravity-forms/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/forgepress-country-choice-rules-for-gravity-forms/reviews/)

## 贡献者

 *   [ forgepress ](https://profiles.wordpress.org/forgepress/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/forgepress-country-choice-rules-for-gravity-forms/)