Resetting or updating passwords for Drupal users in command line

The


drush user-login username

command or it's alias


drush uli username

will display a one-time login URL to login the specified account. The output is a URL like:


http:///user/reset/1/1358351267/WvqBsED_WKGeThnoY67SCRddVfpGymDaA1w1GP7ZTtP

After logging in using this URL, the user it NOT required to change the password.

To generate one time login for user #1 fire up just


drush uli

Running


drush sqlq "SELECT name, pass FROM users WHERE uid = 1;"

Impending Drupal Site Launch? Use the List

After months of site development, code, more code, and long hours, launch day arrives. A site launch can come as a relief, create a bittersweet moment, or one filled with pride and a sense of accomplishment, not unlike a parent sending a child off to their first day of kindergarten.

Tags:

Syncing Two Drupal Sites

The drush module for Drupal has a new “sync” option to synchronize two Drupal sites, but it is undocumented and looking at the source code all it does is sync the files, not the mysql database. I haven’t seen any other public solutions that do completely sync 2 drupal sites including the databases.

Tags:

How to disable and enable Drupal 7 blocks programmatically

Sometimes you need to enable and place a Drupal 7 block in a seen region like header, content, footer, etc., and other times you need to disable it programmatically in a custom module. So to do it you just need to create two functions:

function _start_refreshing() {

db_update('block')
->fields(array(
'status' => 1,
'weight' => -10,
'region' => 'footer',
))
->condition('module', 'mymodule')
->condition('delta', 'mymodule_delta')
->execute();

}

and

function _stop_refreshing() {

Tags:

How to delegate a subdomain to another nameserver

In order to delegate a sub-domain's DNS management to another server, perform the following steps:

1. Set NS records for your subdomain and in DATA field put a nameserver:


sub.domain.com NS ns1.nameserver.tld
sub.domain.com NS ns2.nameserver.tld

2. Then create a new nameserver
sub.domain.com

3. Now you can start adding A records for your new subdomain, like:


sub.sub.domain.com

Tags:

If delivered mail doesn't show in user inbox

One of our Ubuntu servers stopped to show properly delivered messages in user inboxes after the last kernel update (Ubuntu precise (12.04.4 LTS)). Because for some reasons DEFAULT= and ORGMAIL= in /etc/procmailrc got replaced by

DEFAULT=/var/mail/$LOGNAME
ORGMAIL=/var/mail/$LOGNAME

so we had to change it back to:

DEFAULT=$HOME/Maildir/
ORGMAIL=$HOME/Maildir/

Now everything is working fine with the following settings for procmail:

root@quiethost:/etc# cat procmailrc
LOGFILE=/var/log/procmail.log

Tags:

Disable Named in chroot and remove chroot partition

The recent versions of bind recommends the chroot environment for better security. When considering the most used popular Linux distribution ‘Red Hat’, they ship a package called ‘bind-chroot’ for the chrooting of bind. By default the bind or named daemon runs in a chroot environment.

But users who want to run ‘named’ in the old fashion may do so by disabling the ‘chroot’ environment. The ‘chroot’ing feature can be disabled by commenting out the directive ‘ROOTDIR=/var/named/chroot’ in the file ‘/etc/sysconfig/named’ and then restarting the ‘named’ service.

df -h

Tags:

How to install IonCube loader on CentOS 6.3

Download and uncompress the latest IonCube version:

wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz # 32 bit
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz # 64 bit
tar xvfz ioncube_loaders_lin_x86-64.tar.gz

Then we go to the new IonCube source directory:
cd ioncube/

Move ioncube_loader_lin_5.3.so:
mv ioncube_loader_lin_5.3.so /usr/lib/php/modules/

Now edit /etc/php.ini and add the line zend_extension = /usr/lib/php/modules/ioncube_loader_lin_5.3.so

Tags:

What is stopping Varnish?

Every so often with Pressflow and Varnish you might find that your anonymous users aren't being cached via Varnish.

A quick way to see whether your anonymous pages are being served is to add some debugging headers to Varnish by adding some code like the snippet here to vcl_deliver()

sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Varnish-Cache = "HIT";
}
else {
set resp.http.X-Varnish-Cache = "MISS";
}
}

and hit them with

curl -I http://yoururl.com

How to insert a block or a region in the middle of Drupal node content

The solution for Drupal 7.10:

/** in template.php **/

function THEME_preprocess_node(&$variables) {

//load your adblock
$adblock = block_load('block', '1');
$output .= drupal_render(_block_get_renderable_array(_block_render_blocks(array($adblock))));
$variables['ad'] = $output;
}
/** in node.tpl.php **/

$array = explode("", $body[0]['value']);
$array[1] = $ad. $array[1];
$content['body'] = implode("", $array);
print render($content['body']);

Inserting Adsense Into Content - Drupal 6.X

Tags:

Pages

Subscribe to Front page feed