| 开发者 | bgoddev |
|---|---|
| 更新时间 | 2026年11月25日 03:13 |
| PHP版本: | 8.0 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[qonnect_form id=12].[qonnect_count id=12 filters="district=north"].[qonnect_table id=12 fields="district,status" per_page=20].[qonnect_map id=12 popup="district,status"].https://kf.kobotoolbox.org or https://eu.kobotoolbox.org) and your API token. The plugin checks the token before saving it.Log in to KoboToolbox, open your account settings and look under Security for the API key. Anyone with the token can read your projects, so keep it private. If you can, use an account that has access only to the projects you want on your site.
It is encrypted with libsodium before it is saved, using a key derived from your site's secret keys in wp-config.php. You can set a dedicated key with define( 'QONNECT_ENCRYPTION_KEY', '…a long random string…' );. If you change your salts or that key later, re-enter the token. The token is never sent to the browser, shown on an admin page, or written to a log.
Only the answers to the questions you share, plus each submission's Kobo id, submission time and validation status. Blocked questions are removed before anything is saved. The Privacy page lists, for each form, exactly what is stored and shared.
It decides whether visitors can see a form's shared fields. While it is off (the default), the form's blocks and shortcodes show nothing to visitors and its public API returns "not found", even if you have shared fields and synced. Once it is on, anyone can read the shared fields on pages with a Qonnect block or through the site's data API. Turning it off hides the data again at once.
No. The plugin only reads from your Kobo account. Delete stored data removes only the copy on your WordPress site. Your forms and submissions in KoboToolbox are never changed. The next sync copies the shared fields again.
Syncs use WP-Cron, which only runs when someone visits your site. On a quiet site, or if DISABLE_WP_CRON is set in wp-config.php, add a real cron job on your server. The Status page shows the exact line for your site, for example:
*/5 * * * * curl -fsS "https://example.org/wp-cron.php?doing_wp_cron" > /dev/null 2>&1
With WP-CLI you can use wp cron event run --due-now instead. The Status page warns you when scheduled syncs have stopped running.
The rate limit on public data counts requests per visitor IP address. Behind a proxy, every visitor seems to come from the proxy's address, so they share one limit. To fix this, list your proxies' addresses or ranges in wp-config.php:
define( 'QONNECT_TRUSTED_PROXIES', '173.245.48.0/20, 10.0.0.0/8' );
The plugin then reads the visitor's address from the X-Forwarded-For header, but only for requests that arrive from those proxies. Use your provider's published list of ranges. The Status page shows which method is in use and warns about invalid entries.
Yes, with a filter. By default, counts combine answers given by fewer than 5 people, so no small group can identify anyone, and each form's minimum group size can be raised up to 100 under Choose fields, Display settings. To let administrators choose a lower size, or 0 for no minimum, add this to your theme's functions.php or a small plugin:
add_filter( 'qonnect_min_group_size_floor', fn() => 2 );
Small groups can identify people, so lower it only when that is acceptable for your data.
Yes, with filters. qonnect_confirm_sensitive_fields (true by default) decides whether sharing a question that may hold personal data needs its own confirmation: add_filter( 'qonnect_confirm_sensitive_fields', '__return_false' ); turns that step off, and the warning still shows. qonnect_rate_limit (60 by default) sets how many public data requests one visitor may make per minute; 0 removes the limit: add_filter( 'qonnect_rate_limit', fn() => 120 );.
It is a switch in each form's Display settings. When it is on, visitors see only summary counts of that form: Data Table and Submissions Map blocks show nothing, and a count can use one filter at most.
Every hour by default. Each form has a Sync every setting under Choose fields, Display settings: every 15 or 30 minutes, every hour, every 6 or 12 hours, or once a day. Each sync run makes at most 60 requests to KoboToolbox; change that with the qonnect_request_budget filter (1 to 500):
add_filter( 'qonnect_request_budget', fn() => 120 );
Yes, and busy sites should. OpenStreetMap's public tile servers are run by volunteers, and their tile usage policy does not allow heavy use. To use another provider, return an HTTPS tile address containing {z}, {x} and {y}, and the provider's attribution, from the qonnect_map_tiles filter in your theme's functions.php or a small plugin:
add_filter( 'qonnect_map_tiles', fn() => [ 'url' => 'https://tiles.example.com/{z}/{x}/{y}.png', 'attribution' => '© Example Tiles' ] );
An address that is not HTTPS or lacks {z}, {x} or {y} is ignored, and the map uses OpenStreetMap with its own attribution.
Yes, with the qonnect_form_embed_args filter. It receives an empty array and the form, and the key/value pairs you return are added, encoded, to the embedded form's address and to its "Open the form in a new tab" link (never in the block editor). For example, to fill a question with a fixed value through Enketo's d[/form_id/question] parameters (the form's XForm ID and the question's name):
add_filter( 'qonnect_form_embed_args', fn( $args, $form ) => $args + [ 'd[/my_survey/source]' => 'website' ], 10, 2 );
Five minutes. A sync that changes a form's data, or a change of its shared questions, replaces the cached results at once. Change the time with the qonnect_cache_ttl filter (30 to 86400 seconds):
add_filter( 'qonnect_cache_ttl', fn() => 900 );
Yes: deleting the plugin removes its tables, settings and cached results from your site (never anything in KoboToolbox). To keep them, for example before reinstalling, add this before you delete the plugin:
add_filter( 'qonnect_keep_data_on_uninstall', '__return_true' );
Pages read only your site's own database and cache, never KoboToolbox. Scripts and styles load only on pages that use a Qonnect block. The map adds about 45 KB, compressed, including Leaflet.
If a form needs a KoboToolbox login, most browsers block that login inside the embedded frame. The editor warns you about this. Allow anonymous submissions for the form in KoboToolbox, or link to it with "Open the form in a new tab".