If you download the module and look at the code, you'll see the entire module consists of 1 simple function:
function disablepwstrength_init() {
// If the user is currently on a user/* page or the admin/user/user page, insert the JS.
if (arg(0) === 'user' || (arg(0) === 'admin' && arg(1) === 'user' && arg(2) === 'user' )) {
drupal_add_js('Drupal.behaviors.password = function () {};', 'inline', 'footer');
}
}
I would advise against ever using hook_init() for a function that doesn't need to run on every page load. It's minor, but that's an extra function call that's occurring all the time, whether they're on the user registration page or not. I would recommend instead inserting something like this into your theme's template.php file:
if (arg(0) == 'user') {
drupal_add_js('Drupal.behaviors.password = function () {};', 'inline', 'footer');
}
This does the same thing without the overhead of installing a new module. You can put this inside phptemplate_preprocess_page().
In file disablepwstrength.module change the code in line 18
from drupal_add_js('Drupal.behaviors.password = function () {};', 'inline','footer');
to drupal_add_js('Drupal.behaviors.password = function () {};', array('type' => 'inline', 'scope' => 'footer'));
in file disablepwstrength.info replace every 6.x to 7.x ,
And you are ready to use the module in Drupal 7
I have just cut a Drupal 7 version of this module which uses hook_form_FORM_ID_alter() to apply the javascript, so this only gets called on the two pages where it's required. Due to some issue on drupal.org, I'm unable to create a release node for this (see #1288006: Unable to create release snapshot for Password Strength Disabler 7.x-1.0) so you'll have to grab it from git for now.
Comments
Comment #1
mrfelton commentedSubscribe. Need this for D7 too.
Comment #2
pgough commentedsame here
Comment #3
kevinquillen commentedNot sure if you want to use this solution, but this is how I did it in D7:
Working on fix for the password helper.
Sidenote, is there any way to get these in as form items so they can be moved or placed in other areas in a tpl?
Comment #4
rafamd commentednice module to have for D7 ..
Comment #5
charlie-s commentedIf you download the module and look at the code, you'll see the entire module consists of 1 simple function:
I would advise against ever using hook_init() for a function that doesn't need to run on every page load. It's minor, but that's an extra function call that's occurring all the time, whether they're on the user registration page or not. I would recommend instead inserting something like this into your theme's template.php file:
This does the same thing without the overhead of installing a new module. You can put this inside phptemplate_preprocess_page().
Comment #6
mrfelton commentedPerhaps this module might be made more efficient by using hook_form_FORM_ID_alter to inject the javascript on only the specific forms that require it.
Comment #7
milenv commentedIn file disablepwstrength.module change the code in line 18
from
drupal_add_js('Drupal.behaviors.password = function () {};', 'inline','footer');to
drupal_add_js('Drupal.behaviors.password = function () {};', array('type' => 'inline', 'scope' => 'footer'));in file disablepwstrength.info replace every 6.x to 7.x ,
And you are ready to use the module in Drupal 7
Comment #8
mrfelton commentedI have just cut a Drupal 7 version of this module which uses hook_form_FORM_ID_alter() to apply the javascript, so this only gets called on the two pages where it's required. Due to some issue on drupal.org, I'm unable to create a release node for this (see #1288006: Unable to create release snapshot for Password Strength Disabler 7.x-1.0) so you'll have to grab it from git for now.
Comment #9
jherencia commentedPlease look at: #1300858: Performance improvement