I just noticed that, with the legal module installed, the Terms and Conditions box shows up on all of the different sections of my user's profile pages.

In other words, it shows up in the settings panel, the custom profile panels, the newsletter subscription panel, etc.

It's already sort of a pain that it shows up in the main setting panel. Is is possible for it to just appear in it's _own_ panel, so that it doesn't have to load all that stuff every time a user wants to change one of their settings?

Or is this just happening to me?

I'm using Drupal 4.6.3, and the 4.6.x version of the legal.module

Coyote

Comments

noid’s picture

Yup, it showed up in my custom profile pages too. So had to disable it in my site for now until it is fixed.

Coyote’s picture

Not to be mean or anything, but if the maintainers aren't going to fix this, is there anyone else who knows enough about Drupal to do so? I haven't been able to puzzle it out.

robert castelo’s picture

The developer (me) is busy working on other stuff for the next two weeks.

I'll put some time into fixing this issue when time permits. In the mean time, if anyone wants to send me a patch I'd be gratefull.

Coyote’s picture

Any progress on this issue yet? Is there anyone familiar enough with how the user pages, etc. work to either make this fix, or point me in the right direction in making it?

Coyote’s picture

Okay... I'm not _that_ up on the ins-and-outs of how Drupal works, but I dug through the code for legal.module (instead of just whining about it here and being a pain -grin-), and it _looks_ like the fix is simple:

Under function legal_user, I added a condition in the "form" case, to only show the form if the category is the account settings one. That _seems_ to have worked, and doesn't seem to affect anything else.

I changed:

  case 'form':
	$legal_account= legal_get_accept($account->uid);
	
	// User is not account owner - disable checkbox
	if ($account->uid != $user->uid) {
	  $read_only = array('disabled' => 'disabled');
	}
	
	// T&C has already been accepted - disable checkbox
	if ($legal_account->uid) {
	  $read_only = array('disabled' => 'disabled');
	  $accepted = 1;
	}
	
	$form = legal_account_form($conditions['conditions'], $conditions['display'], $accepted, $read_only);
	return array(array('title' => t('Terms and Conditions of Use'), 'data' => $form, 'weight' => 0));
  
  

to

  case 'form':
  if ($category=="account") {
	$legal_account= legal_get_accept($account->uid);
	
	// User is not account owner - disable checkbox
	if ($account->uid != $user->uid) {
	  $read_only = array('disabled' => 'disabled');
	}
	
	// T&C has already been accepted - disable checkbox
	if ($legal_account->uid) {
	  $read_only = array('disabled' => 'disabled');
	  $accepted = 1;
	}
	
	$form = legal_account_form($conditions['conditions'], $conditions['display'], $accepted, $read_only);
	return array(array('title' => t('Terms and Conditions of Use'), 'data' => $form, 'weight' => 0));
  }

I'm leery that there's something about user hooks that I haven't grasped, so use at your own risk.

robert castelo’s picture

Thanks Coyote, that did it.

I've applied your solution to the cvs version, and I'll upload the fix to the 4.6 version later today.

Another small victory for open source collaborative development :-)

robert castelo’s picture

Status: Active » Fixed
robert castelo’s picture

Status: Fixed » Closed (fixed)