Sauter la navigation

[Résolu] Block Google Maps with Complianz in a multisite

This support ticket is created Il y a 4 années et 9 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Ce sujet contient 6 réponses, a 4 voix.

Dernière mise à jour par Luo Yang Il y a 4 années et 9 mois.

Assisté par: Luo Yang.

Auteur
Publications
#1619387
2020-05-11 10_00_25-Einbindungen ‹ Sozialraum digital gestalten — WordPress.png

Tell us what you are trying to do?

I want to block the Google Maps till the user accepts all cookies. I got it working in a single site installation by adding a manual script source. In a multisite this does not work. I use the complianz plugin: lien caché

Is there any documentation that you are following?
I use this line to block the script:

wp-content/plugins/toolset-maps/resources/js/wpv_addon_maps.js

Is there a similar example that we can see?
Working: lien caché

What is the link to your site?
Not working: lien caché

#1620741

Hi,

Thank you for contacting us and I'd be happy to assist.

Since this blocking is a feature controlled through the "Complianz | GDPR/CCPA Cookie Consent" plugin, it would be best to consult its official documentation or support team, to learn about making this work in a multisite environment.

If you or that plugin's author requires any specific information around how Toolset Maps plugin's resources are loaded, you're welcome to write to us.

regards,
Waqar

#1629305

Hello Waqar,

the owner of the plugin asked me the following:

I have it blocked with placeholder, only activating has to be done a certain. And without doing a deep dive in Toolset javascript. Can you ask how they load their maps, and how I should load their maps after blocking wpv-addon-maps.js?

We have an API they can talk to as well. wpconsentapi.org. If they want to conform to the API, this will be done much easier.

Best, Daniel

#1629797

sorry, replied with my second toolset account.

#1632135

Hi Daniel,

Thank you for sharing these details.

During testing on my test websites, I was able to block the loading of Toolset maps through the "Scripts Center" setting.
( example screenshot: lien caché )

This worked in single as well as in the multisite environment, however, you'll need to add this setting for each site in the network individually.

Another option that worked for me was using the "Consent API" method, that the plugin author mentioned.

I installed the plugin downloaded from the plugin's page ( lien caché ) and added a custom shortcode, that checks whether the consent for the cookie has been granted or not.

Example:


add_shortcode('check_for_cookie_consent', 'check_for_cookie_consent_fn');
function check_for_cookie_consent_fn($atts) {

	$a = shortcode_atts( array(
		'type' => '',
	), $atts );

	if (wp_has_consent($a['type'])){
		return 'yes';
	}
	else
	{
		return 'no';
	}
}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.

Note: Please also add "check_for_cookie_consent" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.

After that, this shortcode can be used in the content like this:


[check_for_cookie_consent type='functional']

The above shortcode will return 'no' if the "functional" category consent is blocked and 'yes' if it is not set or allowed.
( ref: lien caché )

To only show a map, when functional consent is allowed or not blocked, the same shortcode can be used in conditional output blocks, to wrap the map's shortcode like this:
( ref: https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/ )


[wpv-conditional if="( '[check_for_cookie_consent type='functional']' eq 'yes' )"]
[wpv-map-render map_id="map-1"][/wpv-map-render]
[/wpv-conditional]

[wpv-conditional if="( '[check_for_cookie_consent type='functional']' ne 'yes' )"]
You'll need to allow a functional cookie, to view the map!
[/wpv-conditional]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1636905

Hello Waqar,

thanks for the reply. The developer of complianze (Aert) asked, if you could contact him at support@complianz.io because he ran into trouble.

Best wishes, Daniel

#1637187

Hello,

Waqas is on vacation, I will take care this ticket.

According to our support policy, we don't provide support for other plugins.

And the solution mentioned above is only a custom shortcode to get cookie value, it should make trouble:
https://toolset.com/forums/topic/block-google-maps-with-complianz-in-a-multisite/#post-1632135
What is the trouble are we talking about, please elaborate the question with more details.
And you can also provide a test site with the same problem, also point out the problem page URL, I need a live website to test and debug.