Title: NMR Strava activities
Author: mirceatm
Published: <strong>2021 年 9 月 17 日</strong>
Last modified: 2026 年 6 月 1 日

---

搜索插件

![](https://ps.w.org/nmr-strava-activities/assets/banner-772x250.jpg?rev=3543904)

![](https://ps.w.org/nmr-strava-activities/assets/icon-256x256.jpg?rev=3543904)

# NMR Strava activities

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

[下载](https://downloads.wordpress.org/plugin/nmr-strava-activities.1.0.19.zip)

 * [详情](https://cn.wordpress.org/plugins/nmr-strava-activities/#description)
 * [评价](https://cn.wordpress.org/plugins/nmr-strava-activities/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/nmr-strava-activities/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/nmr-strava-activities/#developers)

 [支持](https://wordpress.org/support/plugin/nmr-strava-activities/)

## 描述

**NMR Strava activities** imports athlete activities into your WordPress site as
soon as Strava records them—no slow polling. Data is stored locally; developers 
can react with actions and filters for custom workflows, leaderboards, or integrations.

**Why webhooks?** Strava can [notify your site](https://developers.strava.com/docs/webhooks/)
when an activity is created or deleted. This plugin subscribes to those events, 
then fetches full activity details with OAuth and saves them to custom database 
tables.

**You will need:**

 * A [Strava API application](https://www.strava.com/settings/api) (Client ID and
   Client Secret)
 * A page or post containing the **[strava_nmr]** shortcode; its URL must match **
   Redirect URI** in both Strava and this plugin’s settings

**Configure the plugin:** WordPress admin  **Settings  Strava NMR**

 * **Strava client id** — from your Strava API application
 * **Strava client secret** — from your Strava API application
 * **Redirect URI** — full URL of the page/post where **[strava_nmr]** appears (
   must match Strava’s Authorization Callback Domain / redirect settings)
 * **Webhook callback url** — filled automatically; should look like `https://yoursite.
   com/wp-admin/admin-ajax.php?action=nmr-strava-callback&` (keep the trailing `&`
   if your copy includes it)
 * **Verify token** — a secret string you choose; used when Strava validates your
   webhook subscription

After saving, use **Activate Strava Webhook**. On success, **Plugin status** shows
something like: `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)

**Official listing**

Install from [WordPress.org/plugins/nmr-strava-activities](https://wordpress.org/plugins/nmr-strava-activities/).
More info: [Plugin URI](https://namir.ro/strava-activities/).

If this plugin saves you time, consider [making a donation](https://paypal.me/mirceatm).

#### Privacy Notices

This plugin stores data received from Strava—which may include personal information—
in your site’s database. You are responsible for describing this in your privacy
policy and for any consent or legal basis required in your jurisdiction.

## 屏幕截图

[⌊Placeholder: Settings <span aria-hidden=⌉⌊Placeholder: Settings <span aria-hidden=⌉→ Strava NMR (replace with a real screenshot in the WordPress.org assets folder when publishing).” class=”wp-image-9000001″ srcset=”https://i0.wp.com/ps.w.org/nmr-strava-activities/assets/screenshot-1.jpg?rev=3543904&w=300 300w, https://i0.wp.com/ps.w.org/nmr-strava-activities/assets/screenshot-1.jpg?rev=3543904&w=600 600w, https://i0.wp.com/ps.w.org/nmr-strava-activities/assets/screenshot-1.jpg?rev=3543904&w=900 900w” sizes=”(max-width: 599px) 50vw, 33vw” width=”1200″ height=”820″ loading=”eager” fetchpriority=”high” decoding=”async”/>](https://ps.w.org/nmr-strava-activities/assets/screenshot-1.jpg?rev=3543904)

Placeholder: Settings  Strava NMR (replace with a real screenshot in the WordPress.
org `assets` folder when publishing).

[⌊Placeholder: Example of activity data / [strava_nmr_table] output (replace with
a real screenshot on WordPress.org).⌉⌊Placeholder: Example of activity data / [strava_nmr_table]
output (replace with a real screenshot on WordPress.org).⌉[

Placeholder: Example of activity data / `[strava_nmr_table]` output (replace with
a real screenshot on WordPress.org).

## 安装

 1. Install from the [plugin directory](https://wordpress.org/plugins/nmr-strava-activities/)
    or upload the `nmr-strava-activities` folder to `/wp-content/plugins/`.
 2. Activate the plugin through the **Plugins** screen in WordPress.
 3. Create a Strava API application and configure **Settings  Strava NMR**.
 4. Add **[strava_nmr]** to a public page; set that page’s URL as **Redirect URI** 
    in Strava and in the plugin.
 5. Save settings, then click **Activate Strava Webhook** and confirm **Plugin status**
    shows a subscription id.

## 常见问题

### Do I need a Strava API application?

Yes. Create one at [strava.com/settings/api](https://www.strava.com/settings/api).
You need the Client ID, Client Secret, and the Redirect URI must match the page 
where you use the shortcode.

### Why must the Redirect URI match exactly?

OAuth requires the same redirect URL during authorization that you registered with
Strava. A mismatch causes “invalid redirect” or similar errors when users connect.

### What is the webhook callback URL for?

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.

### What is the verify token?

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).

### Webhooks vs polling

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.

### Does this work on multisite?

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.

### Activities not appearing

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.

### GDPR and privacy

You store Strava-derived data locally. Disclose this to users and athletes; obtain
consent where required. See **Privacy Notices** above.

### Where do I get support?

Use the [WordPress.org support forum](https://wordpress.org/support/plugin/nmr-strava-activities/)
for this plugin.

### Is there a Pro version?

Yes and No (work in progress). **NMR Strava activities Pro** is a separate plugin
you install from your purchase at [namir.ro](https://namir.ro) (not WordPress.org).
It validates a license against your shop and sets `nmr_strava_is_pro()` so premium
code can run.

## 评价

![](https://secure.gravatar.com/avatar/cf5befb7ed79b423a091160f406d2ef45514933837a1807a39e38c9c49b990d6?
s=60&d=retro&r=g)

### 󠀁[Must have plugin for runners](https://wordpress.org/support/topic/must-have-plugin-for-runners/)󠁿

 [jemyjenab](https://profiles.wordpress.org/jemyjenab/) 2022 年 10 月 30 日

Cool plugin for runners to link Strava activities and wordpress. Impress with the
features. 👍🙌 Noted: Please put the Strava Token correctly. (Double check) so you
can proceed with activated the hook.

 [ 阅读所有0条评价 ](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/)

## 贡献者及开发者

「NMR Strava activities」是开源软件。 以下人员对此插件做出了贡献。

贡献者

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

[帮助将「NMR Strava activities」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/nmr-strava-activities)

### 对开发感兴趣吗?

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

## 更新日志

#### 1.0.19

 * **API update:** Switched deauthorize endpoint from `oauth/deauthorize` to `oauth/
   revoke` per Strava API changes effective June 2026.

#### 1.0.18

 * **Bug fix:** Fatal error calling protected `AbstractProvider::parseResponse()`
   from outside class scope; replaced with `json_decode()` on the PSR-7 response
   body.

#### 1.0.17

 * **Rate limiting:** Strava API responses are now inspected for `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.
 * **Settings page:** Pro feature cards now show a hover tooltip with a preview 
   image for each feature (Activity Cards, Route Maps, Statistics Charts, Historical
   Import).
 * **Settings page:** Historical Import preview replaced with a static image; hover
   transitions from blurred to clear instead of a hard blur.

#### 1.0.16

 * **Settings page:** Added “Verify with Strava” button — checks live subscription
   status from Strava API and syncs `subscription_id` if it drifted.
 * **Bug fix:** Settings keys (`clientId`, `clientSecret`, `redirectUri`) were silently
   lowercased by `sanitize_key()` on save; replaced with allowlist sanitization.
   Migration added so existing corrupted options are read correctly.
 * **Bug fix:** Webhook subscription mismatch check now skipped when no local `subscription_id`
   is stored (was causing false 403s on fresh installs).
 * **Bug fix:** PHP warning for undefined `$_GET['state']` on OAuth callback page.

#### 1.0.15

 * **OAuth callback:** Fixed undefined array key `state` warning; added `get_normalized_options()`
   helper for camelCase key migration in shortcode and deauthorize handlers.

#### 1.0.14

 * **Settings page:** Added “Upgrade to Pro” section with feature overview cards
   and a locked preview of the historical import tool. Section is hidden when the
   Pro add-on is active.

#### 1.0.13

 * **Shortcode output:** Hardened escaping for `[strava_nmr_table]` cells, OAuth
   authorize links, connect/disconnect URLs, and surfaced OAuth errors (`esc_html`/`
   esc_url`).
 * **Webhook POST:** `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).
 * work in progress: **Pro bridge:** `includes/nmr-strava-license-bridge.php` — `
   nmr_strava_is_pro()` and `nmr_strava_pro_can()` for the separate Pro add-on.

#### 1.0.12

 * Readme: short description (≤150 chars for WordPress.org), tags, FAQ, installation
   path, developer examples aligned with code
 * WordPress.org visual assets: banners, icons, screenshot placeholders in `.wordpress-
   org/`

#### 1.0.11

 * Update column `activities.external_id` from not null to null – looks like a strava
   manual entry will generate null `external_id`
 * Update SQL string to use string interpolation for table name

#### 1.0.10

 * Update column `activities.name` to `text`

#### 1.0.9

 * Update column `activities.raw_activity` to `mediumtext`

#### 1.0.8

 * Fixed XSS in `[strava_nmr_connect]`

#### 1.0.7

 * Updated code according to wordpress code review.

#### 1.0.6

 * Added `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.
 * Remove dangling options by the name `nmr-strava-%`
 * Save `subscription_id` once we read it from Strava

#### 1.0.5

 * Added top property to shortcode `[strava_nmr_table top=10]`. Default value if
   100.
 * `[strava_nmr_table top=10]` shows km and minutes instead of meters and seconds.
 * Activate Strava will also save the settings.

#### 1.0.4

 * Added simple shortcode to list activities received from Strava: `[strava_nmr_table]`

#### 1.0.3

 * Store Strava username, firstname, lastname and profile link
 * Delete duplicate rows

#### 1.0.2

 * Fixed strava activity import when there is no associated wordpress user.
 * Add filter `nmr_strava_save_activity`

#### 1.0.1

 * Fixed option save
 * Add button to deactivate Strava subscription
 * Removed use of PHP session
 * Allow Strava activities from anonymous visitors (un-registered users)

#### 1.0.0

 * Initial version.

## 额外信息

 *  版本 **1.0.19**
 *  最后更新：**1 周前**
 *  活跃安装数量 **90+**
 *  WordPress 版本 ** 5.2 或更高版本 **
 *  已测试的最高版本为 **7.0**
 *  语言
 * [English (US)](https://wordpress.org/plugins/nmr-strava-activities/)
 * 标签
 * [activities](https://cn.wordpress.org/plugins/tags/activities/)[fitness](https://cn.wordpress.org/plugins/tags/fitness/)
   [import](https://cn.wordpress.org/plugins/tags/import/)[strava](https://cn.wordpress.org/plugins/tags/strava/)
   [webhooks](https://cn.wordpress.org/plugins/tags/webhooks/)
 *  [高级视图](https://cn.wordpress.org/plugins/nmr-strava-activities/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/nmr-strava-activities/reviews/)

## 贡献者

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

## 支持

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

 [查看支持论坛](https://wordpress.org/support/plugin/nmr-strava-activities/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](https://paypal.me/mirceatm)