Hi,

First of all thanks for the easy module. I really like it the way it is out of the box!

For my user case I needed to add some extra functionality. My client didn't like to have the terms of use checkbox in a fieldset so I made that optional. Beside that I have been requested several times before to allow users to open the terms of use node in a popup, instead of being redirected to another page.

I've made some little tweaks to your module to support this. Now admins can choose wether they like to open the TOU in the same window, a separate window, or in a popup.

Comments

skilip’s picture

Status: Active » Needs review
StatusFileSize
new1.01 KB
new600 bytes
new5.22 KB

And here's the patch and the required files

sdsheridan’s picture

Great patch! Thank you, this is exactly what I wanted for my site. Total usability enhancement.

adamus_maximus’s picture

One suggestion:

Make the popup window scrollable.

Line 213:
- $options['attributes']['onclick'] = "window.open(this.href + '?terms_of_use_popup=1', 'terms_of_use', 'width=$width,height=$height,scrollbars=1'); return false;";
+ $options['attributes']['onclick'] = "window.open(this.href + '?terms_of_use_popup=1', 'terms_of_use', 'width=$width,height=$height'); return false;";

For my use, the one line change will suffice.
You may decide to instead implement this as an option on the terms_of_use settings form.

Rainman’s picture

Works well, and gets my vote for inclusion in the module. adamus is absolutely correct, many site's terms are probably going to be long enough to need a scroll, that tested well too.

Thanks!

gekido’s picture

would be nice if this was done in a shadowbox type of system instead of an actual window popup. will see what i can figure out in this respect...

gekido’s picture

so this was easier than expected, although I've somewhat 'hard-coded' it a bit for my own purposes.

There are 3 steps to this:

Step 1) First, you'll require the Lightbox2 module: http://drupal.org/project/lightbox2

I simply enabled the module and didn't touch the settings at all (at least not yet).

There are a number of example 'rel="blah"' tags that you can use with lightbox here: http://drupal.org/node/144488

Step 2) Modify terms_of_use.module

Basically I just modified the str_replace that was checking for the @link token to insert the appropriate rel="" tag to the l() function, like so:

(around line 175):
// instead of this:
// $checkbox_label = str_replace('@link', l($node->title, 'node/' . $node->nid), $checkbox_label);
// do this:
$checkbox_label = str_replace('@link', l($node->title, 'node/' . $node->nid, array( 'attributes' => array('rel' => 'lightmodal') )), $checkbox_label);

Step 3) the final step is adding some custom template files for the page & node that you want to appear in your lightbox. Since I don't want the main popup lightbox to appear in the full site template, I simply made custom page-terms_of_use.tpl.php and custom node-[nid].tpl.php templates and removed all of the extra crap from them.

This way the html in the lightbox appears stripped of all the extra site template stuff and looks great!

I'm sure there's a better / cleaner way of doing this, but for now it does the trick.

pavlosdan’s picture

Hi guys. I was wondering how did you make the patch work for you. I cant for whatever reason make it work.

I've downloaded the files and patched the module. Renamed the tpl file to page-terms_of_use_popup.tpl.php and the js file to terms_of_use.js.

Resaved the modules page, cleared cache and went to the module's config page where I selected the popup option. I then logged out and visited my registration page but the terms are still there in a fieldset instead of just a textbox with a link that popups the terms.

Any ideas?

Thanks a lot in advance for any replies.

pavlosdan’s picture

Disregard #7 just needed to add the @link to the 'Label for the chackbox' field:

'I agree to the @link'

Thanks again for the very useful patch!

kevinquillen’s picture

This patch is so inherently useful, it should be put into a release.

Ela’s picture

Thank you! Works on 6.x-1.13 as well

kars-t’s picture

Status: Needs review » Closed (won't fix)

Hi

I won't add anything to D6 anymore. I believe this would be a great addition for D7. Feel free to reopen if you want to make a new patch.