Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Call to undefined function isFeatureAllowed() #19

Closed
nawalnew opened this issue Apr 4, 2024 · 5 comments
Closed

Error Call to undefined function isFeatureAllowed() #19

nawalnew opened this issue Apr 4, 2024 · 5 comments

Comments

@nawalnew
Copy link

nawalnew commented Apr 4, 2024

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
Copy link

mayfinn commented Apr 6, 2024

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

@squareclouds
Copy link

squareclouds commented May 10, 2024

@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
Copy link
Author

nawalnew commented May 10, 2024

@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

anselmh added a commit to anselmh/kirby-cookie-banner that referenced this issue May 13, 2024
This fixes michnhokn#20.
This also should fix michnhokn#19.

The [`str_contains` function works vice-versa](https://www.php.net/manual/en/function.str-contains.php) than implemented before. In a local test environment this fixed the issues above and worked fine again.
@nawalnew
Copy link
Author

The Only Working Solution is at the Moment:

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
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants