Is it possible to snow the Legal only at user registration???
Cause every time, i edit the profile, the legal acception appears.

Comments

Sabareesh’s picture

I opted to go with form alter to remove the Terms and condition generated by the legal module in the profile edit page. By I find it quite hard to know that the legal module's terms and condition is not present in the $form in hook_form_alter(). Hence I went with CSS to hide the terms and conditions in the registration/ profile page.

In case of any other better method please do mention.

haggins’s picture

You can't find the legal key of $form in hook_form_user_profile_form_alter because legal uses this hook on it's own. So your module needs a higher weight so that your code gets called later on.

If you have a custom module, the following code will ensure your modules weight gets set to the right value on module installation:

yourmodule.install

/**
 * Implements hook_install().
 */
function yourmodule_install() {  
  // Find out the weight of legal module.
  $weight = db_query("SELECT weight FROM {system} WHERE name = 'legal' AND type = 'module'")->fetchField();
  
  // Set our module to a weight 1 higher.
  db_query("UPDATE {system} SET weight = :weight WHERE name = 'yourmodule' AND type = 'module'", array(':weight' => $weight + 1));
}

There's also a module for this: Modules Weight

However, it would be great if there was just a checkbox on the settings page to let the site builder decide whether T&C should be shown at the user profile or not. So I turn this issue into a feature request.

haggins’s picture

Category: Task » Feature request
Issue summary: View changes
gaurav.goyal’s picture

StatusFileSize
new2.01 KB

Patch Applied for above feature request,
Added a option in config form for showing the legal form on user profile page.

gaurav.goyal’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: legal-user-registration-1786582-4.patch, failed testing.

chansionjoe’s picture

+1

safallia joseph’s picture

Patch in https://www.drupal.org/node/1703336#comment-11789565, provides a settings form to set the user roles to exclude the Legal on profile edit pages.

safallia joseph’s picture

Status: Needs work » Needs review

  • Robert Castelo committed 5329cbb on legal-user-registration-1786582-4
    Issue #1786582 by gaurav.goyal: Legal only at user registration???
    

  • Robert Castelo committed 5329cbb on 7.x-1.x
    Issue #1786582 by gaurav.goyal: Legal only at user registration???
    
robert castelo’s picture

Status: Needs review » Fixed

Thanks for the patch Gaurav Goyal, I'm including it in the dev branch with a few chages:

* Moved it to the Legal Configuration page
* Namespaced the variable to begin with 'legal_' to avoid clashes with other modules
* Unset the variable in module uninstal function
* Set variable default to 1 on Profile page form

Status: Fixed » Closed (fixed)

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