| 开发者 | |
|---|---|
| 更新时间 | 2026年6月1日 23:15 |
https://yoursite.com/wp-admin/admin-ajax.php?action=nmr-strava-callback& (keep the trailing & if your copy includes it)Strava webhook subscription id = 109463.
Data and privacy
Activities and tokens are stored in your WordPress database. See Privacy Notices below. For GDPR or similar obligations, ensure your site policy explains this processing.
Developer hooks
When an activity is saved or removed, other code can listen:
do_action('strava_nmr_activity_changed', 'update', $activity_data);
do_action('strava_nmr_activity_changed', 'delete', $payload);
Filter which activities are saved using the activity type (single string, e.g. Run):
function nmr_example_save_only_runs( $activity_type ) {
if ( strcasecmp( 'Run', $activity_type ) === 0 || strcasecmp( 'VirtualRun', $activity_type ) === 0 ) {
return $activity_type;
}
return false;
}
add_filter( 'nmr_strava_save_activity', 'nmr_example_save_only_runs' );
Filter using the full Strava activity array (return false to skip import):
add_filter( 'nmr_strava_save_activity_full', function ( $activity ) {
if ( ! empty( $activity['manual'] ) ) {
return false;
}
return $activity;
} );
Supported Strava activity types include: AlpineSki, BackcountrySki, Canoeing, Crossfit, EBikeRide, Elliptical, Golf, Handcycle, Hike, IceSkate, InlineSkate, Kayaking, Kitesurf, NordicSki, Ride, RockClimbing, RollerSki, Rowing, Run, Sail, Skateboard, Snowboard, Snowshoe, Soccer, StairStepper, StandUpPaddling, Surfing, Swim, Velomobile, VirtualRide, VirtualRun, Walk, WeightTraining, Wheelchair, Windsurf, Workout, Yoga.
Shortcodes
[strava_nmr] — OAuth connect flow (optional attributes for labels and require_login)[strava_nmr_connect] / [strava_nmr_disconnect] — logged-in connect/disconnect UI[strava_nmr_table top="100"] — simple HTML table of stored activities (default limit 100)nmr-strava-activities folder to /wp-content/plugins/.Yes. Create one at strava.com/settings/api. You need the Client ID, Client Secret, and the Redirect URI must match the page where you use the shortcode.
OAuth requires the same redirect URL during authorization that you registered with Strava. A mismatch causes “invalid redirect” or similar errors when users connect.
Strava sends HTTP notifications to that URL (your site’s admin-ajax.php with action=nmr-strava-callback). You normally leave the default value. It must be reachable over HTTPS in production.
A shared secret between your site and Strava during webhook subscription. It can be any string you choose; use the same value in the plugin and when Strava validates the subscription (GET challenge).
This plugin uses webhooks so new activities are processed when Strava pushes an event. You are not required to run a cron job to poll Strava for new data.
The plugin can be activated per site. Options and tables are per-site ($wpdb prefix). If you use get_site_option / update_option inconsistently for version checks, consult a developer for multisite edge cases.
Check that the webhook is active (subscription id in Plugin status), the athlete has connected via your site, Strava sent a create event, and your filters (nmr_strava_save_activity / nmr_strava_save_activity_full) do not return false for that activity.
You store Strava-derived data locally. Disclose this to users and athletes; obtain consent where required. See Privacy Notices above.
Use the WordPress.org support forum for this plugin.
Yes and No (work in progress). NMR Strava activities Pro is a separate plugin you install from your purchase at namir.ro (not WordPress.org). It validates a license against your shop and sets nmr_strava_is_pro() so premium code can run.
oauth/deauthorize to oauth/revoke per Strava API changes effective June 2026.AbstractProvider::parseResponse() from outside class scope; replaced with json_decode() on the PSR-7 response body.X-RateLimit-Limit and X-RateLimit-Usage headers; usage is persisted in a transient. Outbound requests are blocked (with an error_log entry) if the 15-minute or daily limit is already reached, preventing wasted requests and 429 errors.subscription_id if it drifted.clientId, clientSecret, redirectUri) were silently lowercased by sanitize_key() on save; replaced with allowlist sanitization. Migration added so existing corrupted options are read correctly.subscription_id is stored (was causing false 403s on fresh installs).$_GET['state'] on OAuth callback page.state warning; added get_normalized_options() helper for camelCase key migration in shortcode and deauthorize handlers.[strava_nmr_table] cells, OAuth authorize links, connect/disconnect URLs, and surfaced OAuth errors (esc_html / esc_url).subscription_id in the JSON body is checked for every event type before processing (403 on mismatch). Soft rate limit: up to 30 events per 60 seconds per Strava owner_id (429 when exceeded).includes/nmr-strava-license-bridge.php — nmr_strava_is_pro() and nmr_strava_pro_can() for the separate Pro add-on..wordpress-org/activities.external_id from not null to null - looks like a strava manual entry will generate null external_idactivities.name to textactivities.raw_activity to mediumtext[strava_nmr_connect]nmr_strava_save_activity_full filter that sends the entire Strava data as array. One can use it to filter out manual activities, for instance.nmr-strava-%subscription_id once we read it from Strava[strava_nmr_table top=10]. Default value if 100.[strava_nmr_table top=10] shows km and minutes instead of meters and seconds.[strava_nmr_table]nmr_strava_save_activity