Monday, March 19, 2012

D7 alter login form set default username password



function MYMODULE_form_user_login_block_alter(&$form, &$form_state) {
  $form['#attached']['js'] = array(
    drupal_get_path('module', 'MYMODULE') . '/js/login_form.js',
  );
}



login_form.js
==========
(function ($) {
  $(document).ready(function() {
    var name = document.getElementById("edit-name");
    name.value = "demo";

    var pass = document.getElementById("edit-pass");
    pass.value = "password";
  });
})(jQuery)





Sunday, March 18, 2012

purge drupal taxonomy term data


  // drush php-script purge_taxonomy_term.php

  $vocab_vid = taxonomy_vocabulary_machine_name_load("vocab_name")->vid;

  $terms = taxonomy_get_tree($vocab_vid);
  foreach($terms as $term) {
    //$term = taxonomy_term_load($term->tid);
    taxonomy_term_delete($term->tid);
  }