Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
How to add a modal popup with terms and conditions when user login?
Avatar
kosmos #1
User title: kosmos
Member for 3 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to add a modal popup with terms and conditions when user login?
Hi.

I'd like to add this logic into my plugin:

When user login first time popup window appears with terms and conditions text.
User check the checkbox agree and window disappeared.

I've created the plugin 'terms' with class name action_plugin_terms.

Created this function in this class:
public function register(Doku_Event_Handler $controller)
    {
        $controller->register_hook('AUTH_LOGIN_CHECK', 'AFTER', $this, 'handle_auth_login_check');
  
    }

The question is how to add addition html and javascript code into the page?
When i write echo function into the function 'handle_auth_login_check' it tells me "header already sent...".

Thanks for any advices.
This post was edited on 2019-07-05, 10:41 by kosmos.
Avatar
LarsDW223 #2
Member since Sep 2014 · 429 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Regarding JavaScript usage in DokuWiki this page may help you: https://www.dokuwiki.org/devel:javascript.
Avatar
turnermm (Moderator) #3
Member since Oct 2009 · 4702 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #1
Here is an old plugin, just updated.  It is a template for adding a field to the login screen and handling the added field when the login is being processed:
https://github.com/turnermm/xtralogin/archive/master.zip
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
This post was edited on 2019-07-06, 20:24 by turnermm.
Avatar
ach (Administrator) #4
Member since May 2006 · 1932 posts · Location: Folkestone, UK
Group memberships: Administrators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
A minimal solution is to adjust the text on the register page (register.txt) to say something like "by registering you agree to the terms and conditions". And then add a link to the terms and conditions which can be just a simple wiki page.

Modal popups are not very user-friendly and are difficult to make accessible.
Avatar
kosmos #5
User title: kosmos
Member for 3 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Thank you very much!!!

I've created a page with terms and conditions. ( my local link: http://dokuwiki.tst/doku.php?id=terms)

The question is how to show the form with checkbox on the bottom of the text page with text 'i agree with terms and conditions'?

(It must be checked by all users who sign in first time, is there API for connect to mysql?)
Avatar
kosmos #6
User title: kosmos
Member for 3 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Found this solution:

$controller->register_hook('TPL_CONTENT_DISPLAY', 'BEFORE', $this, 'handle_tpl_content_display');
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-09-23, 15:47:21 (UTC +02:00)