Drupal site building tips

From

(Difference between revisions)
Jump to: navigation, search
Perspectoff (Talk | contribs)
(Replaced content with '{{Drupal_site_building_tips}}')

Current revision as of 21:56, 7 February 2012

Contents

Drupal site building tips

These tips were written for Drupal6 and have not yet been edited for Drupal7 and therefore may not be accurate; this section is under construction.

Introduction

Drupal is one of the most widely used website servers in the world. It is even used by the US White House. It is free and open source and can be customised to many different uses by installing additional modules. This page is a cookbook of how I set up a Drupal site and may be helpful for getting an initial site customized. I am assuming you have one (or multiple) Drupal installations running using these Drupal7 instructions or these Drupal6 instructions.

Initial user setup

  • It is not a good idea to give anonymous users access to the site or create accounts until you have the site completely set up and are ready to publish. There are people trolling the web looking for new setups, who will create an account and start installing modules faster than you can. Turn off anonymous user accounts:
Drupal -> Administer -> User management -> User settings -> Only site administrators can create new user accounts.
  • Create an administrator user role:
Drupal -> Administer -> User management -> Roles -> Add role -> administrator -> edit permissions -> check all
  • Create a new user who will be an administrator
Drupal -> Administer -> User management -> Users -> Add user -> Adminuser -> roles -> administrator
Use this user as your everyday administrator, saving the user you created at installation as the superuser

Create a Welcome page

  • Create a Welcome page:
Drupal -> Create content -> Page

You can choose where the display will end by adding the tag at the end:

<!--break-->
Note: If you don't put this tag at the end, the display of the page (known as the "teaser") will be truncated to 300 characters by default. This behavior can be changed:
Drupal -> Administer -> Content management -> Post Settings -> Length of trimmed posts: Unlimited

Change your default logo

  • The ideal size for a logo is about 110 x 100 pixels. A transparent background for the logo is desirable. (You can use Gimp to create an alpha transparency layer for any photo. See these instructions.) You can use Gimp or Gwenview to resize the image.
  • The default logo is specific to the Theme you are using. If you are using the default Garland theme, for example, change the logo:
Drupal -> Administer -> Themes -> Garland -> configure -> Logo image settings -> Use the default logo: unticked ->
Upload logo image: your_own_customised_logo.png

Create a new menu in the left sidebar

When most users create new content (such as a Page or Story), they place it in the Primary Links or Secondary Links menus. At installation, Primary Links and Secondary Links appear at the top of the page, which looks nice. But what if you want a new menu, that appears (for example) only on the left sidebar?

  • Create a new menu:
Drupal -> Administer -> Site building -> Menus -> Add menu ->
Menu name: mynewmenu -> Title: My New Menu -> Description: This is a custom menu I created. ->
  • Place the new menu in the left sidebar:
Drupal -> Administer -> Site building -> Blocks -> Disabled ->
My New Menu -> Left sidebar -> Save blocks
  • Add items to the menu (these can be external links or links to internal pages):
Drupal -> Administer -> Site building -> Menus ->
My New Menu -> Add item
Note that you can also create new content and add it to this new menu at any time.

Increase PHP memory

  • Increase PHP memory (or you will get a "memory exhausted" error). (Use the gedit text editor instead of kate if using Ubuntu instead of Kubuntu.):
sudo kate /etc/drupal/6/sites/mysite_x/settings.php
Add this line at the end:
ini_set('memory_limit', '96M');
I used to use 32M, but 96M helps with graphics.

Increase uploaded file size limits

The PHP scripting language is used for uploads. Absolute upload limits for the Apache webserver are set in a PHP configuration file and must be changed there.

  • Your uploads are probably larger than the default upload limits of PHP (set at 2 Mb, or "2M", by default), so we will need to increase those. In the example below, I will change the upload limit to 100 Mb ("100M"). Two parameters must be changed in the php.ini configuration file in /etc/php5/apache2 (use the gedit text editor instead of kate if using Ubuntu instead of Kubuntu):
cd /etc/php5/apache2
sudo kate php.ini
  • Change:
post_max_size = 8M
to
post_max_size = 100M
  • Change:
upload_max_filesize = 2M
to
upload_max_filesize = 100M
  • Save the file and restart apache2:
sudo /etc/init.d/apache2 restart

Install content creation kit (CCK) and other important modules

  • If you have a multi-site installation, create modules and themes folders within the /etc/drupal/6/sites/mysite_x folder, which will be specific to that site. If you wish to use modules and themes for all your subsites, then create modules and themes folders in the /etc/drupal/6/sites/all folder.

If you install your custom modules and themes in the root installation directory (/usr/share/drupal6), then they will be overwritten every time you do an upgrade, (which may or may not be desirable to you).

  • Although the recommended procedure is to install each module one-by-one (updating and setting the functions for each installed module individually), you may be able to install them all, update once, then set the functions for all the module simultaneously. This will only work if you have increased the PHP memory (as detailed in the previous step).
  • Install the CCK module:
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/cck-6.x-2.6.tar.gz
sudo tar zxvf cck-6.x-2.6.tar.gz
sudo rm cck-6.x-2.6.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> CCK -> select CCK module functions to enable
  • Install the Views module:
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/views-6.x-2.10.tar.gz
sudo tar zxvf views-6.x-2.10.tar.gz
sudo rm views-6.x-2.10.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Views -> select Views module functions to enable

When you wish to configure the Views properties of a content node, go to:

Drupal -> Administer -> Site Building -> Views -> Enable and Edit the node Views you wish to use
  • Install the Date module:
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/date-6.x-2.4.tar.gz
sudo tar zxvf date-6.x-2.4.tar.gz
sudo rm date-6.x-2.4.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Date/Time -> select Date/Time module functions to enable
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/jquery_ui-6.x-1.3.tar.gz
sudo tar zxvf jquery_ui-6.x-1.3.tar.gz
sudo rm jquery_ui-6.x-1.3.tar.gz
cd /etc/drupal/6/sites/all/modules/jquery_ui
sudo wget http://jquery-ui.googlecode.com/files/jquery.ui-1.6.zip
sudo unzip jquery.ui-1.6.zip
sudo rm jquery.ui-1.6.zip
sudo cp -r jquery.ui-1.6 jquery.ui
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> User interface -> select jQuery UI module functions to enable
  • Install the Event module:
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/event-6.x-2.x-dev.tar.gz
sudo tar zxvf event-6.x-2.x-dev.tar.gz
sudo rm event-6.x-2.x-dev.tar.gz
  • Install a few miscellaneous Event:Datepicker modules (see this thread):
cd /etc/drupal/6/sites/all/modules/event/contrib/datepicker
sudo wget http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/styles/datePicker.css
sudo wget http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.datePicker.js
sudo wget http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/date.js
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Event -> select Date Picker module functions to enable
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/signup-6.x-1.0-rc6.tar.gz
sudo tar zxvf signup-6.x-1.0-rc6.tar.gz
sudo rm signup-6.x-1.0-rc6.tar.gz
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/calendar-6.x-2.2.tar.gz
sudo tar zxvf calendar-6.x-2.2.tar.gz
sudo rm calendar-6.x-2.2.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Date/Time -> select Calendar module functions to enable
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/advanced_help-6.x-1.2.tar.gz
sudo tar zxvf advanced_help-6.x-1.2.tar.gz
sudo rm advanced_help-6.x-1.2.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Other -> select Advanced Help module functions to enable
  • Install the FeedAPI module (allows iCal feeds into Drupal):
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/feedapi-6.x-1.8.tar.gz
sudo tar zxvf feedapi-6.x-1.8.tar.gz
sudo rm feedapi-6.x-1.8.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Feed API Add-on -> select iCal parser module to enable
  • Install the iCal parser module (parses iCal feeds into Drupal):
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/parser_ical-6.x-1.1.tar.gz
sudo tar zxvf parser_ical-6.x-1.1.tar.gz
sudo rm parser_ical-6.x-1.1.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Feed API Default -> select Feed API module functions to enable
  • Install SimplePie, a module that facilitates RSS feeds through the FeedAPI module:
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/simplepie-6.x-1.0-beta1.tar.gz
sudo tar zxvf simplepie-6.x-1.0-beta1.tar.gz
sudo rm simplepie-6.x-1.0-beta1.tar.gz
cd /etc/drupal/6/sites/all/modules/simplepie/lib
sudo wget http://simplepie.org/downloads/simplepie_1.2.zip
sudo unzip simplepie_1.2.zip
sudo rm simplepie_1.2.zip
sudo cp simplepie_1.2/simplepie.inc .
sudo cp simplepie_1.2/simplepie.inc /etc/drupal/6/sites/all/modules/feedapi/parser_simplepie
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Other (and FeedAPI Default) -> SimplePie module functions to enable
  • (Optional:) Install the dCaldav module (for importing CALDAV server info into Drupal):
cd /etc/drupal/6/sites/all/modules
sudo wget http://www.dcaldav.com/system/files/dcaldav-0.2.1.tar.gz
sudo tar zxvf dcaldav-0.2.1.tar.gz
sudo rm dcaldav-0.2.1.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Other -> select dCaldav module functions to enable

Install Access Control modules

  • Install the ACL module (an API that allows per-user access controls in Drupal):
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/acl-6.x-1.0.tar.gz
sudo tar zxvf acl-6.x-1.0.tar.gz
sudo rm acl-6.x-1.0.tar.gz
  • Install the Content Access module (gives fine-grained access control over individual content pages):
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/content_access-6.x-1.2.tar.gz
sudo tar zxvf content_access-6.x-1.2.tar.gz
sudo rm content_access-6.x-1.2.tar.gz
  • Install the Forum Access module (gives fine-grained access control over individual forum pages):
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/forum_access-6.x-1.0.tar.gz
sudo tar zxvf forum_access-6.x-1.0.tar.gz
sudo rm forum_access-6.x-1.0.tar.gz
Note: If you wish these modules to be available to only one subsite, then install them instead into the /etc/drupal/6/sites/mysite_x/modules folder.

Note: You must update and adjust permissions after module installation.

  • Drupal -> Administer -> Modules -> Forum Access -> select ACL, Content Access, and Forum Access module functions to enable -> Rebuild Permissions (follow the prompts)
  • You must enable Access Control for each Content Type:
Drupal -> Administer -> Content Management -> Content types -> Page -> Edit -> Access Control -> Enable per content node access control settings: ticked

Enable permissions for added modules

  • Any time a new module is installed or the configuration of the module is changed, the database must be updated. This is especially important if you are running multiple sites, since configuration files must be created for each subsite. Updates can only be done by an administrator with suitable privileges for that site (usually the original user for the site or subsite):
http://mysite_x.mydomain.org/update.php
  • By default, permissions are turned off for any new modules that you have installed. After installing a new module, go to the permissions page and select permissions for each user role that will be able to access the functions of the new module(s):
Drupal -> Administer -> User management -> Permissions

and tick or un-tick the features that should be available to each class of user.

Create a Calendar content page

Using Date Tools to Create a Calendar

  • Create a custom Date and Time format which will display only the time (to be used later for the display fields):
Drupal -> Administer -> Site configuration -> Date and Time -> Locale:Default Time Zone:Choose your timezone -> Save configuration
Drupal -> Administer -> Site Configuration -> Date and Time -> Formats -> Add Format ->
->Format string: H:i
(This adds a format type to the drop-down selection which only displays hours and minutes.)
Drupal -> Administer -> Site Configuration -> Date and Time -> Formats -> Add format type ->
->Name: Time only -> Type: timeonly -> Save configuration
Drupal -> Administer -> Site Configuration -> Date and Time -> Formats -> Configure ->
->Time only Date format: (the dropdown box should now show your recently created time format, so select it) -> Save configuration

Note: You must update after creating this content type.

  • The Date Tools Wizard simplifies setting up a Date content type to be used with a Calendar display.
Drupal -> Administer -> Content Management -> Date Tools -> Date Wizard -> Save
Drupal -> Administer -> Site Building -> Views -> calendar_date -> Fields: Content: Date - From date -> Edit -> Format: Time only -> Update
Drupal -> Administer -> Content Management -> Content Type -> Date -> Manage Fields -> Label:Date: Configure -> Default value for To date: Same as From date -> Input format: Your preference -> Global Settings: Required (ticked) -> To Date: Optional -> Default Display: Long -> Save
Drupal -> Administer -> Site Building -> Views -> calendar -> Enable
  • Create some (event) content:
Drupal -> Create content -> Date -> create an event
  • View your calendar to see if it came out correctly:
Drupal -> Administer -> Site building -> Views -> calendar_date -> Edit -> View "Calendar page"
  • Add the calendar to the menu:
Drupal -> Administer -> Site building -> Menus -> Primary Links -> Add item -> Path: calendar-date -> Menu link title: Calendar -> Save
The permissions must be set to see the content. For each user role you wish to access the calendar, you must enable the "access all views" permission:
Drupal -> Administer -> User management -> Permissions -> views module -> access all views
Also, the times will only show up if you specifically enable the field_date views permission:
Drupal -> Administer -> User management -> Permissions -> content_permissions module -> view field_date

Add Forums

  • Enable forums:
Drupal -> Administer -> Modules -> Core -> select Forum module functions to enable

Note: You must update and adjust permissions after module installation.

  • Enable first forum "container", which will contain several related forums:
Drupal -> Administer -> Content Management -> Forum -> Add container -> General Forums
-> Add forum -> Forum Name:Forum_1 -> Parent:General Forums -> Weight:1
-> Add forum -> Forum Name:Forum_2 -> Parent:General Forums -> Weight:2
-> Add forum -> Forum Name:Forum_3 -> Parent:General Forums -> Weight:3
  • Enable Forums on the Navigation menu:
Drupal -> Administer -> Site Building -> Menus -> Navigation -> Forum: tick box -> Weight:1
  • If you wish users to be able to reply to forum posts, permissions for comments must be enabled.

Add Images

Install required modules

  • Make sure "Clean URL's" are enabled:
Drupal -> Site configuration -> Clean URLs -> Run the clean url test -> Clean URLs: Enabled
  • The primary module for images is ImageField, which replaces the older module Image. ImageField works with CCK.
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/imagefield-6.x-3.3.tar.gz
sudo tar zxvf imagefield-6.x-3.3.tar.gz
sudo rm imagefield-6.x-3.3.tar.gz
sudo wget http://ftp.drupal.org/files/projects/filefield-6.x-3.3.tar.gz
sudo tar zxvf filefield-6.x-3.3.tar.gz
sudo rm filefield-6.x-3.3.tar.gz
sudo wget http://ftp.drupal.org/files/projects/imageapi-6.x-1.8.tar.gz
sudo tar zxvf imageapi-6.x-1.8.tar.gz
sudo rm imageapi-6.x-1.8.tar.gz
sudo wget http://ftp.drupal.org/files/projects/imagecache-6.x-2.0-beta10.tar.gz
sudo tar zxvf imagecache-6.x-2.0-beta10.tar.gz
sudo rm imagecache-6.x-2.0-beta10.tar.gz
Note: If you wish these modules to be available to only one subsite, then install them instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> CCK -> select FileField and ImageField module functions to enable
Drupal -> Administer -> Modules -> ImageCache -> select ImageCache and ImageAPI module functions to enable
  • Install the GetID3 module (required by FileField) and its updated library. Then remove the security-risk demos folder:
cd /etc/drupal/6/sites/all/modules 
sudo wget http://ftp.drupal.org/files/projects/getid3-6.x-1.3.tar.gz
sudo tar zxvf getid3-6.x-1.3.tar.gz
sudo rm getid3-6.x-1.3.tar.gz
cd getid3 
sudo wget -O getid3-6.x-1.7.9.zip http://sourceforge.net/projects/getid3/files/getID3%28%29%201.x/1.7.9/getid3-1.7.9.zip/download
sudo unzip getid3-6.x-1.7.9.zip
sudo rm getid3-6.x-1.7.9.zip
cd demos
sudo rm *
cd ..
sudo rmdir demos
Note: If you wish these modules to be available to only one subsite, then install them instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Site Configuration -> GetID3 -> Path: sites/all/modules/getid3/getid3-1.7.9/getid3 -> Save configuration
Drupal -> Administer -> Modules -> Other -> select GetID3 module function to enable
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/token-6.x-1.12.tar.gz
sudo tar zxvf token-6.x-1.12.tar.gz
sudo rm token-6.x-1.12.tar.gz
sudo wget http://ftp.drupal.org/files/projects/views_gallery-6.x-1.2.tar.gz
sudo tar zxvf views_gallery-6.x-1.2.tar.gz
sudo rm views_gallery-6.x-1.2.tar.gz
sudo wget http://ftp.drupal.org/files/projects/nodereference_url-6.x-1.6.tar.gz
sudo tar zxvf nodereference_url-6.x-1.6.tar.gz
sudo rm nodereference_url-6.x-1.6.tar.gz
sudo wget http://ftp.drupal.org/files/projects/views_attach-6.x-2.2.tar.gz
sudo tar zxvf views_attach-6.x-2.2.tar.gz
sudo rm views_attach-6.x-2.2.tar.gz
Note: If you wish these modules to be available to only one subsite, then install them instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Site Configuration -> GetID3 -> Path: sites/all/modules/getid3/getid3-1.7.9/getid3 -> Save configuration
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/thickbox-6.x-1.6.tar.gz
sudo tar zxvf thickbox-6.x-1.6.tar.gz
sudo rm thickbox-6.x-1.6.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Other -> select Thickbox module functions to enable

Configure settings

  • Configure ImageCache:
Drupal -> Administer -> Site building -> ImageCache -> Add new Preset ->
-> thumbnail -> Save preset -> Actions -> Add scale and crop -> Width: 150 Height: 150 -> Create Action
Drupal -> Administer -> Site building -> ImageCache -> Add new Preset ->
-> fullsize -> Save preset -> Actions -> Add scale -> Width: 500 Height: (blank) -> Allow upscaling: ticked -> Create Action

Note: You must update and adjust permissions after module installation.

  • Create a Photo content type:
Drupal -> Administer -> Content management -> Content type -> Add content type -> Name : Photo -> Type: photo -> Description: A post that includes a nicely formatted image -> Save content type -> Photo -> Manage fields -> Add field -> Name: photofield -> field_photofield -> Select a field type: File -> Select a widget: Image -> Save -> photofield customization fields: (fill in desired settings) -> Save field settings -> Save
-> Display fields -> Label: (hidden) -> Teaser: thumbnail image linked to node -> Fullnode: fullsize image -> Save

Note: You must update and adjust permissions after module installation.

  • Create an image (Photo content):
Drupal -> Create content -> Photo -> Name: Photoexample_1 -> photofield: photo_filename_1.png -> Upload -> Save

Embed a video

  • You can easily embed a flash video from YouTube on any page. When creating a web page, make sure "Full HTML" is enabled as an input format:
Drupal -> Create content -> Page (or any content type) -> Input format -> Full HTML

For any YouTube video, the code which allows a video to be embedded on your website is found on the YouTube page in the upper right corner in the "Embed" box. Copy this code snippet.

In the "Body:" section of your Drupal Page (or other content), paste the code snippet and save. The video is now embedded on that page.

Add WYSIWYG editor

Apparently the choices here are FCKEditor, BUEditor, and TinyMCE editor. All require IMCE for image handling.

cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/imce-6.x-1.3.tar.gz
sudo tar zxvf imce-6.x-1.3.tar.gz
sudo rm imce-6.x-1.3.tar.gz
  • Install one of the editors, such as BUEditor:
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/bueditor-6.x-2.1.tar.gz
sudo tar zxvf bueditor-6.x-2.1.tar.gz
sudo rm bueditor-6.x-2.1.tar.gz
Note: If you wish these modules to be available to only one subsite, then install them instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Drupal -> Administer -> Modules -> Other -> select IMCE and BUEditor module functions to enable

Note: You must update and adjust permissions after module installation.

Update modules

Periodically, added modules are updated for security and functionality reasons. As always, backups are routinely advised before updating. In Drupal, most module updates are accomplished by overwriting old code with new code, not by patches. Therefore, if you have a highly customised installation, perform updates with care.

In this example, I will update Ubercart. Updating a module is essentially the re-installation of the new update, overwriting the old update.

cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/ubercart-6.x-2.2.tar.gz
sudo tar zxvf ubercart-6.x-2.2.tar.gz
sudo rm ubercart-6.x-2.2.tar.gz
Note: If a module is available to only one subsite, install the update instead into the /etc/drupal/6/sites/mysite_x/modules folder.

Note: You must update after module re-installation.

Perform backups

Yeah, you need to do it. See the Drupal 6 backup instructions. Also see this module for customised backups.

Backup and migrate module

  • Install the Backup and migrate module. This module only supports MySQL, so if you are using postgreSQL, do not use it. Also, this module does not work if you intend to perform an upgrade. Do not use it for backup and restore during an upgrade (it can only be used to backup and restore to exactly the same version of Drupal6).
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/backup_migrate-6.x-2.2.tar.gz
sudo tar zxvf backup_migrate-6.x-2.2.tar.gz
sudo rm backup_migrate-6.x-2.2.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Drupal -> Administer -> Site building -> Modules -> Other -> select Backup and migrate module functions to enable

Note: You must update and adjust permissions after module installation.

The module saves manual backups by default to /etc/drupal/6/sites/mysite_x/files/backup_migrate/manual and cron-scheduled backups to /etc/drupal/6/sites/mysite_x/files/backup_migrate/scheduled, but you can (and should) change this:

Drupal -> Administer -> Backup and migrate -> Destinations
  • Perform a Quick backup into the "manual" backup directory:
Drupal -> Administer -> Backup and migrate -> Backup -> Quick Backup -> Backup from Default Database to Manual Backups Directory using Default Settings -> Backup Now

Backup and restore the MySQL database

  • This is an alternative to the Backup and migrate module that is necessary if you wish to backup during a migration of your website. The best way is to backup the original database with a MySQL dump:
mysqldump -u user -p databasename > drupaldatabasebackupfile.sql
or, if on a remote host:
mysqldump -h hostname -u username -p databasename > drupaldatabasebackupfile.sql
Note that the username and password should be the username and password that were used to create the specific database (not the MySQL root username/password).
  • The database should be restored to an empty database in the new site, because if you re-install a new database in the new site and then attempt to restore your old backed-up database on top of it, there is likely to be incompatibilities between the two. Here the username and password are those for the new empty database just created. (It probably is best to make them the same as those of the imported database.)
mysql -u username -p databasename < drupaldatabasebackupfile.sql
Notes: This was successful for me only if backing up and restoring to exactly the same version of Drupal6. I could not back up the database from one version of Drupal6 then restore to an upgraded version of Drupal6, because the scripts of the upgraded version of Drupal6 did not access the database in the same manner. I therefore performed upgrades only after moving the database.

Empty a database

I hesitate to put these instructions here. Be careful. This erases your database. Use it only if you are confident that you have made good backups. I use this only if I have created a database by accident (during the Drupal6 installation process) and wish to erase/empty it.

mysql -u root -p
mysql> DROP DATABASE mysqlexampledatabase;
mysql> quit

If your MySQL superuser name is something other than root, then use that, of course. Don't forget the semicolon ( ; ) at the end of each MySQL command.

Of course, once you erase the database, you must re-create a blank one for use with Drupal6.

sudo dpkg-reconfigure drupal6

Then you can restore the backup (as created above with mysqldump) into the newly recreated (but still empty) database.

mysql -u username -p databasename < drupaldatabasebackupfile.sql

Moving a Drupal6 installation to a new site

  • Install drupal6 on the new site (sudo apt-get install drupal6). When creating the database, use the same values as used on the old site. If you can't remember what they were, look at the /etc/drupal/6/sites/default/dbconfig.php (or similar) file for the old site (which contains the values for the old site).
  • On the new site, rename the newly created folders
  • /etc/drupal/6
  • /usr/share/drupal6
  • /var/lib/drupal6
to
  • /etc/drupal/6.bak
  • /usr/share/drupal6.bak
  • /var/lib/drupal6.bak
  • Copy the /etc/drupal/6, /usr/share/drupal6, and /var/lib/drupal6 folders from the old site to the new site. (This needs to be done as the root user, which can be done with sudo dolphin).
  • Copy the database dumpfile from the old site to the new site.
  • Check the settings.php, dbconfig.php, files and other folder permissions to make sure they match the permissions of the original system. (Sometimes during the copy process the ownership of all files and folders will be set to root.) In particular, make sure that dbconfig.php belongs to the www-data group.

Notes: I have never been successful in performing an upgrade in the middle of this process. I recommend moving the site exactly, and then performing any upgrades after it is moved.

Use an SMTP server for email functions

I don't have a mail server on my system. Instead, I use an offsite mail handler that accepts the SMTP/POP3 protocols. Drupal can be configured to route its mail through SMTP/POP3 as well. If you are using SMTP, make sure outbound port 25 is open. If using secure SMTP (i.e. through SSL), then make sure outbound port 465 is open.

Install PHPMailer

  • Install the PHPMailer libraries on Ubuntu:
sudo apt-get install libphp-phpmailer
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/phpmailer-6.x-2.1.tar.gz
sudo tar zxvf phpmailer-6.x-2.1.tar.gz
sudo rm phpmailer-6.x-2.1.tar.gz
  • Copy the necessary files from the libphp-phpmailer Ubuntu package into the module directory:
sudo mkdir /etc/drupal/6/sites/all/modules/phpmailer/libraries
sudo cp /usr/share/php/libphp-phpmailer/class* /etc/drupal/6/sites/all/libraries/phpmailer
Note: If you wish these modules to be available to only one subsite, then install them instead into the /etc/drupal/6/sites/mysite_x/modules folder.
  • Note: You must update after module installation.
Drupal -> Administer -> Modules -> Mail -> select PHPMailer module functions to enable
  • Enter your SMTP settings:
Drupal -> Administer -> Site configuration -> PHPMailer

Add an online store to your website

Drupal6 has a completely free and powerful online store called Ubercart. Other solutions include Zen Cart and osCommerce. For Drupal7, a complete Drupal Commerce (see the introduction video) storefront framework is available as Commerce Kickstart.

Set up PayPal Website Payments Standard

  • Establish a bank account at your financial institution to be used exclusively with PayPal. Do not use your regular bank accounts, as PayPal will have access to both deposits and withdrawals from this account. (You can use a savings account, as all transactions between PayPal and the account will be electronic.)
  • There are basically two types of payment schemes for PayPal:
  • Website Payments Standard -- no monthly fee. 2.9% + $0.30 per (attempted) transaction. The customer goes to the PayPal site for payment then returns to the website.
  • Website Payments Pro -- $30 monthly fee. 2.9% + $0.30 per (attempted) transaction (less if significant volume). All transactions are performed through a gateway, without leaving the website.
  • In addition, there is Express Checkout for PayPal registered customers. The customer goes to the PayPal site then returns.
  • Until your needs are greater, Website Payments Standard is the least expensive solution to use. Create a PayPal Premier account. (The Premier account allows you to both buy and sell items.) Verify your email address and bank account. To verify your bank account, use the "Confirm deposits" method. (The instant verification method involves giving your secure online banking information (regarding your bank account) to PayPal, which is strongly advised against.) Verification of your bank account is a 4 day process, in general.

Create a PayPal Donate button

  • While logged in to the PayPal site, create your button(s) for donations (or payment or checkout) through the PayPal website.
PayPal -> Merchant Services -> Create Buttons -> Donate
  • Customise your button(s) as desired. When you "Create button" or "Save changes," the code for the button will be displayed. Copy the PayPal button code.
  • On your Drupal website, create a new block in which to display the newly created button. In this example I will place this new block in the right sidebar.
Drupal -> Administer -> Site building -> Blocks -> Add block ->
  • Block description: PayPal block
  • Block title: Donations
  • Block body: Paste the code from your PayPal button here
  • Input format: Full HTML
  • Customize other settings as desired -> Save block
  • Place the newly created block into the right sidebar:
Drupal -> Administer -> Site building -> Blocks -> PayPal block -> Disabled -> Dropdown: Right sidebar -> Save blocks

Install Ubercart on Drupal

cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/token-6.x-1.12.tar.gz
sudo tar zxvf token-6.x-1.12.tar.gz
sudo rm token-6.x-1.12.tar.gz
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/ubercart-6.x-2.0.tar.gz
sudo tar zxvf ubercart-6.x-2.0.tar.gz
sudo rm ubercart-6.x-2.0.tar.gz
Note: If you wish these modules to be available to only one subsite, then install them instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Ubercart -> select the Ubercart module functions you intend to use
  • PayPal requires cURL. Install the curl-php library in Ubuntu/Kubuntu (see this link for more info):
sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart
Drupal -> Administer -> Store administration

Setup PayPal with Ubercart

  • Undergoing revisions.
  • Check that a payment has been processed:
Drupal -> Administer -> Store Administration -> Orders -> View by status: Payment received

Trigger functions based on payment

The benefit of using Ubercart in Drupal is that access to website functions can be triggered based on a payment regimen. For example, access to webcam modules (such as videochat or webcams) can be enabled (using the ContentAccess module) after payment is processed by Ubercart through Paypal. This allows consumer-based telemedicine, a very desirable service for physicians.

Ubercart allows actions to be triggered, predicated on conditions being met (such as a PayPal payment notification being received). This can include the startup of other modules.

Drupal -> Administer -> Store administration -> Conditional actions

Add realtime videochat to your website

(This section under construction).

The following modules add videochat to Drupal:

Add BigBlueButton API

  • BigBlueButton is a standalone videoconferencing server. Install the BigBlueButton API that is able to call the BBB server from within Drupal:
cd /etc/drupal/6/sites/all/modules
sudo wget http://ftp.drupal.org/files/projects/bbb-6.x-1.x-dev.tar.gz
sudo tar zxvf bbb-6.x-1.x-dev.tar.gz
sudo rm bbb-6.x-1.x-dev.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Modules -> Big Blue Button -> select the Big Blue Button module functions you intend to use
  • Test the BigBlueButton settings:
Drupal -> Site administration -> BigBlueButton Conferencing -> Test connection.
  • Change the URL to the address of your BBB server (e.g. http://mybbbsite.dyndns.org:81/bigbluebutton/) and the Security Salt (found in bigbluebutton.properties on the BBB server in the
/var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
configuration file, in the setting:
beans.dynamicConferenceService.securitySalt=your_security_salt_number_here
  • Create a new content type named Teleconference:
Drupal -> Administer -> Content management -> Content types -> Add content type

-> Name: Teleconference -> Type: teleconference -> Big Blue Button settings -> Treat this node type as conference: (ticked) -> Show links to join / start a meeting beneath the node: (ticked) -> Display meeting status on node: (ticked) -> Save content type

  • Create a new node of content type Teleconference:

Drupal -> Create content -> Teleconference -> Conference settings -> ...

Add Kaltura video services

  • See these instructions for adding the API for the community edition of Kaltura, a video editor and manager for your website.

Upload and download files

Whether a file is available for private or public download depends, of course, whether the page to which it is attached is available privately or publicly. In addition, there are methods for maintaining private download folders (for FTP or other access).

Public files / attachments

In general, files are "attached" to a page. See Uploading files with Drupal for information about changing permissions.

  • Attach a file to an existing page (examplepage):
Drupal -> Administer -> Content Management -> Content -> examplepage -> edit
-> File attachments -> Attach new file: your file to upload -> Attach -> Save

Increase uploaded file size limits

Add a quotation module

Add the Fortune module to Drupal

Fortune is a *nix utility to display quotations from preselected files. Drupal has a plugin to display these quotations from within a webpage. Although a nice module, a disadvantage is that it uses monospace font and currently does not have options to adjust the font type and size. See here for installation details.

Add the Quotes modules to Drupal

cd /etc/drupal/6/all/sites/modules
sudo wget http://ftp.drupal.org/files/projects/quotes-6.x-1.40.tar.gz
sudo tar zxvf quotes-6.x-1.40.tar.gz
sudo rm quotes-6.x-1.40.tar.gz
Note: If you wish this module to be available to only one subsite, then install it instead into the /etc/drupal/6/sites/mysite_x/modules folder.
Note: You must update and adjust permissions after module installation.
Drupal -> Administer -> Site building -> Modules -> Other -> Quotes (ticked) -> Save configuration
  • Create a Quotes content and import your quotations. You can create a quotation one by one, or a large number of Quotations all at once (from a file, for example). Each quotation is created as an individual content item. The "display in Quote blocks" option determines whether a Quotes block (created in the next step to display a rotation of the quotations) will include the particular quotation(s) created in this step.
Drupal -> Create content -> Quotes
->Name: Quote%id -> Display in quote blocks: (ticked)

I use quotations from the Fortune program, which are in a particular text file format that looks like:

I reject your reality and substitute my own...
%
This is one of those "What the hell am I doing?" moments, over!
%
We got a robot in the water, he's stuffed with tuna and it's just another day here at Mythbusters.

I copy the contents of the text file into the input box.

-> Format: Import Fortune file -> Comment settings: Disabled -> Save

This will create as many content items as are in the Fortune file. If there are hundreds of quotes, you will have hundreds of Quote content items.

  • Configure the Quotes settings so that Quotes can appear as a block:
Drupal -> Administer -> Site configuration -> Quotes
-> Configure blocks -> Name: Quotes -> Add block -> Configure block
-> Update options -> Update every 6 seconds
-> Show block on specific pages -> Show on only the listed pages: choose the pages to display on
-> Save block
  • Add the Quotes Block on your site:
Drupal -> Administer -> Site building -> Blocks -> Quotes:Quotes -> Location
Personal tools
Sponsor
   CuBox