This is similar to the following post for D5:
http://drupal.org/node/332567

Except my patch (attached) makes this an option. It creates an additional variable (I also clean this up in hook_uninstall) that allows users who have selected the Page Link display option in admin to optionally check a box to make this link open in a new window. It was either this, or move the link to a template file using a hook_theme implementation. I figured the admin option was better for most users.

Please review. This is probably a better candidate for back-port to D5 than the other patch, which *imposes* the new window behaviour on all comers... Thanks! =)

Ps - I had to add form weights for admin, as the checkbox was appearing in an odd place.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vmenelas’s picture

How do you add this to your legal module?

greg.harvey’s picture

You read this section of Drupal.org and follow the instructions: http://drupal.org/node/60108

;-)

vmenelas’s picture

I am still a little bit confused...do I save the file, if so what do I save it as?
Thank you

RG’s picture

Hello,
Valery, if you want to patch your module, you have to save the patch in the good directory (here, the "Legal" module directory).

Then you navigate through the "cd" command to the good directory (i.e. "cd www/mywebsite/sites/all/modules/legal"), and you apply the patch.
To do this you have to type : "patch [-b] < your_patch_file.patch".

(the "-b" option creates a copy of your file before modifying it, can be useful).

Eugene Dubois’s picture

Is there a way create a pop-up window with only the terms and conditions?

Menu's etc. should not be there...

greg.harvey’s picture

Actually, thinking about it, an AJAX option would be nice! =)

foodbo’s picture

is it possible to integrate the "popup api" module with the legal module?? instead a new window but just "overlay".

I am quite new this drupal thing, and trying to read the readme.txt from popup api module, and seems shouldn't be hard to integrate them both ?? for the experience users, but just no clue what it is saying there.

would be appreciated if u can point me to the right direction.

Robert Castelo’s picture

foodbo good idea!

I've been wanting to add a Lightbox style effect rather than link to another page, and this looks like an easy way to do it.

I don't have time to do it at the moment, but it's high on my To Do list.

philipjohn’s picture

What is the status of this? Did it get incorporated as I'm looking for a feature like this.

Roberto, I would be interested to know if you had a look at the lightbox-style effect - this would be ideal, rather than using a new window.

Phil

greg.harvey’s picture

No, it didn't. That's why it is still set to 'needs review'. I guess Robert is too busy to maintain the module right now. =(

Edit: It still applies though, there have been no commits for two years, so you can just apply this patch. And you can mark the issue 'reviewed and tested' if it works for you.

Robert Castelo’s picture

I'll look into this next week. Will be doing a clean out of all issues of Legal module.

greg.harvey’s picture

Awesome, thanks! =)

devkinetic’s picture

I wrote a quick form alter so I didn't have to patch the module to hold my client over until this is rolled into CVS.

Toss this in a custom module:

function MODULENAME_user_form_alter(&$form, &$form_state, $form_id) {
  switch($form_id) {
    case 'user_register':

      //uncomment this to dump the fapi for the legal checkbox
      //print '<pre>';
      //print_r($form['legal']['legal_accept']);
      //print '</pre>';
    
      if ($form['legal']['legal_accept']['#title'] == '<strong>Accept</strong> <a href="/legal">Terms &amp; Conditions</a> of Use') {
        $form['legal']['legal_accept']['#title'] = '<strong>Accept</strong> <a href="/legal" target="_blank">Terms &amp; Conditions</a> of Use';
      }
      break;
  }
}

You could also use this to add an overlay, since you can modify the a tag and add say a rel="[lighbox]" or something like that.

AaronBauman’s picture

Version: 6.x-2.2-beta4 » 6.x-8.x-dev
FileSize
4.03 KB

original patch no longer applies cleanly.

Here's an updated patch against 8.x dev.
Additionally, this adds an option for the admin to choose whether to use target="_blank" or XHTML-compliant rel="external"

Anonymous’s picture

Priority: Normal » Major

The code at #14 works fine.

However, there was a bug I had to fix before going public with it. The link to Terms & Conditions isn't localized. Changing l('Terms & Conditions'...) to l(t('Terms & Conditions')...) at legal.module fixes this. Maybe someone wants to update the patch, as I'm still not able to do, due to lack of intellect.

How comes this important thing didn't make it into the dev release for three years now? It is very inconvenient for new users, directing them away from the registration page after they probably filled in tons of fields, uploaded pictures and stuff for their profiles. Legal is hardly production quality without this patch.

greg.harvey’s picture

Version: 6.x-8.x-dev » 7.x-1.x-dev
Priority: Major » Normal
Status: Needs review » Active

Good catch on the t() function. Feature requests do tend to slip the attention of busy maintainers - bug reports take precedence. Frankly, this is unlikely to make it in to the D6 version now. Bumping forward a version, to see if there are any takers for a D7 patch.

marcoka’s picture

ctools modal would be a way too.

marty.true’s picture

I guess the modal/lightbox concept got thrown out? It was mentioned back in Sept of 2010 that this was a good idea but still in v7, it is still not present? Almost all other sites that you see a "Terms of Service" link, it opens in an overlay so that you don't get taken away from the registration page... why has this not been accomplished yet?

I was able to make a simple change to the legal.module file, to include a lightbox call but it loads the entire page (with menus, etc) and not just the TOS text...

marcoka’s picture

legal module has a lof of more important code issues than adding new features :)

Anonymous’s picture

Bringing #14 to the dev version should be the least. Overlays are web 2.0 toys, but legal issues are a bit more serious. The terms should be very accessible, printable and their history absolutely transparent. Otherwise this module wouldn't reflect the need of serious webmasters for legal certainty.

Since this issue is brought up again, I wonder if the Legal module really is maintained. Doesn't seem so! Last commit to the dev is half a year old. Or do I miss something?

lindsayo’s picture

Version: 7.x-1.x-dev » 6.x-8.5

Inspired by #13, I wrote a quick little module to open the Terms & Conditions link in a new window:

function MODULENAME_form_user_register_alter(&$form, &$form_state) {

      if ($form['legal']['conditions']['#value'] == ' ') { 
        $form['legal']['legal_accept']['#title'] = t('<strong>Accept</strong> <a href="/legal" target="_blank">Terms &amp; Conditions</a> of Use');
      };
}

This isn't checking the contents of the title string, instead it's checking for the part of the conditions array as set in the 3rd case in the legal preview function in legal.admin.inc. It's also using the correct form ID. :)

xarchmaemo’s picture

Xstatic, could you tell me what lines you edited in the legal module to make colorbox show up? The full page is livable for now for me.

warmth’s picture

Version: 6.x-8.5 » 7.x-1.x-dev

Any news about this?

#21 doesn't work for me.

warmth’s picture

Temporally solved this using jQuery:

jQuery('#user-register-form a[href="/SUBFOLDER/legal"]').attr('target','_blank');
jQuery('#contact-site-form a[href="/SUBFOLDER/legal"]').attr('target','_blank');

Note: second line is about #804592: T&C for contact form - Comment #4

spyderpie’s picture

I vote for this feature!

warmth - where did you put this?

Thanks in advance,
Julie

warmth’s picture

@spyderpie, within one of my js files loaded with my custom theme.

Andre-B’s picture

Issue summary: View changes

fixed Drupal 7 Version of #21:

function mymodule_form_user_register_form_alter(&$form, &$form_state) {
  if (isset($form['legal']['legal_accept']['#title'])) {
    $form['legal']['legal_accept']['#title'] = t('<strong>Accept</strong> <a href="@terms" target="_blank">Terms & Conditions</a> of Use', array('@terms' => url('legal')));
  };
}

make sure to update the translation for that string, since it differs from legal module's one.

lindagreen’s picture

What's the status of getting a fix into the Legal module?

cmonnow’s picture

Since the user registration form itself is modified via hook_form_user_register_form_alter() you may have to use hook_module_implements_alter() or change module weights to make sure your code comes later if checking for an existing field.

In my case I sucked it up and added target="_blank" directly to the link in theme_legal_accept_label(). If a configuration option was ever decided on when Drupal 14 comes out in 2025 I would make opening a new window opt-out rather than opt-in to be consistent with current trends (you can even add rel="nofollow" while you're there for SEO purposes).

arnaldoaa’s picture

Hi, I add in template.php into /themes,
a small change in code #21 and it's worked for me.

function mythemes_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['legal']['legal_accept']['#title'])) {
      $form['legal']['legal_accept']['#title'] = t('<strong>Accept</strong> <a href="/legal" target="_blank">Terms &amp; Conditions</a> of Use');
      };
}
abarpetia’s picture

Hello,
#21 thanks for quick fix. I managed to configure Lightbox2 module by using following code.

function mythemes_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_register_form') {
	if (module_exists('lightbox2')){  	
	  	if (isset($form['legal']['legal_accept']['#title'])) {
	      $form['legal']['legal_accept']['#title'] = t('<strong>Accept</strong> <a href="' . url("legal") . ' #content" rel="lightmodal">Terms &amp; Conditions</a> of Use');
	    };
	}
  }
}

This weekend I'll try to Integrate Lightbox2 module with Legal module.

abarpetia’s picture

Title: Option to open Page Link in a new window » Option to open Page Link in a new window and Lightbox2 module integration
Assigned: Unassigned » abarpetia
Status: Active » Needs review
FileSize
5.8 KB

Patch to integrate Lightbox2 module and optional field to open page link into new window.

Please take a look.

abarpetia’s picture

  • Robert Castelo committed 66fa482 on Lightbox2_integration_and_new_window_field-372721-33
    Issue #372721 by abarpetia, greg.harvey, aaronbauman: Option to open...

  • Robert Castelo committed 66fa482 on 7.x-1.x
    Issue #372721 by abarpetia, greg.harvey, aaronbauman: Option to open...
Robert Castelo’s picture

Status: Needs review » Fixed

Thanks to everyone who worked on this patch!

I've added it to the 7.x-1.x-dev branch with some changes:

* Made the link target checkboxes into one radio field that is displayed dynamically if Link is selected as the Display Style
* Simplified and generalized the code so other modal dialog modules can be easily added
* Moved the Display settings below the T&Cs text field for a neater form

Robert Castelo’s picture

Bytheway, the out of the box styling of T&Cs in the Lightbox2 modal is horrible.

If anyone wants to provide a patch with some styling it would be very welcome!

Status: Fixed » Closed (fixed)

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