michnhokn / kirby-cookie-banner

A Cookie Consent Modal for Kirby
MIT License
67 stars 9 forks source link

Error Call to undefined function isFeatureAllowed() #19

Closed nawalnew closed 5 months ago

nawalnew commented 6 months ago

Hello Michael, I love your plugin!

Since your Last update the old Helper isFeatureAllowed() is not working anymore.

Could you please give a advice how to implement the same functionality? Somehow Kirby 4.1.2 and the versions before this didnt work either with your new version.

In my Snippet i had it like this and it worked:

  <?php if (isFeatureAllowed('analytics')): ?>

Script goes here

  </script>
  <?php endif; ?>

Best regards, Sergej

mayfinn commented 6 months ago

Hey you could use the \Michnhokn\CookieBanner::isFeatureAllowed function as documented in the README.

squareclouds commented 4 months ago

@mayfinn somehow it is not working for me after the upgrade to k4, the function always returns false. my cookies look like this:

cookie_status: essential%2Cvisuals%2Cvideos

and i am checking before adding videos likes this:

<?php if (\Michnhokn\CookieBanner::isFeatureAllowed('videos')) : ?>

... stuff

<?php endif ?>

but i always get false. am i doign something wrong?

nawalnew commented 4 months ago

@mayfinn somehow it is not working for me after the upgrade to k4, the function always returns false. my cookies look like this:

cookie_status: essential%2Cvisuals%2Cvideos

and i am checking before adding videos likes this:

... stuff

but i always get false. am i doign something wrong?

I want to add the same. Even this \Michnhokn\CookieBanner::isFeatureAllowed returns always false. I've tested on clean K4 installation.

@mayfinn Could you please Provide a working example how to check the method and get the same results as your K3 Version. Thank you

nawalnew commented 4 months ago

The Only Working Solution is at the Moment:

<?php if (isFeatureAllowed('analytics')): ?>

<?php endif; ?>

In K4 (4.2.0) with your version 1.0.5 and PHP 8.2.4

Ive tested all and needed to revert all my pages back to the old version because your Helper Classes dont work somehow. No Array, No Bool as result. just no error.

I look forward to help if needed and for a solution to test. Thank you!

squareclouds commented 4 months ago

@nawalnew for me version 1.0.9 works fine, there is no need to go so far back to 1.0.5. kirby 4.2 and php 8.2.0