I have very long text for term of use of my site, so I don't like to show all this text in the registration page.

Is possible to have this solution:

put only a link to the term of use page in the registration page containing the checkbox, like this:

Terms of use of this page are available here (<- this a link to the terms of use page)
[x] I certify that I read and I agree with these terms

Thank you

MXT

CommentFileSizeAuthor
#14 terms_of_use_link.patch1.79 KBfloretan

Comments

Chill35’s picture

Status: Needs review » Active

If you theme the Terms, yes, it's possible, and very easy.

I was about to post the code here, then realized that there is a bug in the module theming function and implementation of HOOK_theme. Let me fix that first.

Chill35’s picture

Assigned: Unassigned » Chill35
Category: feature » bug

Here's what you'd put in your theme template.php file, e.g. for the garland theme.

(Not tested.)

function garland_terms_of_use($terms, $node) {
  $output  = '<div id="terms-of-use" class="content clear-block">';
  $output .= t('Terms of use of this page are available !here', array('!here' => l('here', 'node/'."$node->nid")));
  $output .= '</div>';
  return $output;
}
Chill35’s picture

Let me know if that works. I fixed the theming bug, so please use/test 6.x-1.8.

Chill35’s picture

Status: Active » Needs review

And I forgot: please clear your web site's cache (that will clear your theme registry).

Roger out,

mxt’s picture

Status: Active » Needs review

Ok! it works fine!

Thank you for your work.

;-)

MXT

Chill35’s picture

Component: User interface » Documentation
Category: bug » task
Status: Needs review » Needs work

Thank you!

I will add the information to the README.txt file.

fleshgrinder’s picture

German version:

<?php
function THEMENAME!_terms_of_use($terms, $node) {
  $output  = '<div id="terms-of-use" class="content clear-block">';
  $output .= t('Die Nutzungsbedingungen können !hier nachgelesen werden.', array('!hier' => l('hier', 'node/'."$node->nid")));
  $output .= '</div>';
  return $output;
}
?>

I couldn't find the possibility ot translate it with a .po file or via Drupal, so I thought I share it with you.

Kindest regards
Fleshgrinder

venusrising’s picture

Is there a way to make the terms of use within a scroll box on the registration page or something that would make it possible to still have the checkbox but not the entire text on the registration page? Thanks so much.

venusrising’s picture

Thanks to everyone for the posts, the above code works great!

neroflick’s picture

Thanks .. this worked! But how can one make the link open in a new window? I think this quite necesary to prevent a visitor from navigating away from the registration form after filling all the fields.

Any tips?

fleshgrinder’s picture

Hi neroflick,

a fast and dirty version?

function nervenhammer_terms_of_use($terms, $node) {
  $output  = '<div id="terms-of-use" class="content clear-block">';
  $output .= t('Terms of use of this page are available <a href="/node/'."$node->nid".'" onclick="window.open(this.href);return false;" title="'."$node->title".'">here</a>.');
  $output .= '</div>';
  return $output;
}

That's also valid XHTML 1.0 strict.

Kindest regards
Fleshgrinder

tonimuendel’s picture

thanks for this Chill35, it worked great in Drupal 6.9 but I can't get it to work for 6.10.

Has anyone had the same issue?

Referring to this:

function garland_terms_of_use($terms, $node) {
  $output  = '<div id="terms-of-use" class="content clear-block">';
  $output .= t('Terms of use of this page are available !here', array('!here' => l('here', 'node/'."$node->nid")));
  $output .= '</div>';
  return $output;
}
tonimuendel’s picture

never mind. It works now. I think it was a Cache thing.

floretan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.79 KB

The theming option works to a certain extent, but it doesn't let you have a link to the terms of use inside the checkbox label:

[x] I agree to the Terms of Use.

This patch adds the possibility to do this by putting the @link token inside the checkbox label. For the example above, you would create a node with title "Terms of Use" (nid = 123), set the checkbox label to "I agree to the @link.", which would get replaced with I agree to the <a href="node/123">Terms of Use</a>.

When the @linkn token is present, the full text of the terms of use is not displayed on the form.

Chill35’s picture

@flobruit: There were problems with your patch, $str_agree was undefined, etc. I fixed this and improved the help text as well and provided an example. Stay tuned for a new release. Thank you for the patch!

Chill35’s picture

Version: 6.x-1.7 » 6.x-1.9
Component: Documentation » Code
Status: Needs review » Fixed
ailgm’s picture

Just as mentioned by neroflick (post #10) I would also like to have a scrolling region, so the terms can be on the page but in a limited space. Can anyone suggest a way to do this? Or could it be considered as a new feature request?

floretan’s picture

Adding a scrolling region can be done with some CSS. Just set the container of the terms of use to have a fixed height, like height: 50px;, and overflow: auto;.

Chill35’s picture

Thanks Flobruit, that's the correct answer.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

manoloka’s picture

I fixed this and improved the help text as well and provided an example. Stay tuned for a new release

Has this been added to the latest dev?

Thanks

manoloka’s picture

What am I doing wrong?

I've added

<?php
function garland_terms_of_use($terms, $node) {
  $output  = '<div id="terms-of-use" class="content clear-block">';
  $output .= t('Terms of use of this page are available !here.', array('!here' => l('here', 'node/'."$node->nid")));
  $output .= '</div>';
  return $output;
}
?>

to the garland template.php

But nothing changes ??? I still got the whole T&C with no link anywhere.

Any ideas?

I use garland with a colour preset.

manoloka’s picture

My mistake :-s

I forgot to flush the cache, it works now.

However I thought the "new window" had been implemented.

Thanks

Manonline’s picture

kars-t’s picture

Status: Active » Closed (fixed)

@Manonline

Please file a new issue if this still is a problem.

venusrising’s picture

Status: Closed (fixed) » Active

This was working great prior to the current update. How can this be reapplied as it now makes my box huge with the checkbox at bottom and link way up at top

kars-t’s picture

Status: Active » Postponed (maintainer needs more info)

@venusrising
Could you please post more information.
Are you overriding the theming funktion?
I did add an CSS file maybe this gives you some trouble?

fleshgrinder’s picture

I'd like to add the following to my (old) post #11 for anybody who finds this thread.

function mytheme_terms_of_use($terms, $node) {
  $output  = '<div id="terms-of-use" class="content clear-block">';
  $output .= t('Terms of use of this page are available <a target="helpwindow" href="/node/'. $node->nid .'" title="'. $node->title .'">here</a>.');
  $output .= '</div>';
  return $output;
}

The use of target="helpwindow" is also valid XHTML 1.0 strict and does not need any JavaScript. If you want to open the terms of use in a pop-up you have no choice and must use JavaScript.

kars-t’s picture

Assigned: Chill35 » Unassigned

@fleshgrinder
Thanks for your Input. But please do not use t() this way.

http://groups.drupal.org/node/15177
http://drupalcontrib.org/api/function/t/6

You must not put variables into t() directly but pass them into tokens. The way you use t() you will get unwanted strings into the local table.

fleshgrinder’s picture

Thanks for the hint Kars-T. It’s and old code and I had a look at all of my issues and saw the JavaScript I just wanted to show up a way to get rid of the JS in the link. But there is even more clean-up necessary in my code. Here’s a new version; now even without any variable to store the output in and I changed the use of $node->nid in the link to $node->path, this way the link will make use of the path alias.

function mytheme_terms_of_use($terms, $node) {
  return
  '<div id="terms-of-use" class="content clear-block">'.
    t('Terms of use of this page are available <a target="helpwindow" href="/!link" title="!title">here</a>.', array('!link' => $node->path, '!title' => $node->title))
  .'</div>';
}

I checked the target="helpwindow" again, it’s not valid XHTML strict. I assumed it wrong, but it is valid XHTML transitional and I recommend using transitional at all and not strict to everybody. Strict doesn’t have any advantages over transitional.

kars-t’s picture

Thanks fleshgrinder! :)

I will for the module so I have free hand in this issue and probably use ctools to make a pluggable API. So we can easily hook in all JS popup scripts we want. Will take some time but I hope it will rock as Drupal normally does!

venusrising’s picture

Sorry yes, I was using the old fix but when I installed the update it still works as it once did Except is now leaves a huge amount of space between the link and the checkbox

fleshgrinder’s picture

I'll have a look at the newest version the next days. Have you checked your CSS (with Firebug or something similar), maybe the problem is related to some new styles from an update.

tsi’s picture

Just sharing my solution to this, using hook_form_alter in your module :

/**
 * Implementation of hook_form_alter().
 */
function YOURMODULENAME_form_alter(&$form, &$form_state, $form_id) {
  switch($form_id) {
    case 'user_register':
      $form['terms_of_use']['#type'] = 'markup';
      $form['terms_of_use']['terms_of_use_text']['#type'] = 'hidden';
      unset($form['terms_of_use']['#title']);
      $form['terms_of_use']['terms_of_use']['#title'] = t('I agree to the <a href="@terms-of-service">terms of service</a>.', array('@terms-of-service' => url('terms-service'))) . '<span class="form-required"> *</span>';
      break;
  }
}

just set the YOURMODULENAME to your module name and url('terms-service') to your terms path.

kars-t’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)