Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
38 changes: 11 additions & 27 deletions admin/class-hello-asso-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion admin/css/hello-asso-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ a:focus {
margin: 0;
color: #2E2F5E;
font-size: 20px;
text-align: center;
text-align: left;
}

@media (max-width: 575px) {
Expand Down
6 changes: 5 additions & 1 deletion admin/view/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@
<span class="ha-before-block">Vous administrez une association sur HelloAsso ?</span>
<div class="ha-blocks">
<div class="ha-block-white">
<div class="ha-description">
<h3 class="ha-title-block">Récupérez toutes vos campagnes en 1 clic</h3>
<p>Coller le slug de votre association qui se trouve dans l'URL de votre association</p>
<p>Exemple : <b>https://admin.helloasso.com/club-de-judo/accueil</b> le slug ici est <b>club-de-judo</b></p>
</div>
<div class="ha-search-glob">
<input type="search" class="ha-search" onkeyup="haCheckInput()" value="<?= esc_html(get_option('ha-slug')); ?>" placeholder="Nom ou URL de mon organisme">
<input type="search" class="ha-search" onkeyup="haCheckInput()" value="<?= esc_html(get_option('ha-slug')); ?>" placeholder="Slug de mon association">
<span onclick="haResetInput()" class="ha-search-delete">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15 5L5 15" stroke="#BEBED7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
Expand Down
4 changes: 2 additions & 2 deletions hello-asso.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: HelloAsso
* Plugin URI: https://centredaide.helloasso.com/s/article/paiement-en-ligne-wordpress-integrer-vos-campagnes-helloasso
* Description: HelloAsso est la solution gratuite des associations pour collecter des paiements et des dons sur internet.
* Version: 1.1.22
* Version: 1.1.23
* Author: HelloAsso
* Author URI: https://helloasso.com
* License: GPL-2.0+
Expand All @@ -36,7 +36,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define('HELLO_ASSO_VERSION', '1.1.22');
define('HELLO_ASSO_VERSION', '1.1.23');

/**
* The code that runs during plugin activation.
Expand Down