Skip to content

Commit 7235f0c

Browse files
authored
Merge pull request #12 from HelloAsso/fix-sync
Fix sync
2 parents 1413eb5 + 5d7c305 commit 7235f0c

5 files changed

Lines changed: 23 additions & 32 deletions

File tree

README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: helloasso, paiement, association, crowdfunding, don
55
Requires at least: 4.0
66
Tested up to: 6.8
77
Requires PHP: 7.2.34
8-
Stable tag: 1.1.22
8+
Stable tag: 1.1.23
99
License: GPLv2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -80,6 +80,9 @@ Please report security bugs found in the source code of the helloasso plugin thr
8080
2. Iframes des campagnes
8181

8282
== Changelog ==
83+
= 1.1.22 =
84+
* Synchronisation avec organizationSlug seulement
85+
8386
= 1.1.22 =
8487
* Correction bug nom association non reconnu
8588

admin/class-hello-asso-admin.php

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -477,29 +477,13 @@ function ha_search_campaign()
477477
return;
478478
}
479479

480-
$url = parse_url($value);
481480
$sandbox = false;
482-
$nameAsso = '';
483-
484-
if ($url !== false && isset($url['host'])) {
485-
$domain = $url['host'];
486-
487-
if ($domain == 'helloasso-sandbox.com' || $domain == 'www.helloasso-sandbox.com') {
488-
$sandbox = true;
489-
}
490-
491-
if ($domain != 'helloasso.com' && $domain != 'www.helloasso.com' && $domain != 'helloasso-sandbox.com' && $domain != 'www.helloasso-sandbox.com') {
492-
$nameAsso = '';
493-
} else {
494-
$slug = explode('/', $value);
495-
$nameAsso = isset($slug[4]) ? $slug[4] : '';
496-
}
497-
} else {
498-
$nameAsso = sanitize_title_with_dashes($value);
499-
}
500-
501-
if (empty($nameAsso)) {
502-
wp_send_json_error('URL ou nom d\'association invalide.');
481+
$organizationSlug = '';
482+
483+
$organizationSlug = sanitize_title_with_dashes($value);
484+
485+
if (empty($organizationSlug)) {
486+
wp_send_json_error('Slug d\'association invalide.');
503487
return;
504488
}
505489

@@ -526,17 +510,17 @@ function ha_search_campaign()
526510

527511
$bearer_token = $token_data['access_token'];
528512

529-
$org_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso, $bearer_token);
513+
$org_response = ha_curl_get($apiUrl . '/v5/organizations/' . $organizationSlug, $bearer_token);
530514

531515
if ($org_response === false) {
532-
wp_send_json_error('Erreur lors de la récupération des informations de l\'organisation.');
516+
wp_send_json_error('Erreur lors de la récupération des informations de l\'association.');
533517
return;
534518
}
535519

536520
$org_data = json_decode($org_response, true);
537521

538522
if (!isset($org_data['name'])) {
539-
wp_send_json_error('Organisation non trouvée.');
523+
wp_send_json_error('Association non trouvée.');
540524
return;
541525
}
542526

@@ -545,7 +529,7 @@ function ha_search_campaign()
545529
$total_count = 0;
546530

547531
for ($i = 1; $i <= 5; $i++) {
548-
$campaign_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso . '/forms?pageSize=20&pageIndex=' . $i, $bearer_token);
532+
$campaign_response = ha_curl_get($apiUrl . '/v5/organizations/' . $organizationSlug . '/forms?pageSize=20&pageIndex=' . $i, $bearer_token);
549533

550534
if ($campaign_response === false) {
551535
continue;
@@ -576,7 +560,7 @@ function ha_search_campaign()
576560
'asso_name' => $asso_name,
577561
'campaigns' => $all_campaigns,
578562
'total_count' => $total_count,
579-
'slug' => $nameAsso
563+
'slug' => $organizationSlug
580564
);
581565

582566
wp_send_json($result);

admin/css/hello-asso-admin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ a:focus {
574574
margin: 0;
575575
color: #2E2F5E;
576576
font-size: 20px;
577-
text-align: center;
577+
text-align: left;
578578
}
579579

580580
@media (max-width: 575px) {

admin/view/dashboard.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@
5656
<span class="ha-before-block">Vous administrez une association sur HelloAsso ?</span>
5757
<div class="ha-blocks">
5858
<div class="ha-block-white">
59+
<div class="ha-description">
5960
<h3 class="ha-title-block">Récupérez toutes vos campagnes en 1 clic</h3>
61+
<p>Coller le slug de votre association qui se trouve dans l'URL de votre association</p>
62+
<p>Exemple : <b>https://admin.helloasso.com/club-de-judo/accueil</b> le slug ici est <b>club-de-judo</b></p>
63+
</div>
6064
<div class="ha-search-glob">
61-
<input type="search" class="ha-search" onkeyup="haCheckInput()" value="<?= esc_html(get_option('ha-slug')); ?>" placeholder="Nom ou URL de mon organisme">
65+
<input type="search" class="ha-search" onkeyup="haCheckInput()" value="<?= esc_html(get_option('ha-slug')); ?>" placeholder="Slug de mon association">
6266
<span onclick="haResetInput()" class="ha-search-delete">
6367
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6468
<path d="M15 5L5 15" stroke="#BEBED7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />

hello-asso.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Plugin Name: HelloAsso
1717
* Plugin URI: https://centredaide.helloasso.com/s/article/paiement-en-ligne-wordpress-integrer-vos-campagnes-helloasso
1818
* Description: HelloAsso est la solution gratuite des associations pour collecter des paiements et des dons sur internet.
19-
* Version: 1.1.22
19+
* Version: 1.1.23
2020
* Author: HelloAsso
2121
* Author URI: https://helloasso.com
2222
* License: GPL-2.0+
@@ -36,7 +36,7 @@
3636
* Start at version 1.0.0 and use SemVer - https://semver.org
3737
* Rename this for your plugin and update it as you release new versions.
3838
*/
39-
define('HELLO_ASSO_VERSION', '1.1.22');
39+
define('HELLO_ASSO_VERSION', '1.1.23');
4040

4141
/**
4242
* The code that runs during plugin activation.

0 commit comments

Comments
 (0)