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

Cookie notice? #1069

Open
LaMpiR opened this issue Sep 20, 2021 · 37 comments
Open

Cookie notice? #1069

LaMpiR opened this issue Sep 20, 2021 · 37 comments
Labels
plugin: others Concerns integration with other plugins

Comments

@LaMpiR
Copy link

LaMpiR commented Sep 20, 2021

Hi.

Can somebody recommend me some plugin for the Cookie Notice, since I am using Complianz and they are awesome, but they do not support QTranslate-xt at the moment, since the plugin is not in the wordpress directory.

I have issue with them that cookie banner jumps out on every page.

@isoph
Copy link
Contributor

isoph commented Sep 30, 2021

Hi,

This might not help you much but I use Complianz | GDPR/CCPA Cookie Consent on a site with qTranslate-XT and I do not experience the banner being displayed on every page.

@LaMpiR
Copy link
Author

LaMpiR commented Oct 13, 2021

What else could it be then :/

@dbalconi
Copy link

To anyone who want to add complianz compatibility with qTranslateXt you can use the standard string shortcode [:en]english text[:it]Italian text[:]

and then adding this in your theme function.php

add_filter('cmplz_cookie_settings','filtra_dati_complianz',10,1);
function filtra_dati_complianz($opzioni){
    $keys = array(
        'view_preferences',
        'save_preferences',
        'accept_all',
        'message_optin',
        'accept',
        'revoke',
        'dismiss',
        'readmore_optin',

        'categories',
    );
   foreach($keys as $key){
       if(isset($opzioni[$key])){
           $opzioni[$key] = __($opzioni[$key]);
       }
   }
    return $opzioni;
}

@LaMpiR
Copy link
Author

LaMpiR commented Dec 22, 2021

Thank you for that.

I have added the code and I still experience the problem.

I have two languages. When in first language(default one), I get the notice once and that is it.
When I use the second language, I get the notice. After that whenever I open an article in the second language, I keep getting the notice, so basically every move on the website is followed with a notice.

@dbalconi
Copy link

to be clear, the code written above is for the multilingual compatibility, to be able to insert the message in two different language. It does nothing for the plugin that keep appearing

@LaMpiR
Copy link
Author

LaMpiR commented Jan 3, 2022

I got that later on. Thank you anyway.
My problem is still here and I am getting no help on resolving it, for months now.

@isoph
Copy link
Contributor

isoph commented Jan 7, 2022

Thanks @dbalconi for this code snippet, it works just fine!

@isoph
Copy link
Contributor

isoph commented Jan 7, 2022

@LaMpiR I just got this bug but only on my production site, not on the dev version. This meant it was not a Qtranslate XT issue but a Complianz issue. I contacted Complianz support and they quickly advised me to :

  • Purge/clear the cache of any active caching plugins on the site
  • Check the site in a private browsing window
    And indeed the problem was solved…

@isoph
Copy link
Contributor

isoph commented Jan 14, 2022

@dbalconi The filter you hooked on has sadly been deprecated. Version 6.0 of the plugin is thus not translatable using this code snippet.

@herrvigg herrvigg added the plugin: others Concerns integration with other plugins label Jan 16, 2022
@renad
Copy link

renad commented Apr 4, 2022

Hi @dbalconi,
I tried your code for Complianz translation - I added it to into theme function.php
Unfortunately, it doesn't work - see attachment.
I use the The7 template – with child theme, I added the code to the child theme as usual.

Can you help me
Safari
?

@dbalconi
Copy link

dbalconi commented Apr 4, 2022 via email

@renad
Copy link

renad commented Apr 4, 2022

Thanks for the advice, yes this is the Complianz version 6.1.2
So I'm going to try it with version 5, if I find it somewhere :-)

@renad
Copy link

renad commented Apr 4, 2022

I couldn't find Complianz v.5, and I don't even want to downgrade, I don't think that's the solution, I'd rather have a new code found :-)

@renad
Copy link

renad commented Apr 5, 2022 via email

@dbalconi
Copy link

dbalconi commented Apr 5, 2022 via email

@renad
Copy link

renad commented Apr 5, 2022 via email

@renad
Copy link

renad commented Apr 5, 2022 via email

@renad
Copy link

renad commented Apr 8, 2022

Hi,
here is the code for the Complianz 6 version that works for me :-)

add_filter('cmplz_cookiebanner_settings','filter_data_complianz',10,1);
function filter_data_complianz($options){
$keys = array(
'header',
'accept_optin',
'accept_optout',
'manage_consent',
'manage_options',
'save_settings',
'dismiss',
'message_optout',
'message_optin',
'category_functional',
'category_preferences',
'category_statistics',
'functional_text',
'statistics_text',
'statistics_text_anonymous',
'preferences_text',
'marketing_text',
'category_marketing',
'position',
'use_categories',
);
foreach($keys as $key){
if(isset($options[$key])){
$options[$key] = __($options[$key]);
}
}
return $options;
}

@bagaweb
Copy link

bagaweb commented Apr 23, 2022

Thanks @renad

@bagaweb
Copy link

bagaweb commented Apr 23, 2022

Actually I've just noted there are a bunch of PHP warings when using your code:

Warning: Illegal offset type in isset or empty in wp-includes\pomo\translations.php on line 91

@renad
Copy link

renad commented Apr 23, 2022

Try this code:

@renad
Copy link

renad commented Apr 23, 2022

function cmplz_qtranslatex_options($options){
$keys = array(
'header',
'categories',
'accept_optin',
'accept_optout',
'manage_consent',
'manage_options',
'save_settings',
'dismiss',
'message_optout',
'message_optin',
'category_functional',
'category_preferences',
'category_statistics',
'functional_text',
'statistics_text',
'statistics_text_anonymous',
'preferences_text',
'marketing_text',
'category_marketing',
);

foreach($keys as $key){
	if(isset($options[$key])){
		$options[$key] = __($options[$key]);
	}
}
return $options;

}
add_filter('cmplz_cookiebanner_settings_html','cmplz_qtranslatex_options',10,1);

@bagaweb
Copy link

bagaweb commented Apr 24, 2022

Same as before unfortunately :(

I noticed the warning are showing up only on the Italian version of the website (which is the default language), on the English version there are no warnings.

If I switch to English as default language, same warnings appear only on the Italian side.

Complianz v 6.1.5

@bagaweb
Copy link

bagaweb commented Apr 27, 2022

As a temporary solution, I added these lines to wp-config.php:

// Disable display of errors and warnings define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 );

@bagaweb
Copy link

bagaweb commented Aug 16, 2022

I've just found out qTranslate-XT & Complianz do not work together on PHP 8.1.
They throw a critical error:

PHP Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /wp-includes/pomo/translations.php:91

qTranslate-XT without Complianz works fine on PHP 8.1.
Complianz without qTranslate-XT works fine on PHP 8.1.
qTranslate-XT & Complianz work fine together on PHP 7.4.

@extremecarver
Copy link

extremecarver commented Aug 24, 2022

I'm having the same problem using PHP 8.0.21 and PHP 8.1.9- as soon as I activate both Complianz and Qtranslate-XT it goes havoc - each on it's own is okay. The plugin works just fine (except this one error thrown): Warning: Undefined array key "pngfix_selectors" in /var/www/openmtbmap.org/htdocs/wp-content/themes/atahualpa/functions.php on line 858
Both above solutions of code for Complianz 6.0 crash my website - error 500.

These are the errors on 8.0 and 8.1:

I get the following errors:

With functions.php adapted - either it doesn't do anything or I get things like:
Fatal error: Cannot redeclare cmplz_qtranslatex_options() (previously declared in /var/www/openmtbmap.org/htdocs/wp-content/plugins/complianz-gdpr/integrations/plugins/qtranslate.php:8) in /var/www/openmtbmap.org/htdocs/wp-content/themes/theme-coder/functions.php on line 55

--- Without functions.php many pictures do not load, the complianz popup doesn't load, the qtranslate languaage choser doesn't load and so on - plus I get on header:
Warning: Undefined array key "pngfix_selectors" in /var/www/openmtbmap.org/htdocs/wp-content/themes/atahualpa/functions.php on line 858

And
in footer
Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /var/www/openmtbmap.org/htdocs/wp-includes/pomo/translations.php:91 Stack trace: #0 /var/www/openmtbmap.org/htdocs/wp-includes/pomo/translations.php(106): Translations->translate_entry() #1 /var/www/openmtbmap.org/htdocs/wp-includes/l10n.php(186): Translations->translate() #2 /var/www/openmtbmap.org/htdocs/wp-includes/l10n.php(297): translate() #3 /var/www/openmtbmap.org/htdocs/wp-content/plugins/complianz-gdpr/integrations/plugins/qtranslate.php(33): __() #4 /var/www/openmtbmap.org/htdocs/wp-includes/class-wp-hook.php(309): cmplz_qtranslatex_options() #5 /var/www/openmtbmap.org/htdocs/wp-includes/plugin.php(191): WP_Hook->apply_filters() #6 /var/www/openmtbmap.org/htdocs/wp-content/plugins/complianz-gdpr/cookiebanner/class-cookiebanner.php(1039): apply_filters() #7 /var/www/openmtbmap.org/htdocs/wp-content/plugins/complianz-gdpr/cookie/class-cookie-admin.php(1831): CMPLZ_COOKIEBANNER->get_html_settings() #8 /var/www/openmtbmap.org/htdocs/wp-includes/class-wp-hook.php(307): cmplz_cookie_admin->cookiebanner_html() #9 /var/www/openmtbmap.org/htdocs/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #10 /var/www/openmtbmap.org/htdocs/wp-includes/plugin.php(476): WP_Hook->do_action() #11 /var/www/openmtbmap.org/htdocs/wp-includes/general-template.php(3058): do_action() #12 /var/www/openmtbmap.org/htdocs/wp-content/themes/atahualpa/footer.php(110): wp_footer() #13 /var/www/openmtbmap.org/htdocs/wp-includes/template.php(770): require_once('...') #14 /var/www/openmtbmap.org/htdocs/wp-includes/template.php(716): load_template() #15 /var/www/openmtbmap.org/htdocs/wp-includes/general-template.php(92): locate_template() #16 /var/www/openmtbmap.org/htdocs/wp-content/themes/atahualpa/index.php(66): get_footer() #17 /var/www/openmtbmap.org/htdocs/wp-includes/template-loader.php(106): include('...') #18 /var/www/openmtbmap.org/htdocs/wp-blog-header.php(19): require_once('...') #19 /var/www/openmtbmap.org/htdocs/index.php(17): require('...') #20 {main} thrown in /var/www/openmtbmap.org/htdocs/wp-includes/pomo/translations.php on line 91

Is there any other plugin that is free that works out of the box for GDPR compliance like Complianz? I tried through a bunch and none of them is really working in the free version.. Complianz is - but messes with qtranslate-xt

@extremecarver
Copy link

extremecarver commented Aug 24, 2022

I can solve most problems by disabling the custom css in all fields of Complianz - it still havocs my payement processor (Stripe) credit card field inserted by s2member, so I am back to 7.4 PHP if I want to activate Complianz for right now - will look if there is something more to debug/circumvent so that it is possible to activate PHP 8.x

Helps to activate/deactivate these settings:
Disable width auto correction (enable)
Enable migrate.js (enable)
Disable Placeholder Integration (enable) - this one is the most important!

@rlankhorst
Copy link

regarding php 8 compatibility, in the integration, please replace

if( isset($options[$key]) ){
	$options[$key] = __($options[$key]);
}

with

if( isset($options[$key]) && is_string( $options[$key]) ){
	$options[$key] = __($options[$key]);
}

See
https://wordpress.org/support/topic/qtranslate-xt-plugin/

@bagaweb
Copy link

bagaweb commented Sep 12, 2022

Excellent thanks @rlankhorst

@bagaweb bagaweb closed this as completed Sep 12, 2022
@bagaweb bagaweb reopened this Sep 12, 2022
@extremecarver
Copy link

I still have a lot of problems if enabling 8.0 or 8.1 with both qtranslate xt and complianz. The change just made the page not crash - but still behave problematic (broken layout mainly, some other plugins going crazy).

@rlankhorst
Copy link

Complianz is tested with php 8 & 8.1. It sounds as if your other plugins, including qtranslate, are not ready for php 8/8.1

Looking at the logs, Wordpress core also isn't.

@sviluppomania
Copy link
Contributor

Hi @dbalconi, I tried your code for Complianz translation - I added it to into theme function.php Unfortunately, it doesn't work - see attachment. I use the The7 template – with child theme, I added the code to the child theme as usual.

Can you help me Safari ?

@rlankhorst

@dbalconi
Copy link

dbalconi commented Sep 13, 2022 via email

@extremecarver
Copy link

Complianz is tested with php 8 & 8.1. It sounds as if your other plugins, including qtranslate, are not ready for php 8/8.1

Looking at the logs, Wordpress core also isn't.

wordpress seems fine with 8.0 - but yes thowring some errors in console in 8.1 - but my site is fine. It's only if I actiave BOTH Complianz and Q-Translate XT at the same time that I get problems. Either plugin alone and I*m fine. And yes I did change the code in the integration. Actually no difference between 8.0 and 8.1 in real life (in console 8.1 looks more problematic).

@extremecarver
Copy link

Sorry - actually I think the bug is solved for me too. However Complianz on PHP 8.0 or later does not work with my theme. I just completely removed the qtranslate.php plugin of complianz then noticed this problem.

@rlankhorst
Copy link

Made some adjustments, this branch seems to work for all fields

Really-Simple-Plugins/complianz-gdpr#377

@bagaweb
Copy link

bagaweb commented Jul 25, 2023

Another fatal error when running Complianz wizard (after adding Google Maps service):

Fatal error: Uncaught TypeError: Argument 1 passed to qtranxf_useRawTitle() must be of the type string, null given, called in \wp-includes\class-wp-hook.php on line 308 and defined in \wp-content\plugins\qtranslate-xt\src\hooks.php:79 Stack trace:
#0 \wp-includes\class-wp-hook.php(308): qtranxf_useRawTitle(NULL, NULL, 'save')
#1 \wp-includes\plugin.php(205): WP_Hook->apply_filters(NULL, Array)
#2 \wp-includes\formatting.php(2220): apply_filters('sanitize_title', NULL, NULL, 'save')
#3 \wp-content\plugins\complianz-gdpr\cookie\class-service.php(164): sanitize_title(NULL)
#4 \wp-content\plugins\complianz-gdpr\cookie\class-service.php(373): CMPLZ_SERVICE->save(false, false)
#5 \wp-content\plugins\complianz-gdpr\cookie\class-cookie-admin.php(1572): CMPLZ_SERVICE->add('Google Maps', Array, false, 'service')
#6 \wp-content\plugins\complianz-gdpr\class in \wp-content\plugins\qtranslate-xt\src\hooks.php on line 79

qTranslate-XT 3.15.2
Complianz 6.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: others Concerns integration with other plugins
Projects
None yet
Development

No branches or pull requests

9 participants