diff --git a/README.txt b/README.txt index 4498c26..636df39 100644 --- a/README.txt +++ b/README.txt @@ -5,7 +5,7 @@ Tags: helloasso, paiement, association, crowdfunding, don Requires at least: 4.0 Tested up to: 6.8 Requires PHP: 7.2.34 -Stable tag: 1.1.22 +Stable tag: 1.1.23 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -80,6 +80,9 @@ Please report security bugs found in the source code of the helloasso plugin thr 2. Iframes des campagnes == Changelog == += 1.1.22 = +* Synchronisation avec organizationSlug seulement + = 1.1.22 = * Correction bug nom association non reconnu diff --git a/admin/class-hello-asso-admin.php b/admin/class-hello-asso-admin.php index 6d36bb8..23e3746 100644 --- a/admin/class-hello-asso-admin.php +++ b/admin/class-hello-asso-admin.php @@ -477,29 +477,13 @@ function ha_search_campaign() return; } - $url = parse_url($value); $sandbox = false; - $nameAsso = ''; - - if ($url !== false && isset($url['host'])) { - $domain = $url['host']; - - if ($domain == 'helloasso-sandbox.com' || $domain == 'www.helloasso-sandbox.com') { - $sandbox = true; - } - - if ($domain != 'helloasso.com' && $domain != 'www.helloasso.com' && $domain != 'helloasso-sandbox.com' && $domain != 'www.helloasso-sandbox.com') { - $nameAsso = ''; - } else { - $slug = explode('/', $value); - $nameAsso = isset($slug[4]) ? $slug[4] : ''; - } - } else { - $nameAsso = sanitize_title_with_dashes($value); - } - - if (empty($nameAsso)) { - wp_send_json_error('URL ou nom d\'association invalide.'); + $organizationSlug = ''; + + $organizationSlug = sanitize_title_with_dashes($value); + + if (empty($organizationSlug)) { + wp_send_json_error('Slug d\'association invalide.'); return; } @@ -526,17 +510,17 @@ function ha_search_campaign() $bearer_token = $token_data['access_token']; - $org_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso, $bearer_token); + $org_response = ha_curl_get($apiUrl . '/v5/organizations/' . $organizationSlug, $bearer_token); if ($org_response === false) { - wp_send_json_error('Erreur lors de la récupération des informations de l\'organisation.'); + wp_send_json_error('Erreur lors de la récupération des informations de l\'association.'); return; } $org_data = json_decode($org_response, true); if (!isset($org_data['name'])) { - wp_send_json_error('Organisation non trouvée.'); + wp_send_json_error('Association non trouvée.'); return; } @@ -545,7 +529,7 @@ function ha_search_campaign() $total_count = 0; for ($i = 1; $i <= 5; $i++) { - $campaign_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso . '/forms?pageSize=20&pageIndex=' . $i, $bearer_token); + $campaign_response = ha_curl_get($apiUrl . '/v5/organizations/' . $organizationSlug . '/forms?pageSize=20&pageIndex=' . $i, $bearer_token); if ($campaign_response === false) { continue; @@ -576,7 +560,7 @@ function ha_search_campaign() 'asso_name' => $asso_name, 'campaigns' => $all_campaigns, 'total_count' => $total_count, - 'slug' => $nameAsso + 'slug' => $organizationSlug ); wp_send_json($result); diff --git a/admin/css/hello-asso-admin.css b/admin/css/hello-asso-admin.css index 08c37b2..cb8e07e 100644 --- a/admin/css/hello-asso-admin.css +++ b/admin/css/hello-asso-admin.css @@ -574,7 +574,7 @@ a:focus { margin: 0; color: #2E2F5E; font-size: 20px; - text-align: center; + text-align: left; } @media (max-width: 575px) { diff --git a/admin/view/dashboard.php b/admin/view/dashboard.php index 9c6ff97..be8f862 100644 --- a/admin/view/dashboard.php +++ b/admin/view/dashboard.php @@ -56,9 +56,13 @@ Vous administrez une association sur HelloAsso ?
Coller le slug de votre association qui se trouve dans l'URL de votre association
+Exemple : https://admin.helloasso.com/club-de-judo/accueil le slug ici est club-de-judo
+