From b0cf993132041c02d934c6e9eed05720a985b117 Mon Sep 17 00:00:00 2001 From: bencroker Date: Wed, 27 Mar 2024 21:33:32 -0600 Subject: [PATCH] Fix when buttons appear --- CHANGELOG.md | 6 ++++++ composer.json | 2 +- src/templates/campaigns/index.twig | 14 ++++++++------ src/templates/mailinglists/index.twig | 12 +++++++----- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16d6de6b..9b6cd91c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Campaign +## 2.13.2 - Unreleased + +### Fixed + +- Fixed the buttons to create new campaign types and mailing list types appearing when allow admin changes was disabled or the user did not have the necessary permissions. + ## 2.13.1 - 2024-03-26 ### Fixed diff --git a/composer.json b/composer.json index cf66ba38..bb3c3e6f 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "putyourlightson/craft-campaign", "description": "Send and manage email campaigns, contacts and mailing lists.", - "version": "2.13.1", + "version": "2.13.2", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/campaign", "license": "proprietary", diff --git a/src/templates/campaigns/index.twig b/src/templates/campaigns/index.twig index beead264..2bc7a6c3 100644 --- a/src/templates/campaigns/index.twig +++ b/src/templates/campaigns/index.twig @@ -12,14 +12,16 @@ ]) %} {% block content %} - {% if allCampaignTypes|length == 0 %} + {% if allCampaignTypes|length >= 0 %}

{{ 'No campaign types exist.'|t('campaign') }}

-
- - {{ 'New campaign type'|t('campaign') }} - -
+ {% if craft.app.config.general.allowAdminChanges and currentUser.can('campaign:settings') %} +
+ + {{ 'New campaign type'|t('campaign') }} + +
+ {% endif %}
{% else %} {{ parent() }} diff --git a/src/templates/mailinglists/index.twig b/src/templates/mailinglists/index.twig index e939a2f6..fff9a775 100644 --- a/src/templates/mailinglists/index.twig +++ b/src/templates/mailinglists/index.twig @@ -15,11 +15,13 @@ {% if allMailingListTypes|length == 0 %}

{{ 'No mailing list types exist.'|t('campaign') }}

-
- - {{ 'New mailing list type'|t('campaign') }} - -
+ {% if craft.app.config.general.allowAdminChanges and currentUser.can('campaign:settings') %} +
+ + {{ 'New mailing list type'|t('campaign') }} + +
+ {% endif %}
{% else %} {{ parent() }}