Drupal

Drupal
API reference - Drupal API

Re-enable comment in on existing pages

UPDATE node SET comment = 2 WHERE type IN ('page', 'geshinode')

e-commerce suite
http://drupal.org/project/ubercart

Best Drupal modules
http://drupal.org/project/google_plusone - Google Plus One +1
http://drupal.org/project/xmlsitemap - XML sitemap
http://drupal.org/project/page_title - Page Title
https://github.com/panticz/embed_url - Embed text into Drupal page from external URL

reCAPTCHA v2
https://www.drupal.org/project/recaptcha
https://www.google.com/recaptcha/admin/site/347239453
https://opensenselabs.com/blog/tech/add-captcha-forms-drupal-8-website

HowTo update modules

install:
cumulus
download http://ftp.drupal.org/files/projects/cumulus-6.x-1.3.tar.gz
extract
upload to /modules/
download cumulus.js (JS script needed by Cumulus, save under modules/cumulus)
upload to /modules/cumulus
configure:
admin/build/block/configure/cumulus/
Highlight color of cumulus: 000000

Drupal redirect after logout
A simpler solution is just to add the query string ?destination=MY-PATH to your logout link.

WP-Cumulus (3D Tag viewer)
http://wordpress.org/extend/plugins/wp-cumulus/
http://drupal.org/project/cumulus - Cumulus allows you to display your site's tags using Flash that rotates them beautifully in 3D
http://drupal.org/project/tagadelic - Tagadelic is a small module that generates a page with weighted tags. (needed by Cumulus)

View a block only on start page

<?php
if($_SERVER["REQUEST_URI"] == "/") {
    return TRUE;
}
?>

404 redirection in drupal with all blocks
YOUR_SERVER/admin/settings/error-reporting
Default 404 (not found) page: Home
http://drupal.org/project/blocks404

Links
http://drupal.org/node/15365 - Clean URLs
/admin/reports/status - Status report

Settings file
/sites/default/settings.php

enable default drupal statistics
/admin/reports/settings

Reset Drupal admin password

UPDATE users SET pass = MD5('terceS') WHERE uid=1;

Reset nodes read count

UPDATE node_counter SET totalcount = '0'

CSS customization on Drupal 8
/core/themes/seven/css/components/form.css

#edit-body-0-value {
    height: 800px;
}
 
ul.tips,
.text-summary-wrapper {
    display: none;
}

Update on hosting platform

<?php
$URL="http://ftp.drupal.org/files/projects/drupal-7.67.tar.gz";
 
function cmd($cmd, $exit = 0) {
    $last_line = system($cmd, $retval);
 
    echo "[" . $retval . "]" . "\t" . $cmd . "\t" . $last_line;
 
    if($retval == $exit) {
        echo "[OK]<hr>";
    } else {
        echo "[ERROR: $cmd]<hr>";
        exit;
    }
}
 
# move current
cmd("mkdir ./OLD");
cmd("mv * .htaccess .editorconfig .gitignore ./OLD/", 1);
 
# get new version
cmd("/usr/local/bin/curl -o drupal.tar.gz $URL");
cmd("tar xzf drupal.tar.gz");
cmd("mv drupal-*/* drupal-*/.* .", 1);
cmd("rm -r drupal-* drupal.tar.gz");
 
# copy files part 1
cmd("chmod -R 777 OLD", 0);
cmd("mv ./OLD/sites/all/modules/* ./sites/all/modules/", 0);
cmd("mv ./OLD/sites/all/themes/* ./sites/all/themes/", 0);
cmd("mv ./OLD/sites/default/files ./sites/default/", 0);
cmd("mv ./OLD/sites/default/files/.htaccess ./sites/default/files/.htaccess", 1);
cmd("mv ./OLD/sites/all/libraries/* ./sites/all/libraries/", 0);
cmd("chmod 777 ./OLD/sites/default");
cmd("mv ./OLD/sites/default/settings.php ./sites/default/");
cmd("chmod 660 ./sites/default/settings.php");
 
# set rights
cmd("chmod 750 ./sites/default");
cmd("mv ./OLD/misc/favicon.ico ./misc/favicon.ico");
 
# backup old
cmd("tar cjf ./OLD.". date("Y-m-d") . ".tar.bz2 ./OLD");
 
# remove old
cmd("rm -r ./OLD");
 
# delete myself
#cmd("rm upd.php");
 
# go to update page
#header("Location: update.php");
?>