From 520bd1b64903cc079e1506b3e32a44bf8f5bc784 Mon Sep 17 00:00:00 2001
From: Justin Foell athlete_token parameter is deprecated as of version 2 and should be replaced with client_id.', 'wp-strava' );
+ }
+
/* Make sure boolean values are actually boolean
* @see https://wordpress.stackexchange.com/a/119299
*/
@@ -68,7 +73,7 @@ class WPStrava_ActivityShortcode {
$activity_details = null;
try {
- $activity_details = $activity->get_activity( $atts['athlete_token'], $atts['id'] );
+ $activity_details = $activity->get_activity( $atts['client_id'], $atts['id'] );
} catch ( WPStrava_Exception $e ) {
return $e->to_html();
}
diff --git a/includes/WPStrava/LatestActivities.php b/includes/WPStrava/LatestActivities.php
index 0117532..d8c9cbf 100644
--- a/includes/WPStrava/LatestActivities.php
+++ b/includes/WPStrava/LatestActivities.php
@@ -4,7 +4,7 @@ class WPStrava_LatestActivities {
public static function get_activities_html( $args ) {
$defaults = array(
- 'athlete_token' => WPStrava::get_instance()->settings->get_default_token(),
+ 'client_id' => WPStrava::get_instance()->settings->get_default_id(),
'strava_club_id' => null,
'quantity' => 5,
'som' => WPStrava::get_instance()->settings->som,
@@ -12,12 +12,17 @@ class WPStrava_LatestActivities {
$args = wp_parse_args( $args, $defaults );
+ if ( isset( $args['athlete_token'] ) ) {
+ // Translators: Message shown when using deprecated athlete_token parameter.
+ return __( 'The athlete_token parameter is deprecated as of version 2 and should be replaced with client_id.', 'wp-strava' );
+ }
+
$som = WPStrava_SOM::get_som( $args['som'] );
$strava_activity = WPStrava::get_instance()->activity;
$activities = array();
try {
- $activities = $strava_activity->get_activities( $args['athlete_token'], $args['strava_club_id'], $args['quantity'] );
+ $activities = $strava_activity->get_activities( $args['client_id'], $args['strava_club_id'], $args['quantity'] );
} catch ( WPStrava_Exception $e ) {
return $e->to_html();
}
diff --git a/includes/WPStrava/LatestActivitiesShortcode.php b/includes/WPStrava/LatestActivitiesShortcode.php
index 05fec95..db24387 100644
--- a/includes/WPStrava/LatestActivitiesShortcode.php
+++ b/includes/WPStrava/LatestActivitiesShortcode.php
@@ -35,7 +35,7 @@ class WPStrava_LatestActivitiesShortcode {
/**
* Shortcode handler for [activities].
*
- * [activities som=metric quantity=5 athlete_token=xxx|strava_club_id=yyy]
+ * [activities som=metric quantity=5 client_id=xxx|strava_club_id=yyy]
*
* @param array $atts Array of attributes (id, som, etc.).
* @return string Shortcode output
diff --git a/includes/WPStrava/LatestActivitiesWidget.php b/includes/WPStrava/LatestActivitiesWidget.php
index c8f942f..d5783f3 100644
--- a/includes/WPStrava/LatestActivitiesWidget.php
+++ b/includes/WPStrava/LatestActivitiesWidget.php
@@ -25,7 +25,7 @@ class WPStrava_LatestActivitiesWidget extends WP_Widget {
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Latest Activities', 'wp-strava' ) : $instance['title'] );
$activities_args = array(
- 'athlete_token' => isset( $instance['athlete_token'] ) ? $instance['athlete_token'] : null,
+ 'client_id' => isset( $instance['client_id'] ) ? $instance['client_id'] : null,
'strava_club_id' => isset( $instance['strava_club_id'] ) ? $instance['strava_club_id'] : null,
'quantity' => isset( $instance['quantity'] ) ? $instance['quantity'] : null,
);
@@ -42,7 +42,7 @@ class WPStrava_LatestActivitiesWidget extends WP_Widget {
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
- $instance['athlete_token'] = strip_tags( $new_instance['athlete_token'] );
+ $instance['client_id'] = strip_tags( $new_instance['client_id'] );
$instance['strava_club_id'] = strip_tags( $new_instance['strava_club_id'] );
$instance['quantity'] = $new_instance['quantity'];
@@ -52,8 +52,8 @@ class WPStrava_LatestActivitiesWidget extends WP_Widget {
/** @see WP_Widget::form */
public function form( $instance ) {
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : __( 'Latest Activities', 'wp-strava' );
- $all_tokens = WPStrava::get_instance()->settings->get_all_tokens();
- $athlete_token = isset( $instance['athlete_token'] ) ? esc_attr( $instance['athlete_token'] ) : WPStrava::get_instance()->settings->get_default_token();
+ $all_ids = WPStrava::get_instance()->settings->get_all_ids();
+ $client_id = isset( $instance['client_id'] ) ? esc_attr( $instance['client_id'] ) : WPStrava::get_instance()->settings->get_default_token();
$strava_club_id = isset( $instance['strava_club_id'] ) ? esc_attr( $instance['strava_club_id'] ) : '';
$quantity = isset( $instance['quantity'] ) ? absint( $instance['quantity'] ) : 5;
@@ -63,10 +63,10 @@ class WPStrava_LatestActivitiesWidget extends WP_Widget {
- -
diff --git a/includes/WPStrava/LatestMapWidget.php b/includes/WPStrava/LatestMapWidget.php index 1eef15d..9608c31 100644 --- a/includes/WPStrava/LatestMapWidget.php +++ b/includes/WPStrava/LatestMapWidget.php @@ -17,8 +17,8 @@ class WPStrava_LatestMapWidget extends WP_Widget { public function form( $instance ) { // outputs the options form on admin $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : __( 'Latest Activity Map', 'wp-strava' ); - $all_tokens = WPStrava::get_instance()->settings->get_all_tokens(); - $athlete_token = isset( $instance['athlete_token'] ) ? esc_attr( $instance['athlete_token'] ) : WPStrava::get_instance()->settings->get_default_token(); + $all_ids = WPStrava::get_instance()->settings->get_all_ids(); + $client_id = isset( $instance['client_id'] ) ? esc_attr( $instance['client_id'] ) : WPStrava::get_instance()->settings->get_default_token(); $distance_min = isset( $instance['distance_min'] ) ? esc_attr( $instance['distance_min'] ) : ''; $strava_club_id = isset( $instance['strava_club_id'] ) ? esc_attr( $instance['strava_club_id'] ) : ''; @@ -31,10 +31,10 @@ class WPStrava_LatestMapWidget extends WP_Widget {
-
-
athlete_token parameter is deprecated as of version 2 and should be replaced with client_id.', 'wp-strava' );
+ }
+
/* Make sure boolean values are actually boolean
* @see https://wordpress.stackexchange.com/a/119299
*/
diff --git a/readme.txt b/readme.txt
index ccb9d88..75b1316 100755
--- a/readme.txt
+++ b/readme.txt
@@ -27,7 +27,7 @@ Also takes the following optional parameters:
* som - english/metric (system of measure - override from default setting).
* map_width - width (width of image in pixels). Note both width and height parameters are limited to 640px except on premium API plans: https://developers.google.com/maps/documentation/maps-static/dev-guide#Imagesizes
* map_height - height (height of image in pixels). See note above on max height.
-* athlete_token - specify a different athlete (you can copy this value from https://www.strava.com/settings/api or the wp-strava settings page at /wp-admin/options-general.php?page=wp-strava-options).
+* client_id - specify a different athlete (you can copy this value from https://www.strava.com/settings/api or the wp-strava settings page at /wp-admin/options-general.php?page=wp-strava-options).
* markers - Display markers at the start/finish point (true/false, defaults to false).
* image_only - Display only the map image and not the table (true/false, defaults to false).
@@ -43,7 +43,7 @@ This also takes the same optional parameters as the [activity] shortcode above.
* som - english/metric (system of measure - override from default setting).
* quantity - number of activities to show.
-* athlete_token - specify a different athlete (you can copy this value from https://www.strava.com/settings/api or the wp-strava settings page at /wp-admin/options-general.php?page=wp-strava-options).
+* client_id - specify a different athlete (you can copy this value from https://www.strava.com/settings/api or the wp-strava settings page at /wp-admin/options-general.php?page=wp-strava-options).
* strava_club_id - Will display activity from the specified Strava club ID instead of an athlete.
@@ -57,7 +57,7 @@ Strava Latest Map - shows map of latest activity with option to limit latest map
= Why am I getting "ERROR 401 Unauthorized"? =
-When you have multiple athletes saved, the first is considered to be the default athlete. If you use a shortcode to display activity from anyone other than the default athlete, you must add the athlete token (found on the wp-strava settings page) to the shortcode, such as athlete_token=c764a2b199cff281e39f24671760c1b9c9fe005e. If you've recently had to re-authorize with Strava, your athlete token may have changed and will need to be updated in your shortcodes and widgets. For widgets, re-select the athlete you'd like to display and click Save.
+When you have multiple athletes saved, the first is considered to be the default athlete. If you use a shortcode to display activity from anyone other than the default athlete, you must add the athlete token (found on the wp-strava settings page) to the shortcode, such as client_id=17791. If you've recently had to re-authorize with Strava, your athlete token may have changed and will need to be updated in your shortcodes and widgets. For widgets, re-select the athlete you'd like to display and click Save.
= Why is my Google Map not showing up? =
@@ -75,11 +75,11 @@ WP-Strava caches activity for one hour so your site doesn't hit the Strava API o
4. Latest Map Widget - shows a map of your most recent activity.
5. Latest Map Widget Settings - settings for the Latest Map Widget. You can limit your activity by minimum distance to show only longer efforts.
6. Activity Shortcode - Shows a map of activity with some statistics.
-7. Activity Shortcode Settings - An example activity shortcode. The athlete_token parameter is only needed if your site is connected to multiple athlete accounts.
+7. Activity Shortcode Settings - An example activity shortcode. The client_id parameter is only needed if your site is connected to multiple athlete accounts.
8. Route Shortcode - Shows a map of a route.
9. Route Shortcode Settings - An example route shortcode. Add markers=true to show green/red start/stop points.
10. Activities Shortcode - Shows latest athlete activity in a page or post.
-11. Activities Shortcode Settings - An example activities shortcode. The athlete_token parameter is only needed if your site is connected to multiple athlete accounts.
+11. Activities Shortcode Settings - An example activities shortcode. The client_id parameter is only needed if your site is connected to multiple athlete accounts.
== Changelog ==