This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('DRUPAL_ROOT', getcwd()); | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
require_once 'includes/password.inc'; | |
echo user_hash_password('givenpassword'); | |
die(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteRule ^NEW_PATH$ OLD_URL [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
alert("Hello World!"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Drupal.behaviors.NomeModuloCustom = { | |
attach: function (context, settings) { | |
$('h1').addClass('.titolone'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Drupal.behaviors.makeMeSmelly = { | |
attach: function (context, settings) { | |
// Questo codice viene eseguito solo una volta | |
context.once(function() { | |
$('h1', this).addClass('.titolone'); | |
} | |
// Questo invece viene eseguito ad ogni richiesta | |
$('h1').addClass('.titoloneone'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drupal_add_js(array('myModule' => array('key' => 'value')), 'setting'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function password_reset(){ | |
global $user; | |
$hashthepass = 'password'; /* Your password value*/ | |
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc'); | |
$hashthepass = user_hash_password(trim($hashthepass)); | |
if (!$hashthepass) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mymodule_setup_batch($start=1, $stop=100000) { | |
$dataset = array(); // A very large dataset | |
$chunks = array_chunk($dataset, 20); // Divide the dataset | |
$operations = array(); | |
$count_chunks = count($chunks); | |
$i = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Example args for get_posts() */ | |
$query_args = array( | |
'posts_per_page' => -1, | |
'orderby' => 'title', | |
'order' => 'ASC', | |
'post_status' => 'publish', | |
'suppress_filters' => false | |
); |
OlderNewer