Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1162980

    hi folks,

    i have a problem with the value of the cookie stored for the cookie consent on multisite (not subdomain)

    my structure is:
    XXX.DOMAIN.XX
    XXX.DOMAIN.XX/SITENAME1/
    XXX.DOMAIN.XX/SITENAME2/

    so….
    as in helper-privacy.php on line 1502 the variable $cookie_contents has a different value
    on every subsite the cookie is overwritten on every subsite reload.
    this leads to the problem that i have to accept the cookie-consent on every pageload when changing from on to another site.

    my questions:
    – is it possible to set one identical VALUE to every site (quickly)
    – can you implement a check so i have not fix that on every update

    greez
    rene

    • This topic was modified 5 years ago by isee.
    #1163439

    Hey rene,

    Thank you for using enfold – and for reporting this.

    Seems to be a not very common problem – so we will provide a filter that allows you to return a value you can customize. You can hardcode a fixed value in the fiter that is returned for all sites and when you need a new popup just change the returned value in the filter.

    As a quick fix:

    In helper-privacy.php line 1502 you find:

    
    $cookie_contents = md5( $cookie_contents ) . '||v1.0';
    

    Before this line add:

    
    $cookie_contents = apply_filters( 'avf_cookie_consent_for_md5', $cookie_contents, $message, $buttons );
    

    And in functions.php of your child theme add:

    https://github.com/KriesiMedia/enfold-library/blob/master/actions%20and%20filters/Privacy%20and%20Cookies/avf_cookie_consent_for_md5.php

    The filter will become part of the next update.

    Hope this helps you.

    If you need assistance let us know and we can do it for you.

    Best regards,
    Günter

    #1173468

    hi günter, sorry for beeing so late with my response…
    i thank you very much for your support and implementing that in 4.7 :-)

    for now im not sure how to really do it, i tried (very quick) like so:

    function custom_avf_cookie_consent_for_md5( $cookie_contents, $message, $buttons )
    {
    	$cookie_contents = '14e61ea2d6fd3ee9851c9016aa79ba9b||v1.0';
    	return $cookie_contents;
    }
    apply_filters( 'avf_cookie_consent_for_md5', 'custom_avf_cookie_consent_for_md5', 10, 3 );

    but tis is not enough so i have to look what to do exactly

    greez
    rene

    • This reply was modified 4 years, 11 months ago by isee.
    #1173553

    Hi,

    Can you try to use something like:

    
    $cookie_contents = 'This is my cookie contents for all sites.';
    

    If this does not work, can you give us wp admin backend access so we can check and try to modify the code. We might need to add some debugging output.

    Best regards,
    Günter

    #1173568

    i will try the next days and give a feedback

    #1217896

    hello again :-)
    after a long time i found time to take care of this problem.

    Solution:
    Apply the Filter like so:

    function custom_avf_cookie_consent_for_md5( $cookie_contents, $message, $buttons ) {
    	$cookie_contents = 'YOUR OWN CONTENT HERE';
    	return $cookie_contents;
    }
    
    add_filter( 'avf_cookie_consent_for_md5', 'custom_avf_cookie_consent_for_md5', 10, 3 );

    I changed apply_filters to add_filter

    now it works, but the content set to $cookie_contents runs again through md5( $cookie_contents ) in your helper-privacy.php / Line 1682. This causes no real problem, but its quite strange during debugging :-)

    if you like you can maybe change on line 1682 from
    $cookie_contents = md5( $cookie_contents ) . '||v1.0';
    to
    if (empty($cookie_contents)) { $cookie_contents = md5( $cookie_contents ) . '||v1.0'; }

    greez
    rene

    • This reply was modified 4 years, 6 months ago by isee.
    #1220845

    Hi,

    Glad to know that you figured it out. We will probably not change that line for now because this is a special case and not many is actually changing the cookie contents. But we’ll keep the thread open.

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.