Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: nikan on May 19, 2013, 02:07:30 AM

Title: EU Cookie
Post by: nikan on May 19, 2013, 02:07:30 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3693)

Introduction
The EU Cookie mod displays a floating box in the bottom of the page which informs visitors and members about the use of cookies on the site.

Warning:
Check your local law and make the appropriate changes, to comply with the EU Cookie Law.


Features
* Displays a black semi transparent floating box to visitors and members
* Admins don't see this box

Languages
english
english-utf8
greek
greek-utf8
italian
italian-utf8

History
1.3.1 - Fix for expiration date on Safari (thanks signaleleven)
1.3 - Fix for flash view the notice before being hidden (thanks signaleleven)
      - Added Italian translation (thanks mano82)
1.2 - Added the option to change the notification text
1.1 - Added enable/disable function
      - Added black/white color selection
      - Added option for link of Cookie Policy Page URL
1.0.3 - Better centering position
1.0.2 - Changed the position to bottom center and the text to be more simple
1.0.1 - Changed the information text to be more understandable
1.0    - Initial release
Title: Re: EU Cookie
Post by: Antechinus on May 19, 2013, 03:25:26 AM
Does it allow them to opt out of cookies?
Title: Re: EU Cookie
Post by: Colin on May 19, 2013, 03:28:34 AM
It doesn't look like it. To opt out of cookies they would just leave the website.
Title: Re: EU Cookie
Post by: Antechinus on May 19, 2013, 03:33:40 AM
Ah. See that doesn't actually help matters much. Strictly speaking, under EU law you're supposed to allow people the option of not accepting cookies.
Title: Re: EU Cookie
Post by: Colin on May 19, 2013, 04:09:00 AM
Which is, if you look at many other sites that have implemented similar functionality, just redirect you to google if you click no.
Title: Re: EU Cookie
Post by: sangham.net on May 19, 2013, 05:22:55 AM
Thanks for sharing such, Nikan. Very thoughtful intention. How could I help to provide a German translation? Can you provide a file, where I could put such into?
Sorry for not knowing how to do yet.

(http://sangham.net/Smileys/sangham/kiss.gif)
Title: Re: EU Cookie
Post by: Colin on May 19, 2013, 05:27:33 AM

$txt['eucookie_info'] = 'The setting of cookies on this site is set to "Accept all cookies", to give you the best browsing experience. By continuing to use this site without changing the cookies settings or click on the "Accept" button, then you agree with it.';
$txt['eucookie_accept'] = 'Accept';


Title: Re: EU Cookie
Post by: Adrek on May 19, 2013, 05:34:47 AM
Here in Poland, we have to let users know that site is using cookies. In this information is written that they (users) can manage cookie settings in browser settings and that's enough here, don't know how it is in other european countries..  ::)
Title: Re: EU Cookie
Post by: sangham.net on May 19, 2013, 07:35:50 AM
Quote from: Colin on May 19, 2013, 05:27:33 AM

$txt['eucookie_info'] = 'The setting of cookies on this site is set to "Accept all cookies", to give you the best browsing experience. By continuing to use this site without changing the cookies settings or click on the "Accept" button, then you agree with it.';
$txt['eucookie_accept'] = 'Accept';


I assume that this is the main Text.

In "German (Sie)" [formal]

$txt['eucookie_info'] = 'Die Einstellungen für Cookies auf dieser Seite, sind auf "Cookies akzeptieren" gesetzt und dies ermöglicht Ihnen eine angenehme Nutzung des Angebotes hier.  Mit dem Fortsetzen der Nutzung der Seite, ohne die Cookie-Einstellungen zu ändern, oder mit dem Betätigen des "Einverstanden"-Digitalstellknopf, akzeptieren Sie diese Einstellungen.';
$txt['eucookie_accept'] = 'Einverstanden';


In "German (Du)" [in-formal]

$txt['eucookie_info'] = 'Die Einstellungen für Cookies auf dieser Seite, sind auf "Cookies akzeptieren" gesetzt und ermöglicht Dir ein angenehme Nutzung des Angebotes hier.  Mit dem Fortsetzen der Nutzung der Seite, ohne die Cookie-Einstellungen zu ändern, oder mit dem Betätigen des "Einverstanden"-Button, akzeptierst Du diese Einstellungen.';
$txt['eucookie_accept'] = 'Einverstanden';

Title: Re: EU Cookie
Post by: Antechinus on May 19, 2013, 04:44:10 PM
Quote from: phantomm on May 19, 2013, 05:34:47 AM
Here in Poland, we have to let users know that site is using cookies. In this information is written that they (users) can manage cookie settings in browser settings and that's enough here, don't know how it is in other european countries..  ::)
That's the solution I went for too. I even gave them instructions for how to block cookies on a per site basis, or completely for the entire web, for all the main browsers. I figure that more than meets the intent of the law, even if it doesn't quite meet the wording in every country. The UK authorities require sites to make a "good faith attempt" to comply with the law, which IMO is what we have done.
Title: Re: EU Cookie
Post by: Colin on May 19, 2013, 06:00:11 PM
Awesome Johann!

That is very nice of you.
Title: Re: EU Cookie
Post by: Gryzor on May 20, 2013, 05:39:21 AM
The English test is not quite correct... I'd go for something like this:


"This site uses cookies to give you the best browsing experience. By continuing to use this site, or by clicking on the "Accept" button, you agree to the use of cookies."
Title: Re: EU Cookie
Post by: Colin on May 21, 2013, 01:24:11 AM
That does seem like cleaner phraesology. Maybe even


"This site uses cookies in order to offer the optimal browsing experience. By continuing to use this site or selecting "Accept" you consent to the use of cookies"
Title: Re: EU Cookie
Post by: Gryzor on May 21, 2013, 02:10:10 AM
Yup, even better. But it really needs to be changed, it's quite hard to understand as it is :D
Title: Re: EU Cookie
Post by: lurkalot on May 27, 2013, 03:50:11 AM
Any way of hiding this permanently for registered members, once they've clicked the accept button? 

It's a great mod, but I can see my members getting annoyed with it.
Title: Re: EU Cookie
Post by: nikan on June 03, 2013, 03:03:35 PM
*** Please don't abuse this topic with discussion on the law. ***

The purpose of this mod is to inform guests and members that cookie settings of their browser is to allow cookies and the site uses them for better experience. In further, you can create a Cookie Policy page.
Guests and members that accepting this, use cookies and the state is stored there. If they don't use cookies, they will see the message again.

The information text is placed here:
Themes/default/languages/Modifications.{language}.php
Title: Re: EU Cookie
Post by: sangham.net on June 04, 2013, 06:30:24 AM
Dear Nikan,

The question of lurkalot was:

"Any way of hiding this permanently for registered members, once they've clicked the accept button?"

So will it pop up once more if it is pushed once? I understand his concern and it's really not an abuse as well as laws are for sure the main reason for such a mod.
It's really more that great that you came up with this mod !! and I would not see little side discussions as useless in its regard. If somebody does not care about laws, that mod is at least not really needed (when banner law discussions in regard of the mod, the mod disqualifies itself in some ways, wouldn't it?

Maybe the how and why it pops up needs to be more explained and maybe a little modified (or made modifiable).
As it is a very law issue, its maybe also interesting to make the display text easy changeable so that users can edit it according to their local laws and circumstance (thought on private, company, organization... as well)

(http://sangham.net/Smileys/sangham/sadhu_sangham_sw.gif)
Title: Re: EU Cookie
Post by: impreza on June 09, 2013, 04:30:12 AM
A useful addition, thank you for the
Title: Re: EU Cookie
Post by: feline on June 09, 2013, 08:17:38 AM
This mod don't suppress the settings of cookies.
So it's not conform with the ECL because if you visit a site, a SMF cookies is set immediate.

You can look on our sites when you see a correct implementation of the ECL  ;)
Title: Re: EU Cookie
Post by: lurkalot on June 09, 2013, 08:26:30 AM
Quote from: feline on June 09, 2013, 08:17:38 AM
This mod don't suppress the settings of cookies.
So it's not conform with the ECL because if you visit a site, a SMF cookies is set immediate.

You can look on our sites when you see a correct implementation of the ECL  ;)

feline, does your notification disappear permanently after clicking the accept button?  If so, what mod are you using? scratch that last question, I see it's built into your portal.  :'(
Title: Re: EU Cookie
Post by: feline on June 09, 2013, 08:40:16 AM
Quote from: lurkalot on June 09, 2013, 08:26:30 AM
feline, does your notification disappear permanently after clicking the accept button?  If so, what mod are you using?  This mod is driving my members away atm..
If you have accepte the ECL OptIn it's valid for 30 days and you can navigate around the entire Site.
And what we use in not a standalone mod, it's implemeted in our Portal software.
Title: Re: EU Cookie
Post by: lurkalot on June 09, 2013, 08:45:36 AM
Thanks, yes I just noticed that in your signature, and edited my last post accordingly. Shame this mod doesn't work in a similar way, the bloomin thing pops up on your screen every time you visit the site. and in between page loads sometimes.  ???
Title: Re: EU Cookie
Post by: lurkalot on June 09, 2013, 01:56:20 PM
I'm running this mod, and not sure how accurate this test is, but I ran my site through  http://sitebeam.net/tests/featured-tests/cookie-law-report and it failed miserably.  Got a score of 0 out of 10
Title: Re: EU Cookie
Post by: dimspace on June 09, 2013, 06:45:43 PM
Quote from: lurkalot on May 27, 2013, 03:50:11 AM
Any way of hiding this permanently for registered members, once they've clicked the accept button? 

It's a great mod, but I can see my members getting annoyed with it.

the usual way of remembering that users have accepted the cookie prompt, is by um.. a cookie.. :D
Title: Re: EU Cookie
Post by: nikan on June 10, 2013, 01:52:27 AM
lurkalot nobody forces you to use this mod. If you don't like it or it doesn't do what you expected to do, find another way.
Title: Re: EU Cookie
Post by: lurkalot on June 10, 2013, 03:44:32 AM
Quote from: nikan on June 10, 2013, 01:52:27 AM
@Johann B
Read carefully the Introduction of my mod and stop bumbing this topic.

@lurkalot
Nobody forces you to use this mod. If you don't like it or it dosnt do what you expected to do, find another way.

@nikan 
I could have sworn I clicked the "Support and comments" link for your mod, but it seems you don't like comments, or give support. 

I do like the mod, and merely asked if there was a way to hide the cookie notice for logged in members permanently after they click accept. I see no reason why they should keep seeing it, that's all.

Title: Re: EU Cookie
Post by: nikan on June 10, 2013, 10:01:54 AM
lurkalot i already answer on this and also answered by dimspace.
Quote from: dimspace on June 09, 2013, 06:45:43 PM
Quote from: lurkalot on May 27, 2013, 03:50:11 AM
Any way of hiding this permanently for registered members, once they've clicked the accept button? 

It's a great mod, but I can see my members getting annoyed with it.

the usual way of remembering that users have accepted the cookie prompt, is by um.. a cookie.. :D
I'll answer again if this can help.
The state of accepting is stored in a cookie, so if any of your members has cookies disabled in their browser they will see the message again. Sorry if you felt unsupported.
Title: Re: EU Cookie
Post by: lurkalot on June 10, 2013, 01:54:30 PM
Quote from: nikan on June 10, 2013, 10:01:54 AM
Seems to me that you are way of the track Johann B. You forget that my mod is based on free time work and it's not a product for sale.-


lurkalot i already answer on this and also answered by dimspace.
Quote from: dimspace on June 09, 2013, 06:45:43 PM
Quote from: lurkalot on May 27, 2013, 03:50:11 AM
Any way of hiding this permanently for registered members, once they've clicked the accept button? 

It's a great mod, but I can see my members getting annoyed with it.

the usual way of remembering that users have accepted the cookie prompt, is by um.. a cookie.. :D
I'll answer again if this can help.
The state of accepting is stored in a cookie, so if any of your members has cookies disabled in their browser they will see the message again. Sorry if you felt unsupported.

Thanks, and sorry for sounding off.

OK, maybe I don't understand how this cookie stuff works.  But I manually added a site address to the "Per site privacy" and set it to allow cookies from this site, and it still pops up on the screen each session.  Also used this http://www.whatarecookies.com/cookietest.asp and it says cookies are enabled in my browser.
Title: Re: EU Cookie
Post by: kat on June 10, 2013, 04:26:21 PM
Can we, please, refrain from arguing about the so-called legality of what this mod does?

I've notified the customisers about this and they'll take a look at it. If they feel it's required, they'll make some comments. Until then, can we cool it off, here, please?
Title: Re: EU Cookie
Post by: Colin on June 12, 2013, 06:31:32 AM
SM, SMF, and the mod author cannot be held legally responsible for a mod's use, nor its legality. With this, particular mod, we would like to recommend that the mod's author adds a warning about the limits of its functionality and legality.
Title: Re: EU Cookie
Post by: pugsx on July 17, 2013, 02:34:29 PM
is there a way of making this show on other pages on the site aswell?

PugsX
Title: Re: EU Cookie
Post by: Colin on July 17, 2013, 02:42:13 PM
It is an SMF mod so it doesn't by default extend past the SMF pages. I suppose you could take the code and place it manually on other pages of your site.
Title: Re: EU Cookie
Post by: LadyAngel on April 16, 2014, 11:58:55 AM
When using a custom theme, the notification doesn't go when the 'ok' button is clicked.
Title: Re: EU Cookie
Post by: nikan on April 16, 2014, 12:29:12 PM
Did you install the mod on your custom theme?
Also make sure that you clear the cache of smf.
Title: Re: EU Cookie
Post by: LadyAngel on April 16, 2014, 12:54:02 PM
Thank you, yes to both. :) It works on the default theme, just not on any custom ones, though it still shows.
Title: Re: EU Cookie
Post by: nikan on April 16, 2014, 01:08:38 PM
Maybe your custom theme loads the jquery library and conflicts with the mod function.
Title: Re: EU Cookie
Post by: LadyAngel on April 17, 2014, 05:28:28 AM
Em...ok...how to fix that?
Title: Re: EU Cookie
Post by: nikan on April 18, 2014, 02:47:47 AM
Try changing the $ to jQuery
Title: Re: EU Cookie
Post by: signaleleven on May 30, 2015, 02:34:21 PM
Hey Nikan,

What if I want to submit changes to the mod?
Your mod displays the banner, then checks the cookie, and if the cookie is set it hides the banner.

I reversed that logic. The banner is hidden, if the cookie is unset then it is shown. Without that change, some users saw the banner "flash" briefly before being hidden.

Do you have a repository where I can submit the changes?


Cheers
Mike
Title: Re: EU Cookie
Post by: nikan on May 31, 2015, 06:01:48 AM
You can post your changes here.
I'll be happy to add any change that will make the mod more efficient.
Title: Re: EU Cookie
Post by: signaleleven on May 31, 2015, 06:15:48 AM
Quote from: nikan on May 31, 2015, 06:01:48 AM
You can post your changes here.
I'll be happy to add any change that will make the mod more efficient.

In Load.php

        // EU cookie mod
        if (!$user_info['is_admin'] && !empty($modSettings['enable_eucookie']))
                $context['html_headers'] .= '
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script type="text/javascript">
                jQuery(document).ready(function(){
                        var cookieSet = document.cookie.indexOf("eu_cookie=") != -1;
                        if(!cookieSet){
                                jQuery("#cookie_button").click(function(){
                                        var expire = new Date();
                                        expire.setDate(expire.getDate() + 30);
                                        document.cookie = "eu_cookie=1; path=/; expires=" + expire;
                                        jQuery(".cookie_wrap").fadeOut("fast");
                                });
                                jQuery(".cookie_wrap").css("visibility", "visible"); /* Visible only if the cookie is not set! */
                        }
                });
        </script>';


In index css


.cookie_wrap
{
        position: fixed;
        width: 100%;
        bottom: 20px;
        text-align: center;
        z-index: 9999;
        visibility: hidden; /* THIS was added */
}




I hope this helps!
Title: Re: EU Cookie
Post by: nikan on May 31, 2015, 11:06:29 AM
The mod updated with the code change.

Thanks signaleleven.
Title: Re: EU Cookie
Post by: Hatchan on June 01, 2015, 06:53:01 AM
Greetings to all...

I'm having a few issues with this mod, since it seems I cannot make it shows :(

I've installed it and activated it from the admin panel. Still, it doesn't show.
I already tried to see if it works when I'm logged out with no results. I've cleaned the cache, but still it doesn't appear.

Any help?
Title: Re: EU Cookie
Post by: laudia on June 03, 2015, 08:55:49 AM
Hi nikan, you could add the possibility to enter a custom color? options to enter the code for background: and color: css (in the format #fff). This way if you have a custom theme everyone can add his.


Quote from: nikan on June 10, 2013, 10:01:54 AM
lurkalot i already answer on this and also answered by dimspace.
Quote from: dimspace on June 09, 2013, 06:45:43 PM
Quote from: lurkalot on May 27, 2013, 03:50:11 AM
Any way of hiding this permanently for registered members, once they've clicked the accept button? 

It's a great mod, but I can see my members getting annoyed with it.

the usual way of remembering that users have accepted the cookie prompt, is by um.. a cookie.. :D
I'll answer again if this can help.
The state of accepting is stored in a cookie, so if any of your members has cookies disabled in their browser they will see the message again. Sorry if you felt unsupported.

p.s. to get what he asks you lurkalot, you can change
if (! $ context ['user'] ['is_admin']
in index.template.php, in
if ($ context ['user'] ['is_guest']
however, if it is not logged in you will see
Title: Re: EU Cookie
Post by: mano82 on June 16, 2015, 02:45:23 AM
hey Nikan,

thanks for the package.

I've made a little hack for my site adding italian. Here's the translation code if you're interested to upgrade.

change in install2.xml
<file name="$languagedir/Modifications.italian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// EU Cookie
$txt['mods_cat_eucookie'] = 'EU Cookie';
$txt['enable_eucookie'] = 'Attiva EU Cookie';
$txt['eucookie_color'] = 'Seleziona il colore';
$txt['eucookie_black'] = 'Nero';
$txt['eucookie_white'] = 'Bianco';
$txt['eucookie_notice'] = 'Testo di notifica:';
$txt['eucookie_text'] = 'I Cookies ci aiutano a fornirti una migliore esperienza di navigazione. Utilizzando il nostro sito, ci autorizzi all\'uso dei cookies.';
$txt['eucookie_policy'] = 'URL pagina di approfondimento';
$txt['eucookie_more'] = 'Scopri di più';
]]></add>
</operation>
</file>


change in install-utf8.xml
<file name="$languagedir/Modifications.italian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// EU Cookie
$txt['mods_cat_eucookie'] = 'EU Cookie';
$txt['enable_eucookie'] = 'Attiva EU Cookie';
$txt['eucookie_color'] = 'Seleziona il colore';
$txt['eucookie_black'] = 'Nero';
$txt['eucookie_white'] = 'Bianco';
$txt['eucookie_notice'] = 'Testo di notifica:';
$txt['eucookie_text'] = 'I Cookies ci aiutano a fornirti una migliore esperienza di navigazione. Utilizzando il nostro sito, ci autorizzi all\'uso dei cookies.';
$txt['eucookie_policy'] = 'URL pagina di approfondimento';
$txt['eucookie_more'] = 'Scopri di più';
]]></add>
</operation>
</file>


attached the complete modified package.
Title: Re: EU Cookie
Post by: nikan on June 18, 2015, 04:31:41 AM
Updated with Italian translation.

Thanks mano82.
Title: Re: EU Cookie
Post by: Topman on June 22, 2015, 07:40:51 AM
I have just added this to the registration agreement:
"By registering, you agree to you accept the use of cookies on this website in accordance as required by the  EU Cookie Directive 2009/136/ec and agree to abide by all FORUM RULES[/url].  FOR MORE INFORMATION ON COOKIES[/url]"
Title: Re: EU Cookie
Post by: Kindred on June 22, 2015, 09:54:05 AM
that is not actually sufficient for the EU law.
Title: Re: EU Cookie
Post by: signaleleven on June 23, 2015, 01:47:29 PM
I have fixed another bug.
The cookie, on safari, was set as a session cookie. Safari was ignoring the expiration date, because it must be in UTC/GMT format.
Some of my users use safari, and they reported it. It took me one hour of debugging :(

In Load.php

        // EU cookie mod
        if (!$user_info['is_admin'] && !empty($modSettings['enable_eucookie']))
                $context['html_headers'] .= '
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script type="text/javascript">
                jQuery(document).ready(function(){
                        var cookieSet = document.cookie.indexOf("eu_cookie=") != -1;
                        if(!cookieSet){
                                jQuery("#cookie_button").click(function(){
                                        var expire = new Date();
                                        expire.setDate(expire.getDate() + 30);
                                        document.cookie = "eu_cookie=1; path=/; expires=" + expire.toUTCString();
                                        jQuery(".cookie_wrap").fadeOut("fast");
                                });
                                jQuery(".cookie_wrap").css("visibility", "visible"); /* Visible only if the cookie is not set! */
                        }
                });
        </script>';




The only change is the .toUTCString(); added to the expire variable while setting the cookie.
Title: Re: EU Cookie
Post by: nikan on June 23, 2015, 02:39:53 PM
Updated with fix for expiration date on Safari.

Thanks signaleleven.
Title: Re: EU Cookie
Post by: Topman on June 24, 2015, 05:21:55 AM
Quote from: Kindred on June 22, 2015, 09:54:05 AM
that is not actually sufficient for the EU law.

It's "sufficient" for me! 
There is no EU cookie warning on this website is there, or have I missed it?
Title: Re: EU Cookie
Post by: Kindred on June 24, 2015, 07:00:40 AM
There is not... because we are a US company with servers in the US.
Title: Re: EU Cookie
Post by: Topman on June 27, 2015, 06:32:56 AM
Quote from: Kindred on June 24, 2015, 07:00:40 AM
There is not... because we are a US company with servers in the US.

It doesn't matter. The website is accessible in the EU countries. 
Google has a cookie warning as does Facebook!
Title: Re: EU Cookie
Post by: Empire KickAss on June 27, 2015, 10:29:09 AM
So is it a good idea to have this installed? I don't know if I want it or not
Title: Re: EU Cookie
Post by: signaleleven on June 27, 2015, 10:33:04 AM
Quote from: topman on June 27, 2015, 06:32:56 AM
Quote from: Kindred on June 24, 2015, 07:00:40 AM
There is not... because we are a US company with servers in the US.

It doesn't matter. The website is accessible in the EU countries. 
Google has a cookie warning as does Facebook!

It's really controversial. Google and FB have offices in europe and business in europe. They are not merely accessible from europe. They specifically target the market.

If tomorrow Iran passes a law that every website accessible to Iran has to show a privacy policy written in Farsi, would it be your job to either do it or make it so that you are not accessible from Iran?
I didn't think so :)

Title: Re: EU Cookie
Post by: Topman on June 29, 2015, 03:16:56 AM
Exactly!  This EU rule is rubbish!
Unless you are a huge commercial company operating in the EU countries I think it can be ignored as far as forums are concerned.
LOB  IMO
Title: Re: EU Cookie
Post by: Kindred on July 04, 2015, 10:34:18 PM
Quote from: topman on June 27, 2015, 06:32:56 AM
Quote from: Kindred on June 24, 2015, 07:00:40 AM
There is not... because we are a US company with servers in the US.

It doesn't matter. The website is accessible in the EU countries. 
Google has a cookie warning as does Facebook!

We are a US company with servers in the US.
We have no European presence (in terms of locations or equipment)
US law is technically the only thing that SM needs to follow.
We do not fall into the same category of google or facebook -- who both have a physical EU presence (offices and servers)
Title: Re: EU Cookie
Post by: Niko_Bellic on July 05, 2015, 12:39:27 PM
So, does this mean, that if my server is housed in the USA, I do not need to worry about the cookie issue?
I don't need this mod, then?
Title: Re: EU Cookie
Post by: Shambles on July 05, 2015, 12:55:34 PM
Quote from: NikoBellic
So, does this mean, that if my server is housed in the USA, I do not need to worry about the cookie issue?
I don't need this mod, then?

Dunno where in the world you are, but here in the UK we can access "google", which reveals the answer.

http://www.cookielaw.org/the-cookie-law/
Title: Re: EU Cookie
Post by: Niko_Bellic on July 05, 2015, 12:58:02 PM
Yes, I have access too. What an amazing thing the internet is...
Lets us search, and be rude all in one post.
Title: Re: EU Cookie
Post by: Shambles on July 05, 2015, 01:04:41 PM
Quote from: NikoBellic
Lets us search ...

Now you're getting it.
Title: Re: EU Cookie
Post by: Niko_Bellic on July 05, 2015, 01:17:37 PM
Well, excuse me, for asking in the topic for the mod, about if it is needed.
I really expected a little better of a reply, than that. I guess it's time to test a feature here in SMF. The Ignore User list.
Nice knowing you, Shambles.
Title: Re: EU Cookie
Post by: Shambles on July 05, 2015, 01:20:46 PM
I can honestly say, I've never before seen anyone post in a mod support thread asking if they need the mod  ::)
Title: Re: EU Cookie
Post by: Niko_Bellic on July 05, 2015, 01:41:15 PM
Well, if you read the posts before, that is why I had asked.
Title: Re: EU Cookie
Post by: Topman on July 14, 2015, 01:55:45 AM
To clarify:
In the UK and the EU you "should" have this.
Quote"All websites owned in the EU or targeted towards EU citizens, are now expected to comply with the law."

But.............. do you really think a non-commercial website is going to be reported to the ICO for not having it?
What does the ICO then do?  They write to you.  You then 'comply' and avoid any further action.

Do you really think the EU is really going to hound forum admins all over the world for not having this on their forum.
Surely they are more worried about lending Greece another 89bn euros and whether they will be getting anything back lol!

How about someone do a Freedom of Information request and find out just how many UK websites have had action taken against them for not having a cookie widget warning.  My guess is not one in four years!
A recent sweep in the EU found that, out of 478 "popular websites" (out of the whole EU!) 26% do not comply at all!
http://www.truste.com/blog/2015/02/27/websites-not-compliance-cookie-directive-could-face-fines/

Do you really think they will be bothering with an individual's forum?
This is a good Mod and does what it should but adds nothing to a forum other than compliance to the EU rule.
Title: Re: EU Cookie
Post by: Topman on July 28, 2015, 02:17:05 AM
OK so the EU cant police everyone's websites but it would appear they have asked Google to do it which of course they can!
After 30 September 2015, if you have Google Adsense ads on your website or forum or blog or any website for that matter, you must now  use an "EU user consent" policy.

Presumably, if you don't Google will delete your Adsense account, complete with any earnings you may have accrued on 1 October!

So if you want to keep the "ad cents" you get paid (sometimes) after Google authenticates the clicks and deducts up to 30%, you better use this Mod on your Forum in the EU.
Title: Re: EU Cookie
Post by: Topman on July 28, 2015, 03:38:38 AM
But does this Mod do what Google demands?
QuoteEU user consent policy

When using Google products that incorporate this policy, certain disclosures must be given to and consents obtained from end users in the European Union.

For end users in the European Union:

You must use commercially reasonable efforts to disclose clearly, and obtain consent to, any data collection, sharing and usage that takes place on any site, app, email publication or other property as a consequence of your use of Google products; and
You must use commercially reasonable efforts to ensure that an end user is provided with clear and comprehensive information about, and consents to, the storing and accessing of cookies or other information on the end user's device where such activity occurs in connection with a product to which this policy applies.
Title: Re: EU Cookie
Post by: feline on July 28, 2015, 05:18:41 AM
You habe to supress the output of Google ADS until the Cookie storage is accepted.
That's I think is what Google mean ...
Title: Re: EU Cookie
Post by: Kindred on July 28, 2015, 06:51:28 AM
do note: that policy has nothing to do with the SITE and is solely to do with the use of google products on a site (as Feline points out)

So - once again - there is no need to do anything for US, etc sites, unless your use of Google products exposes google product cookies to the user. (but this still has nothing at all to do with the forum cookie etc)

And no... this mod would NOT cover the google product notification, since this mod does not prevent anything from showing and does not link to your google adsense or any other feature
Title: Re: EU Cookie
Post by: nikan on July 28, 2015, 01:57:49 PM
This mod does not suppress any cookie. That's why there is a description for the mod, it's a cookie notice to the users.
Any member of a forum that have rights to install a mod, have the required knowledge and they are responsible for their site.
This mod and a cookie policy page, can legally cover your forum about the use of cookies. Google says, google does.

If you are so afraid of the law, maybe you have a reason, please DON'T use this mod or even better don't use smf.
If this mod does not do what you wanna do on your forum, please DON'T use this mod.

PLEASE, do not spam the support thread of this mod.
Title: Re: EU Cookie
Post by: feline on July 28, 2015, 07:58:40 PM
Lesenswert .. read this ..

http://www.cookiechoices.org/

Wird Zeit, das SMF das mal berücksichtigt. Immerhin gibt es viele User aus der EU die SMF einsetzen ...
Title: Re: EU Cookie
Post by: Topman on July 29, 2015, 01:56:54 AM
Quote from: nikan on July 28, 2015, 01:57:49 PM
This mod does not suppress any cookie. That's why there is a description for the mod, it's a cookie notice to the users.
Any member of a forum that have rights to install a mod, have the required knowledge and they are responsible for their site.
This mod and a cookie policy page, can legally cover your forum about the use of cookies. Google says, google does.

If you are so afraid of the law, maybe you have a reason, please DON'T use this mod or even better don't use smf.
If this mod does not do what you wanna do on your forum, please DON'T use this mod.

PLEASE, do not spam the support thread of this mod.

Not sure who this was aimed at but it should NOT have been at me!

I am not spamming, the EU Cookie Law needs and is worthy of discussion.
If the Mod doesn't comply then there is no point. If as I think it does, then all I am saying to SMF forum Admins in the EU, if you want to keep your Google ad cents account after 30 September 2015 you need something that complies with Google policies.

This issues is regarding the Google "policy" and cookies used by Google for analytics and adsense.
NOT any cookies the SMF forum users and whether these are relevant to the EU Cookie Law.

Why are some people so unnecessarily aggressive and defensive on this forum?
Title: Re: EU Cookie
Post by: MESWEB on August 16, 2015, 01:52:07 PM
I'm install this mod and enable it but nothing happening. There is no show any popup with cookie info.
Title: Re: EU Cookie
Post by: Topman on September 15, 2015, 01:52:23 AM
OK its all been up and working for a month or so but......................
When tested using http://trial.sitebeam.net/reports/view/?siteId=85654&testRequestId=129222

I get the following:-
QuoteThis site does not appear to be compliant with the Cookie Law
Cookies were set by the website and no recognised cookie solution was found. You should check the website manually to see if it clearly informs users about the cookies that are set.

Does this mean it will fail Google at the end of this month?

Perhaps this Mod needs an update?
Title: Re: EU Cookie
Post by: margarett on September 15, 2015, 08:38:47 AM
As I understand it, the mod warns about the usage of cookies, it doesn't prevent cookies from being deployed until the user accepts (which is what the cookie law states)
Title: Re: EU Cookie
Post by: Topman on September 16, 2015, 10:55:19 AM
Exactly! And the tools Google will probably use wont even detect that!
It's all a bloody nuisance for everyone!
Website owners and users alike.
Perhaps we (UK) can get out of the EU in 2017 then we all wont have to bother with this rubbish!
Title: Re: EU Cookie
Post by: romanos8 on October 03, 2015, 12:45:40 PM
The mod is not working for me. The installation is done but after redirection it gave error 404 also when I go to the forum it shows many source characters at the top. Please help.
Title: Re: EU Cookie
Post by: -Rock Lee- on October 03, 2015, 12:55:33 PM
Quote from: romanos8 on October 03, 2015, 12:45:40 PM
The mod is not working for me. The installation is done but after redirection it gave error 404 also when I go to the forum it shows many source characters at the top. Please help.

You must create a separate issue to help leaving a little more data ... as version? ¿Url? help us to help you!


Greetings!
Title: Re: EU Cookie
Post by: RedPanda2013 on February 05, 2017, 07:03:27 AM
Please HELP ME :(

I just learned about this crappy law and although I am based in Australia, my website is targeting Italians and the Italian Privacy Regulator stated that even sites from outside the EU must comply with the law  :-X

They specifically stated that a link to the privacy and cookie policy must exist at the bottom of EACH page so how do I add the link in the bottom of my SMF????

Thank you

Title: Re: EU Cookie
Post by: Kindred on February 05, 2017, 07:26:06 AM
Well, they are actually exceeding their authority. If your business and your servers are outside of the EU, they can't enforce the EU cookie law. They really can't.

However, if you want to do it, you would add a link in index.template.php

search for $forum_copyright and you can put your link somewhere near that to have it in the footer.
(please note, templates are a combination of html and php...  you can't just put random html into the code  it has to be properly placed within an echo statement)
Title: Re: EU Cookie
Post by: lurkalot on February 05, 2017, 07:30:12 AM
Quote from: RedPanda2013 on February 05, 2017, 07:03:27 AM

They specifically stated that a link to the privacy and cookie policy must exist at the bottom of EACH page so how do I add the link in the bottom of my SMF????

Thank you

It's all well and good having a link pointing to the privacy and cookie policy page, but do you actually have a page on your site to link to?
Title: Re: EU Cookie
Post by: RedPanda2013 on February 05, 2017, 08:16:52 AM
Quote from: Kindred on February 05, 2017, 07:26:06 AM
Well, they are actually exceeding their authority. If your business and your servers are outside of the EU, they can't enforce the EU cookie law. They really can't.

However, if you want to do it, you would add a link in index.template.php

search for $forum_copyright and you can put your link somewhere near that to have it in the footer.
(please note, templates are a combination of html and php...  you can't just put random html into the code  it has to be properly placed within an echo statement)

Thank you, I will try...I know they are ridiculous but I don't want to attract issues given the fact I already had to move the forum once because Italian authorities told local Telcos to filter my URL just because they though I violated one of their stupid rules!!!  >:(
Title: Re: EU Cookie
Post by: RedPanda2013 on February 05, 2017, 08:19:25 AM
Quote from: lurkalot on February 05, 2017, 07:30:12 AM
Quote from: RedPanda2013 on February 05, 2017, 07:03:27 AM

They specifically stated that a link to the privacy and cookie policy must exist at the bottom of EACH page so how do I add the link in the bottom of my SMF????

Thank you

It's all well and good having a link pointing to the privacy and cookie policy page, but do you actually have a page on your site to link to?

Yes, I just created it...it's a million words  >:(

And I still need to figure out how to add the pop-up, then notify the Italian authorities because I did not anonimize Google Analytics.  >:(

For WordPress I found a nice plugin but for the forum...is the mod in this topic the best way to go?

Thank you
Title: Re: EU Cookie
Post by: RedPanda2013 on February 05, 2017, 09:13:53 AM
well in the mean time I installed this mod, however I tested it in different browsers and with Chrome and Firefox I get an issue:

The black bar stays at the bottom of the forum, not just the visible bottom of the screen, but at the bottom of the page so if the user does not scroll down till the bottom of the page, he/she won't see anything.

It's working fine on IE.
Title: Re: EU Cookie
Post by: Rob Lightbody on April 08, 2018, 06:48:27 AM
Installed and working with no issues on 2.0.15.

A great, simple mod.
Title: Re: EU Cookie
Post by: Bigguy on May 20, 2018, 05:29:08 PM
Quote from: RedPanda2013 on February 05, 2017, 09:13:53 AM
well in the mean time I installed this mod, however I tested it in different browsers and with Chrome and Firefox I get an issue:

The black bar stays at the bottom of the forum, not just the visible bottom of the screen, but at the bottom of the page so if the user does not scroll down till the bottom of the page, he/she won't see anything.

It's working fine on IE.


I had similar issues with it on 2.1
Title: Re: EU Cookie
Post by: petb on May 25, 2018, 12:59:10 PM
Reproducable Error on 2.0.15 and Chrome.
Anyone knows another mod for an cookie alert?
Title: Re: EU Cookie
Post by: nikan on May 25, 2018, 05:01:31 PM
The mod is working with no issues on 2.0.15 and with Firefox, Chrome, IE.
Any problem may occur is probably a compatibility issue with other installed mod on stylesheet / javascript.
Title: Re: EU Cookie
Post by: petb on May 25, 2018, 05:13:23 PM
I found out that the CSS styles are not used in Chrome, but in Firefox and Edge.
Title: Re: EU Cookie
Post by: Kindred on May 25, 2018, 08:46:05 PM
That is incorrect.

Chrome uses css stylehseets just fine.
Title: Re: EU Cookie
Post by: petb on May 26, 2018, 02:36:44 AM
Yes, in general already.

But in the case of me,
the following CSS properties that the mod in "$themedir/css/index.css" incorporates,
are not inherited from Chrome.

Specifically, these two classes:

.cookie_wrap
{
position: fixed;
width: 100%;
bottom: 20px;
text-align: center;
z-index: 9999;
visibility: hidden;
}
....... placeholder for the others here in the code standing properties
............

.cookie_notice
{
display: inline-block;
margin: 0 auto;
padding: 10px;
border-radius: 5px;
font-size: 12px;
}

were transferred to the "$themedir/css/index.css" file as declared in the install mod,
but, only in Chrome, then not evaluated, they were not visible on both elements ..
That was on all Chrome installations I have on several PCs.
Why? I did not find out on the fast.

Edge and Firefox worked normally.

And as soon as I transferred these properties directly to the two div's using style = "",
they were executed correctly by chrome.

This is my scenario how I solved the problem for myself.

Maybe there is another and better solution, but I did not find it on the fast and that's how it works for me now.
Title: Re: EU Cookie
Post by: BertM on June 18, 2018, 02:31:59 PM
@petb

I seem to have the same problem, but I do not understand your solution..
Title: Re: EU Cookie
Post by: petb on June 18, 2018, 04:31:09 PM
The two css classes are not used by Chrome.
So to overwrite this behavior, you can put them each in a singel style="" Element into each div like this example <div style="put css content here">
Then this is more important and chrome will overtune his behavior.

But sorry, i can't look back, because i didn't use this mod anymore.


Title: Re: EU Cookie
Post by: smartmouse on March 03, 2020, 04:59:06 AM
Hello, will this mod be updated to work with SMF 2.1?
Title: Re: EU Cookie
Post by: Portugal on October 13, 2020, 12:02:59 PM
Hi, ive some problems using this after mod upgrade to 2.0.1.7 version, any chance to have it working again?


Thanks
Portugal
Title: Re: EU Cookie
Post by: uok825 on January 22, 2021, 03:13:51 PM
I did some changes for Turkish. Here is translates:

install2.xml

<file name="$languagedir/Modifications.turkish.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// EU Cookie
$txt['mods_cat_eucookie'] = 'AB Çerezler';
$txt['enable_eucookie'] = 'AB Çerezleri aktifleştir';
$txt['eucookie_color'] = 'Renk Seç';
$txt['eucookie_black'] = 'Siyah';
$txt['eucookie_white'] = 'Beyaz';
$txt['eucookie_notice'] = 'Uyarı Metni:';
$txt['eucookie_text'] = 'Çerezler, size daha iyi bir gezinme deneyimi sağlamamıza yardımcı olur. Sitemizi kullanarak, çerezlerin tarafımızca kullanılmasına izin vermiş olursunuz.';
$txt['eucookie_policy'] = 'Aydınlatma Metni linki ';
$txt['eucookie_more'] = 'Daha Fazla';
]]></add>
</operation>
</file>


install-utf8.xml

<file name="$languagedir/Modifications.turkish-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// EU Cookie
$txt['mods_cat_eucookie'] = 'AB Çerezler';
$txt['enable_eucookie'] = 'AB Çerezleri aktifleştir';
$txt['eucookie_color'] = 'Renk Seç';
$txt['eucookie_black'] = 'Siyah';
$txt['eucookie_white'] = 'Beyaz';
$txt['eucookie_notice'] = 'Uyarı Metni:';
$txt['eucookie_text'] = 'Çerezler, size daha iyi bir gezinme deneyimi sağlamamıza yardımcı olur. Sitemizi kullanarak, çerezlerin tarafımızca kullanılmasına izin vermiş olursunuz.';
$txt['eucookie_policy'] = 'Aydınlatma Metni linki ';
$txt['eucookie_more'] = 'Daha Fazla';
]]></add>
</operation>
</file>


Thank you for the mod.
Title: Re: EU Cookie
Post by: anthony64 on February 20, 2021, 05:36:12 AM
Any updated version for this? I just installed this mod in my 2.0.18 forum but no cookie notice shows up. I have configured everything and, apparently, everything should be working, but nothing shows up when visiting the forum from any browser as a visitor.
Title: Re: EU Cookie
Post by: Portugal on February 23, 2021, 12:53:55 PM
Hi.

Uninstal it, delet at all. Them install it again, must work fine!


Quote from: anthony64 on February 20, 2021, 05:36:12 AM
Any updated version for this? I just installed this mod in my 2.0.18 forum but no cookie notice shows up. I have configured everything and, apparently, everything should be working, but nothing shows up when visiting the forum from any browser as a visitor.
Title: Re: EU Cookie
Post by: @rjen on February 27, 2022, 05:01:59 PM
I am playing with the update of some to use only hooks for use in SMF2.1.

This mod is one of them.

I have already succesfully implemented the hooks for the admin section, using these hooks
hook="integrate_modify_modifications
hook="integrate_admin_areas
hook="integrate_admin_search

Now I am trying to get the EU-cookie pop-up to load, but I am not finding the correct hooks (I think)
I need to get two edits working:

this edit to load.php

    <file name="$sourcedir/Load.php">
        <operation>
            <search position="before"><![CDATA[
    // Some basic information...
    if (!isset($context['html_headers']))
        $context['html_headers'] = '';
]]></search>
            <add><![CDATA[
    // EU cookie mod
    if (!$user_info['is_admin'] && !empty($modSettings['enable_eucookie']))
        $context['html_headers'] .= '
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function(){
            var cookieSet = document.cookie.indexOf("eu_cookie=") != -1;
            if(!cookieSet) {
                jQuery("#cookie_button").click(function(){
                    var expire = new Date();
                    expire.setDate(expire.getDate() + 30);
                    document.cookie = "eu_cookie=1; path=/; expires=" + expire.toUTCString();
                    jQuery(".cookie_wrap").fadeOut("fast");
                });
                jQuery(".cookie_wrap").css("visibility", "visible");
            }
        });
    </script>';
]]></add>
        </operation>
    </file>

I think I should use integration hook 'integrate_theme_include' to include the script. Is that the correct hook?

Then secondly I need to include the pop-up in the screen to replace this edit..

    <file name="$themedir/index.template.php">
        <operation>
            <search position="before"><![CDATA[function template_html_below()
{
    global $context, $settings, $options, $scripturl, $txt, $modSettings;]]></search>
            <add><![CDATA[

    // EU Cookie mod
    global $user_info;
    if (!$user_info['is_admin'] && !empty($modSettings['enable_eucookie']))
        echo '
    <div class="cookie_wrap">
        <div class="cookie_notice" style="' . ($modSettings['eucookie_color'] == 'black' ? 'background: #000; background-color: rgba(0,0,0,0.80); color: #fff;' : 'background: #fff; background-color: rgba(255,255,255,0.80); color: #000;') . '">
            ', !empty($modSettings['eucookie_notice']) ? $modSettings['eucookie_notice'] : $txt['eucookie_text'], '
            <button id="cookie_button" type="button">OK</button>
            ' . (!empty($modSettings['eucookie_policy']) ?  '<a style="' . ($modSettings['eucookie_color'] == 'black' ? 'color: #fff;' : 'color: #000;') . '" href="' . $modSettings['eucookie_policy'] . '">' . $txt['eucookie_more'] . '</a>' : '') . '
        </div>
    </div>';
]]></add>
        </operation>
    </file>

I tried by using integration hook 'integrate_load_theme' to include this, but no luck

I created a php file called from the hook, which loads a language file and then load an extra template file. But it does not work,: not getting the pop-up to show....


source
<?php

if (!defined('SMF'))
    die(
'Hack Attempt...');

function 
eu_cookie()
{
    global 
$user_info$modSettings;

    
// Did we get the parameter we wanted?
    
if ($user_info['is_guest'] && !empty($modSettings['enable_eucookie'])) {

    
// Now we can load the language file we want as it will now be needed.
    
loadLanguage('eu_cookie');

    
// What the language strings will be used on.
    
loadTemplate('eu_cookie');
    }
}              

?>


Template
<?php
function template_main(){

    global 
$user_info$modSettings;

        echo 
'
    <div class="cookie_wrap">
        <div class="cookie_notice" style="' 
. ($modSettings['eucookie_color'] == 'black' 'background: #000; background-color: rgba(0,0,0,0.80); color: #fff;' 'background: #fff; background-color: rgba(255,255,255,0.80); color: #000;') . '">
            '
, !empty($modSettings['eucookie_notice']) ? $modSettings['eucookie_notice'] : $txt['eucookie_text'], '
            <button id="cookie_button" type="button">OK</button>
            ' 
. (!empty($modSettings['eucookie_policy']) ?  '<a style="' . ($modSettings['eucookie_color'] == 'black' 'color: #fff;' 'color: #000;') . '" href="' $modSettings['eucookie_policy'] . '">' $txt['eucookie_more'] . '</a>' '') . '
        </div>
    </div>'
;
}
?>
Title: Re: EU Cookie
Post by: @rjen on February 28, 2022, 04:55:42 AM
Made some progress.

I managed to get the script in the page as part in the html_headers by using the hook 'integrate_load_theme'.

Now I only need to find the correct hook to include a pop-up in the page.

I tried to use the same hook to load the template, but that errors out with HTTP ERRR 500...
Title: Re: EU Cookie
Post by: Arantor on February 28, 2022, 05:21:13 AM
The easiest way is to add a template layer at that point.

See how the system adds the maintenance warning, specifically the references to maint_warning where it's added to context and where this can then call template_maint_warning_above and template_maint_warning_below.
Title: Re: EU Cookie
Post by: @rjen on February 28, 2022, 06:22:58 AM
Quote from: Arantor on February 28, 2022, 05:21:13 AMThe easiest way is to add a template layer at that point.

See how the system adds the maintenance warning, specifically the references to maint_warning where it's added to context and where this can then call template_maint_warning_above and template_maint_warning_below.

Thanks,

got that working  :)

Happy with the progress so far: before this weekend I had never worked with hooks. Starting to understand better how it works. Now I only have one piece left and that is to add a little css using a hook...
Hunting for the correct procedure to do that now...

Challenge is that there is a long list of hooks (https://live627.github.io/smf-api-docs-test/hookdocs/themes.html) but not too many additional documentation / sample use cases...
 
Title: Re: EU Cookie
Post by: @rjen on February 28, 2022, 06:37:39 AM
Not sure if it is the recommended approach, but by simply adding the css in the code before the template_above is built using AddInlinnCss did the trick..

Is this 'recommended'?

AddInlineCss('.cookie_wrap
{
position: fixed;
width: 100%;
bottom: 20px;
text-align: center;
z-index: 9999;
visibility: hidden;
}
.cookie_wrap a:link, .cookie_wrap a:visited
{
text-decoration: none;
}
.cookie_wrap a:hover
{
text-decoration: underline;
cursor: pointer;
}
.cookie_notice
{
display: inline-block;
margin: 0 auto;
padding: 10px;
border-radius: 5px;
font-size: 12px;
}
#cookie_button
{
background: #346;
color: #fff;
font: bold 11px arial;
padding: 3px 12px;
border-radius: 3px;
}');
Title: Re: EU Cookie
Post by: Arantor on February 28, 2022, 06:44:50 AM
I think it's an acceptable approach. A better one would be if there were a way to push CSS into the minify pipeline at compile time but there isn't an option for that.

Your other choice is to add a new CSS file and use addCssFile to load that, perhaps slightly earlier in the process.
Title: Re: EU Cookie
Post by: @rjen on February 28, 2022, 06:57:42 AM
Quote from: Arantor on February 28, 2022, 06:44:50 AMYour other choice is to add a new CSS file and use addCssFile to load that, perhaps slightly earlier in the process.

That was indeed what I was thinking, but since it is only a few elements it feels that creating a completely new css file is a bit 'too much'

Apart from that looking at the result: I started with a separate sources file (eu_cookie.php) and subs file (subs-eu_cookie.php) for the admin functions. But also here this seems a bit 'much'  so I ended up combining all functions in the eu_cookie.php file.

This is more of a coding-standards question: what is the main reason(s) to create a separate 'subs-' file?
Would like to know that, but it is not as such related to this mod specifically...

As for this one: @nikan , I have a completely functioning SMF2.1 package with all hooks available...
Title: Re: EU Cookie
Post by: Arantor on February 28, 2022, 07:09:44 AM
Separate Subs- file is more logical separation between what we would in architectural terms call MVC, Model View Controller. View is the view of the thing you're working on (the template) while the ideal is a complete separation of "what you're doing" from "how you're doing it".

e.g. in the post flow, Post.php sets up the post form, gets all the bits needed for it, and deals with the "business logic" over things like permissions, deciding what the user should be able to see and do. But the real work of "creating a post in the database", "creating a topic in the database", that's all in Subs-Post - createPost or modifyPost is called and all the real complexity moves over there.

If you look at all the Subs files, it's all supporting functions, never the front loaded stuff.

Fun fact, there is (was) a function naming convention: PascalCase for functions directly called by index.php as "this is the user wants to do something" like Post, camelCase for functions that directly support that like createPost, lowercase or snake_case for really internal/generic support functions like preparse_code.
Title: Re: EU Cookie
Post by: @rjen on February 28, 2022, 07:37:17 AM
That's what I thought.

For a mod as simple as this (4 functions including the admin stuff) it seems most suited to not have a subs file.

Perhaps it would be best suited to create a user file and an admin file but tbh I cannot be bothered for this mod.

Just have a small layout issue left because the cookie wrapper Div is now IN the main wrapper, and is was outside before...
Title: Re: EU Cookie
Post by: Arantor on February 28, 2022, 07:48:53 AM
For a mod this small maybe not. The only guideline is "when it feels like there's too much in one file split it up".

As for the banner, position absolute might be your friend to pull it out of the wrapper?
Title: Re: EU Cookie
Post by: @rjen on February 28, 2022, 07:50:54 AM
It has an absolute position, but it starts from the left border of the wrapper ...

It's a bit funny, need to check
Title: Re: EU Cookie
Post by: Arantor on February 28, 2022, 07:52:52 AM
Sounds like you then need to set left: 0 on. Hard to tell without seeing - and I'm on mobile ;)
Title: Re: EU Cookie
Post by: @rjen on February 28, 2022, 07:58:39 AM
no probs, I will figure it out... thanks for the help...

QuoteSounds like you then need to set left: 0 on

and yep, that was it
Title: Re: EU Cookie
Post by: Shades. on March 15, 2022, 10:28:41 PM
I just installed this on my SMF 2.1.1 and it works great. Anyone else that want to use it as is can follow these directions:

I make no promises or guarantees (use this at your own risk) but it worked for me! ;)

Make Backups of all your files first including database!

First install the mod via package manager and emulate it for 2.0.

Don't worry about the warning.

Just click ok or install anyways.

Once installed open (default and whatever theme you're using) index.template.php and

Find:
</div><!-- #footer -->';
Add after:
// EU Cookie mod
global $user_info;
if (!$user_info['is_admin'] && !empty($modSettings['enable_eucookie']))
echo '
<div class="cookie_wrap">
<div class="cookie_notice" style="' . ($modSettings['eucookie_color'] == 'black' ? 'background: #000; background-color: rgba(0,0,0,0.80); color: #fff;' : 'background: #fff; background-color: rgba(255,255,255,0.80); color: #000;') . '">
', !empty($modSettings['eucookie_notice']) ? $modSettings['eucookie_notice'] : $txt['eucookie_text'], '
<button id="cookie_button" type="button">OK</button>
' . (!empty($modSettings['eucookie_policy']) ?  '<a style="' . ($modSettings['eucookie_color'] == 'black' ? 'color: #fff;' : 'color: #000;') . '" href="' . $modSettings['eucookie_policy'] . '">' . $txt['eucookie_more'] . '</a>' : '') . '
</div>
</div>';

All done! 8)
Title: Re: EU Cookie
Post by: Mightymax44 on February 09, 2023, 04:14:26 AM
Hi,
Add archive works smf 2.1.3 with french translation and turkish transalation (thanks @uok825).



-edit by Kindred - Attachment removed.
Title: Re: EU Cookie
Post by: Kindred on February 09, 2023, 10:29:10 AM
This mod has no specified license, which means that it defaults to a restrictive license and modification and re-distribution of the original files is not allowed.

You can provide the alternate language INSTRUCTION on how to add the strings, but you can not repackage and attach a complete download.
Title: Re: EU Cookie
Post by: Mightymax44 on February 09, 2023, 11:36:15 AM
OK sorry you can removed my previous message.
the license in the package apparently authorizes
Title: Re: EU Cookie - google is at it again
Post by: Topman on March 17, 2023, 07:28:17 AM
I'm getting lots of e mail from Google saying the wording of my cookie consent does not comply with Google policy.

I don't have one on my forum at the moment. The EU Cookie control no longer works on my version of SMF.

As the UK is now not even in the EU, I don't know why Google is doing this.

These cookie notices are a nuisance to users. Everyone clicks accept just to do what they want and we call all delete cookies using something like CCleaner anyway.


Title: Re: EU Cookie
Post by: Mightymax44 on March 21, 2023, 02:27:21 PM
Quote from: Topman on March 17, 2023, 07:28:17 AMI'm getting lots of e mail from Google saying the wording of my cookie consent does not comply with Google policy.

I don't have one on my forum at the moment. The EU Cookie control no longer works on my version of SMF.

As the UK is now not even in the EU, I don't know why Google is doing this.

These cookie notices are a nuisance to users. Everyone clicks accept just to do what they want and we call all delete cookies using something like CCleaner anyway.




You can reinstall it
smf version 2.1.3:
-download the archive and unzip

modify the file package-info.xml
find:
<uninstall for="2.0 - 2.0.99">
        <modification reverse="true">install2.xml</modification>
        <modification reverse="true">install-utf8.xml</modification>
    </uninstall>

add after:

    <install for="2.1 - 2.1.99">
        <modification>install2.xml</modification>
        <modification>install-utf8.xml</modification>
        <redirect url="index.php?action=admin;area=modsettings;sa=euc" timeout="5000">redirect.txt</redirect>
    </install>

    <uninstall for="2.1 - 2.1.99">
        <modification reverse="true">install2.xml</modification>
        <modification reverse="true">install-utf8.xml</modification>
    </unintall>

modify this file install2.xml

find:

<![CDATA[function template_html_below()
{
    global $context, $settings, $options, $scripturl, $txt, $modSettings;]]>

replace with:
<![CDATA[function template_body_below()
{
    global $context, $txt, $scripturl, $modSettings;]]>

save the files and zip the archive.
You can install the package on your board and it's done

For french user

add to the install2.xml

find:
</modification>
add before:
<file name="$languagedir/Modifications.french.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
// EU Cookie
$txt['mods_cat_eucookie'] = 'EU Cookie';
$txt['enable_eucookie'] = 'Activer EU Cookie';
$txt['eucookie_color'] = 'Selectionner couleur';
$txt['eucookie_black'] = 'Noir';
$txt['eucookie_white'] = 'Blanc';
$txt['eucookie_notice'] = 'Texte de notification:';
$txt['eucookie_text'] = 'En utilisant notre site, vous autorisez l\'utilisation des cookies pour offir un fonctionnement optimale.';
$txt['eucookie_policy'] = 'URL de la page de politique cookie';
$txt['eucookie_more'] = 'En savoir plus';
]]></add>
        </operation>
    </file>

if necessary install-utf8.xml
find:
</modification>
add before:
<file name="$languagedir/Modifications.french-utf8.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
// EU Cookie
$txt['mods_cat_eucookie'] = 'EU Cookie';
$txt['enable_eucookie'] = 'Activer EU Cookie';
$txt['eucookie_color'] = 'Selectionner couleur';
$txt['eucookie_black'] = 'Noir';
$txt['eucookie_white'] = 'Blanc';
$txt['eucookie_notice'] = 'Texte de notification:';
$txt['eucookie_text'] = 'En utilisant notre site, vous autorisez l\'utilisation des cookies pour offir un fonctionnement optimale de notre site.';
$txt['eucookie_policy'] = 'URL de la page de politique cookie';
$txt['eucookie_more'] = 'En savoir plus';
]]></add>
        </operation>
    </file>
;)
Title: Re: EU Cookie
Post by: Arantor on March 21, 2023, 02:58:00 PM
Quote from: mightymax44 on March 21, 2023, 02:27:21 PMif necessary install-utf8.xml

Yeah about that... 2.1 doesn't have the UTF-8 files, and all the stock files are themselves UTF-8. Implementing these instructions as given will likely corrupt any non-English language installation.