Forums / Developer / Force users to see "Terms and Conditions"

Force users to see "Terms and Conditions"

Author Message

Bruce Morrison

Friday 22 January 2010 5:17:44 pm

Hi all

I'm working on a project where users must see and agree to terms and conditions before they can proceed into the site. I wondering if anyone has done this with eZ publish in an extension ( without modifying the core ) ?

My current thinking is to modify the pre_check.php (used to enter setup mode) to do this.

I know this can be done via javascript but I'm only interested in server side solutions.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Robin Muilwijk

Friday 22 January 2010 11:37:54 pm

Hi Bruce,

Would that include Anonymous users also, so basically everybody that want's to visit that site?

Problem I see is that how would the system know when someone visits a second time, that the visitor/user already checked of the terms and conditions?

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

SEBBANE Alexandre

Saturday 23 January 2010 10:10:22 am

Hi

i am working on a system where i have a 'disclaimer contentclass' and i make a operator with redirect and cookie to achieve it.

hope the idea is good

Alex

Paris, France

Bruce Morrison

Saturday 23 January 2010 4:41:37 pm

@Robin Yes, all visitors including anonymous ones need to see & agree to the T&C. As Alex noted the acceptance would be stored in a cookie and checked on each page view.

@Alex Thanks! Of course the template operator is the way to go!

The template operator will need to go in all pagelayout.tpl and overrides and not be in a cache-block. It would be nice to be to able to extend the pre_check.php via an extension as something just doesn't feel right about doing redirects from template operators.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Damien Pobel

Monday 25 January 2010 2:08:23 am

Hi Bruce,

and what about writing a pre read workflow that would check if the current user has already seen and agreed (cookie ?) the terms of usage ?

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Bruce Morrison

Monday 25 January 2010 7:57:49 pm

Hi Damien

I thought about a pre-read workflow but I believe that this would only apply to the content view. It would certianly be an option if it was trigger before all page views. The requirement is that no pages can be viewed with out first agreeing to the T&C.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Damien Pobel

Tuesday 26 January 2010 2:50:58 am

You're right, pre-read workflow are only triggered on content/view. I don't know how many views other than content/view can be used by users on your site, but if there are only a few, you can probably hack the PHP script of theses views to call the pre-read workflow. It's a bit hackish, but probably than modifying pre_check.php.

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Bruce Morrison

Tuesday 26 January 2010 6:34:08 pm

Hi Damien

I suspect there may be a lot more hacking involved going down the pre-read trigger route as all the content views as well as the user module views would have to be covered and this would involve modifying a significant number of core distribution files (effecting upgrades etc...).

The reason I mentioned pre_check.php is because it's called before all accesses allowing a single entry point and limiting the core modifications to a single file.

A powerful addition to eZ publish would be to allow code to be run before (and after) all requested module/view. This would be like before and after filters in Rails. I guess this is expanding the current workflow system to allow for system wide entry points that don't rely on the triggers defined in each module.

At this stage I suspect that the functionality will be implemented with a custom template operator that will be added to pagelayout.tpl with the presentation of the T&C & acceptance handled by a custom module. This approach should be able to be contained in an extension and not involve any core file hacking.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

eZ debug

Timing: Jan 29 2025 13:36:35
Script start
Timing: Jan 29 2025 13:36:35
Module start 'content'
Timing: Jan 29 2025 13:36:35
Module end 'content'
Timing: Jan 29 2025 13:36:35
Script end

Main resources:

Total runtime0.1343 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.0469180.8281
Module start 'content' 0.00630.0073 768.8750106.1172
Module end 'content' 0.01370.1206 874.9922534.3750
Script end 0.1343  1,409.3672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.5315200.0002
Check MTime0.00141.0143200.0001
Mysql Total
Database connection0.00100.773510.0010
Mysqli_queries0.087965.44411410.0006
Looping result0.00100.75571390.0000
Template Total0.120289.510.1202
Template load0.00100.743910.0010
Template processing0.119288.713510.1192
Override
Cache load0.00070.519510.0007
Sytem overhead
Fetch class attribute can translate value0.00060.483110.0006
XML
Image XML parsing0.00020.163810.0002
General
dbfile0.00715.2911200.0004
String conversion0.00000.006030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs