Can

MarkupCookieConsent

Recommended Posts

Just lost my text due to wrong shortcut -.- (maybe auto storing in local storage would be nice :D) but anyways..

Now I got you maba.

Thanks to you I just notices that my pages weren't working too..

I actually don't really now what fixed the issue and maybe just re-installing could fix it but there is a new Version with some changes you could grab during re-installation process..see changelog in readme for detail

Make sure to remember your settings before uninstalling!

Please let me know if everything works now.

Sorry Manfred for the late response and thank you for the translation!

'notes' => sprintf(__("For example Font Awesome checkmark icon e.g. %s\n(You need to include Font Awesome on your own)"), "<i class='fa fa-check'></i>"),

I just stripped the \n for now

Maybe don't use the \n? Or delete part of string "(You need to include Font Awesome on your own)", because Font Awesome is already included in PW.

But it won't be included on your front pages templates so it works only in backend. You can of course reference the version used by PW but you have to do it yourself

(or am I missing something?)

'notes' => __("Default true\nIt has been suggested that this setting can effectively help to reduce identity theft through XSS attacks"),

Moved "Default true" to end of former line..

I have no idea why \n is not working I always used it as it's suggested in the docs and as far as I remember it always worked?!

EDIT: 0.1.2 adds minified CSS & JS

  • Like 1

Share this post


Link to post
Share on other sites

Welcome to the forums Flavia

Glad you could solve it :)

Share this post


Link to post
Share on other sites

Hi Can,
thank you for this great module. Would be great to have the 'policy link text' in multilanguage too.

Share this post


Link to post
Share on other sites

Wow finally I can answer :o internet is quite slow at the moment and the new PW forums seem to be a little hungrier or dependent to load fully for the reply form to work/load so I can read but answering is a hard task for me..and here's now link anymore pointing to a stand alone reply form (which could maybe be more lightweight, I don't know..) anyway..now it works :D

So as @kixe requested the policy link text is now translatable, too. I'm not sure but I think till now the translations weren't reflected in the cookie notification at all, or maybe I confused myself and missed something don't know..
Anyway now it works (at least for me). Don't know if this is the proper way of coding this and I'm open to suggestions, maybe there's a PW way in doing this?

And as I'm a little more gitty now (working more with git, just found out what gitty actually means haha^^) I included a devns branch now..maybe it's a little confusing? (just now came the idea to call the branch namespaced or something) as it's not the development version of MarkupCookieConsent but the namespaced version meant to be used with PW 3.x devns. So the only difference is added namespace in the module and the config file and module info now reflects the need for PW >= 3 to install the devns branch

  • Like 2

Share this post


Link to post
Share on other sites

Hello I have currently integrated into the template cookieconsent manually.

In search of "maybe what better" I saw that yes there CookieConsent as a module.

Now I have it installed in my PW 2.7.3 and got this error

Error: Call to a member function isDefault() on null (line 78 of /home/wsc/web/bernhard.web-seo-consulting.eu/public_html/site/modules/MarkupCookieConsent/MarkupCookieConsent.module)

This error message was shown because you are logged in as a Superuser. Error has been logged. 

Is this due to the integrated or has other reasons in the template?

Share this post


Link to post
Share on other sites
2 hours ago, csaeum said:

Is this due to the integrated or has other reasons in the template?

@csaeumIf you install ProcessWire multi-language support, it should work ;)


@Can maybe this small check could help, on line 78/79

if($this->wire('modules')->isInstalled('ProcessLanguage')) {
    $userLanguage = $this->wire('user')->language;
    $lang = $userLanguage->isDefault() ? '' : "__$userLanguage->id";
}
else {
    $lang = '';
}

 

  • Like 2

Share this post


Link to post
Share on other sites

good catch @flydev never considered this as most of my projects are multi lang

tested and pushed your fix, should work now

@csaeum Please let me now if it works for you, too

EDIT: Just bumped version so you should be able to just update the module using ProcessWireUpgrade module (if installed)

  • Like 4

Share this post


Link to post
Share on other sites

Ok sorry folks I have not even checked earlier
Thanks, that's it. Perhaps we should intercept it and then write down)
;)

Share this post


Link to post
Share on other sites

Checking for wire('languages') wouldn't work? I use this and seem to do the trick.

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, tpr said:

Checking for wire('languages') wouldn't work? I use this and seem to do the trick.

@tpr sure would work, too. Maybe faster? Otherwise shouldn't matter?!

  • Like 1

Share this post


Link to post
Share on other sites

No idea, but it's shorter so leaves more space in my head for others :)

  • Like 2

Share this post


Link to post
Share on other sites
On 14.8.2016 at 5:34 PM, Can said:

For everyone interested in disabling cookies at all to avoid every possible need for this plugin checkout out this blog post from Ryan http://processwire.com/blog/posts/multi-instance-pw3/#more-session-control

@Can
Good to point this out. But already with a simple contactform you need cookies. I stay with your module as default.

Edit:
I ended up with a combination. Added the following code to my config.php

/**
 * if we would use cookies only for the admin area
 *
 */
$config->sessionAllow = function($session) {
	// if URL is an admin URL, allow session
	if(strpos($_SERVER['REQUEST_URI'], $session->config->urls->admin) === 0) return true;
	// if there is a session cookie, a session is likely already in use so keep it going
	if($session->hasCookie()) return true;	
	// user accepted cookies due to EU law (Module MarkupCookieConsent)
	if(!empty($_COOKIE['eu-cookie'])) return true;
	// otherwise disallow session
	return false;
};


Small request:
I would like to set a more specific target to the privacy policy page including an url fragment string like

/privacy-policy/#cookies

Would be nice to have an inputfield to add this to the url of the target page. Actually don't need this now but having an option to define an external page would be nice too.
I don't really get the usage of Link Target -> Custom Selector
Is it just to get the target frame by name according to the html attribute, or is it a kind of PW selector?

Edited by kixe
  • Like 1

Share this post


Link to post
Share on other sites
On 8.10.2016 at 6:20 AM, kixe said:

But already with a simple contactform you need cookies.

to use session based messages or what am I missing?

no it's no pw selector, maybe I'll change wording? it enables you to provide a custom link target (useful at all)

just pushed 0.1.6 with custom privacy page url

  • Like 3

Share this post


Link to post
Share on other sites

Thanks for the quick implementation. Again 2 small remarks.

1. Cookie Expire

The field description and the behaviour of the property 'cookieExpire' doesn't match. I got this after install:

Bildschirmfoto 2016-10-13 um 16.54.00.jpg


You should either change the description to something like 'Cookie expire date (Unix Timestamp)' or add time() later and not directly to the property like:

setcookie($this->cookieName, 1, time() + $this->cookieExpire, $this->cookiePath, $this->cookieDomain, $this->cookieSSL, $this->cookieHttp);

2. About Version Numbering

Your last version was: 0.1.51
Your update version is 0.1.6. PW detects an older version in this case and ask if I want to overwrite the newer module version by an older one.
PW handles only 2 subversion levels. A version number like 0.1.5.1 is not possible in PW.
So your new version number should be 0.1.52 or 0.2.0.
:rolleyes: It doesn't really hurt. Just to know ...

 

  • Like 1

Share this post


Link to post
Share on other sites

good to know about versioning thank you!

and the expiration I'll check a little later thanks for spotting this..

  • Like 2

Share this post


Link to post
Share on other sites

If you use a string for your module version parameter, you can have more than the three fields. For example...

versioning01.png

...and the code...

versioning002.png

Not sure if this plays well with version checking - but it is possible.

  • Like 2

Share this post


Link to post
Share on other sites

good catch @netcarver I think the thing is that I always forget that 0.1.51 is greater than 0.1.6 thinking about it I'll totally get it the first is fiftyone not 5.1 but a little distracted and I mix those things up..class, plugins, versioning are still kind of new..especially versioning as I never took it seriously coding for myself not bound to any automatic update process or other people involved ;)

@kixe fixed expiration and version issues

On 8.10.2016 at 6:20 AM, kixe said:

But already with a simple contactform you need cookies

Because I'm curious I have to ask again..what exactly do you mean by this? For convenience (e.g. to use session based messages)? By law?

Another general question..do those two branches master and devns make sense? Not that it's a big hassle to maintain, but again because I'm curious ;)

Saludos

Share this post


Link to post
Share on other sites
On 15.10.2016 at 4:46 AM, Can said:

Because I'm curious I have to ask again..what exactly do you mean by this? For convenience (e.g. to use session based messages)? By law?

Nothing special. Just to use session based message.


Again something to complain about. Sorry for this :rolleyes:
Good to have the option to limit the cookie consent to a special path/ tree. But in this case the banner shouldn't be shown for pages not residing under this tree.
It would also be nice to store the page id and not the path, to stay multilanguage compatible and to avoid problems if the page name has been changed. A page-field (instead of text) would be the simplest solution here.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Anssi
      A simple module to enable easy navigation between the public and the admin side of the site. After installation a green bar will appear to the upper side of the screen, containing a few navigation elements and displaying the PW version number.
      Heavily inspired by @apeisa's great AdminBar (Thanks!). I needed a bit simpler tool for my projects and as a result, this was made. Available on GitHub .

    • By Sebi
      I've created a small module which lets you define a timestamp after which a page should be accessible. In addition you can define a timestamp when the release should end and the page should not be accessable any more.
      Github: https://github.com/Sebiworld/PageAccessReleasetime
      Usage
      PageAccessReleasetime can be installed like every other module in ProcessWire. Check the following guide for detailed information: How-To Install or Uninstall Modules
      After that, you will find checkboxes for activating the releasetime-fields at the settings-tab of each page. You don't need to add the fields to your templates manually.
      Check e.g. the checkbox "Activate Releasetime from?" and fill in a date in the future. The page will not be accessable for your users until the given date is reached.
      If you have $config->pagefileSecure = true, the module will protect files of unreleased pages as well.
      How it works
      This module hooks into Page::viewable to prevent users to access unreleased pages:
      public function hookPageViewable($event) { $page = $event->object; $viewable = $event->return; if($viewable){ // If the page would be viewable, additionally check Releasetime and User-Permission $viewable = $this->canUserSee($page); } $event->return = $viewable; } To prevent access to the files of unreleased pages, we hook into Page::isPublic and ProcessPageView::sendFile.
      public function hookPageIsPublic($e) { $page = $e->object; if($e->return && $this->isReleaseTimeSet($page)) { $e->return = false; } } The site/assets/files/ directory of pages, which isPublic() returns false, will get a '-' as prefix. This indicates ProcessWire (with activated $config->pagefileSecure) to check the file's permissions via PHP before delivering it to the client.
      The check wether a not-public file should be accessable happens in ProcessPageView::sendFile. We throw an 404 Exception if the current user must not see the file.
      public function hookProcessPageViewSendFile($e) { $page = $e->arguments[0]; if(!$this->canUserSee($page)) { throw new Wire404Exception('File not found'); } } Additionally we hook into ProcessPageEdit::buildForm to add the PageAccessReleasetime fields to each page and move them to the settings tab.
      Limitations
      In the current version, releasetime-protected pages will appear in wire('pages')->find() queries. If you want to display a list of pages, where pages could be releasetime-protected, you should double-check with $page->viewable() wether the page can be accessed. $page->viewable() returns false, if the page is not released yet.
      If you have an idea how unreleased pages can be filtered out of ProcessWire selector queries, feel free to write an issue, comment or make a pull request!
    • By David Karich
      Thanks to the great Pro module "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use this module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      With this proof of concept I have created a module which adds the feature to copy a repeater item to the clipboard so that you can paste this item to another page with the same repeater field. The module has been developed very rudimentarily so far. It is currently not possible to copy nested items. There is also no check of Min/Max. You can also only copy items that have the same field on different pages. And surely you can solve all this more elegantly with AJAX. But personally I lack the deeper understanding of the repeaters. Also missing on the Javascript side are event triggers for the repeaters, which would make it easier. Like e.g. RepeaterItemInitReady or similar.
      it would be great if @ryan would implement this functionality in the core of RepeaterMatrix. I think he has better ways to implement this. Or what do you think, Ryan?
      Everybody is welcome to work on this module and improve it, if it should not be integrated into the matrix core. Therefore I put it for testing and as download on GitHub: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDublicate
      You can best see the functionality in the screencast: 
       
    • By anderson
      Hi,
      Please take a look at this:
      https://templatemag.com/demo/Good/
      The upper nav bar, including dropdowns like "pages" and "portfolios", what do you call this whole thing? At first I guess it's called "dropdown nav bar", but seems not.
      AND of course, what's the simplest way/module to achieve this in PW?
      Thanks in advance.
    • By Sebi2020
      Hey, I'm new and I created a simple module for tagging pages because I didn't found a module for it (sadly this is not a core feature). This module is licensed under the GPL3 and cames with absolutly no warranty at all. You should test the module before using it in production environments. Currently it's an alpha release. if you like the module or have ideas for improvements feel free to post a comment. Currently this fieldtype is only compatible with the Inputfield I've created to because I haven't found  an Inputfield yet, that returns arrays from a single html input.
      Greetings Sebi2020
      FieldtypeTags.zip.asc
      InputfieldTagify.zip
      InputfieldTagify.zip.asc
      FieldtypeTags.zip