Developers and coders

Why host your project on Drupal.org

Last modified: December 2, 2009 - 14:29

Contributors are strongly encouraged to host themes, modules, translations and installation profiles at drupal.org rather than elsewhere (GitHub, BitBucket, your personal site, etc.) for the following reasons:

  • Larger User Base - Most users check Drupal.org first and assume the project doesn't exist if it's not there.
  • Consistency Is Understandable - It is much easier for someone new to Drupal to understand how to download and install themes/modules from a central location rather than 3 or 4 central locations
  • Unified Issue Tracker - "My Issues" will show any issues you are subscribed to for any Drupal project, instead of having to go to different sites to check
  • Usage Statistics - Any project or theme on Drupal.org has tracked usage statistics via the Update Status module
  • Update Notifications - A Drupal website will notify (even email if you prefer) you when a Drupal.org project is updated via the Update Status module
  • Programmatic Updates & Downloads - Hosting everything at Drupal.org means that Drush, Aegir, Plugin Manager, etc. can all have a uniform method of downloading and updating projects.

Deploy to non-writable media

Last modified: December 12, 2009 - 15:36

CD Deploy is a Webserver for Drupal that runs from a CD/DVD media on Microsoft Windows 9x/ME/XP and Vista.

HOW TO USE

Structure

The 'app' folder is the right place to copy your Drupal site.
The 'lib' folder is used to save any 3rd party software needed to create the Webserver executable. This forder contains a Makefile which have instructions to create the folder 'server'.
The 'db' folder should be created manually, containing a copy of your Drupal site's MySQL Database.

Install 3rd Party Software

By default, CD Deploy comes without any 3rd party software, have to be downloaded from the Internet using the Makefile script available in folder 'lib':

$ cd lib
$ make all

Install Database

  1. Copy Database
    Create the folder 'db', and copy there all files of your MySQL database.
    $ mkdir 'db'
    $ ls
    app   db   lib   LICENSE.txt   Makefile   Start.nsi
  2. Register database for Drupal
    This might be the hardest step but is done only once:
    • Once you have installed 3rd party software (see Install 3rd Party Software above), copy the folder 'lib/server' into a windows box.
    • Run the program 'Start' (or Start.exe)
    • Create directory www into server folder

Working with Field

Last modified: December 1, 2009 - 21:30

Placeholder page for field module.

File module (core)

Last modified: December 1, 2009 - 02:31

Placeholder page for D7 File module.

HowTo: Integrate Privatemsg with Application toolbar (AppBar)

Last modified: November 30, 2009 - 09:14

The following code sample shows you how to integrate Privatemsg with the Application Toolbar.

<?php
/**
* Implements hook_privatemsg_message_insert().
*
* Adds a notification for each recipient when a message is sent.
*/
function yourmodule_privatemsg_message_insert($message) {
 
$text = t('!user sent you a private message', array('!user' => theme('username', $message['author'])));
 
$alert_type = 'privatemsg-receipt';
  foreach (
$message['recipients'] as $recipient) {
   
appbar_set_message($text, $alert_type, $recipient->uid);
  }
}

/**
* Implementation of hook_appbar_id().
*/
function yourmodule_appbar_id() {
  return array(
   
'privatemsg-receipt' => t('Privatemsg receipt (alerts recipient)'),
  );
}
?>

More information:
Privatemsg API documentation: http://blog.worldempire.ch/api
Application Toolbar API documentation: http://drupal.org/node/546536#api
Application Toolbar Integration examples: http://drupalcode.org/viewvc/drupal/contributions/modules/appbar/appbar_...

HowTo: Integrate Privatemsg with UserPoints Module

Last modified: November 30, 2009 - 09:02

There are two way to integrate Privatemsg with the UserPoints module. First, it is possible to use the privatemsg_rules module (see #327938: Rules Integration) which allows to configure some basic definitions (For example, when sending a private message).

The second possibility is to create custom hook functions which allow for much mor flexiblitly and make it possible to set a description.

Example 1: Give a user 5 points when sending a new message and 6 when sending a reply.

<?php
function yourmodule_privatemsg_message_insert($message) {
 
// If thread_id and mid is the same, this is a new thread.
 
if ($message['thread_id'] == $message['mid']) {
   
$params = array(
     
'uid' => $message['author']->uid,
     
'points' => 5,
     
'description' => 'You have sent a new private message to a user of the community.',
    );
  }
  else {
   
$params = array(
     
'uid' => $message['author']->uid,
     
'points' => 6,
     
'description' => 'You have replied to a private message.',
    );
  }
 
userpoints_userpointsapi($params);
}
?>

Syndicate content
 
 

Drupal is a registered trademark of Dries Buytaert.