A customization and theming guide for getting more out of your Drupal site. While you can make a fairly nice site using Drupal core modules, in order to leverage Drupal's built in power you should be somewhat familiar with PHP, MySQL and web design.
Included in this section are PHP and SQL code snippets and examples for use in your sites pages, blocks and themes. There are also a few articles on theming engines, which provide the infrastructure to build and create new themes.
Note: Feel free to add handbook pages that are relevant to this section. They go into the moderation queue for review and approval.
A large number of community created modules allow you to enhance your Drupal system.
You must install and configure each module individually on your machine. Each module download contains specific install instructions. Further description of specific modules' administration and use is contained within. Use modules that have the same version as your Drupal installation.
The following list is just a sample of some useful modules. More modules are added by various people on a constant basis. You can check the latest modules and download them from the Drupal contributed modules project section.
You can keep track of recently created modules by reading Nodes tagged with module term (RSS feed of same) you can also see modules sorted by last update though that page lacks an RSS feed.
NOTE: Not all contributed modules are listed here. Please help by contributing documentation for those that are not. When possible work with the module contributor to ensure accuracy.
The actions module allows the configuration of Drupal actions. A Drupal action is a specially written PHP function whose parameters are configured through the web. For example, the Send Email action has parameters Recipient, Subject, and Message. You could fill in MrFoo@example.com for the recipient, Hi for the subject, and Hello, Mr. Foo for the message to create an instance of the Send Email action. This action instance could then be fired by a module at appropriate times when you want Mr. Foo to get an email.
Actions are like stored procedures that can be loosely coupled with events in Drupal.
Let's examine a ridiculously simple example. Suppose you want to be draconian with your Drupal site's comment policy. Any user who leaves a comment gets blocked immediately. You can implement this quite easily with the comment hook:
<?php
foo_comment($a1, $op) {
if ($op == 'insert') {
global $user;
// block user here...
}
}
?>
What an action does is wrap up this code into a nice package. That package can then be associated with the nodeapi hook. Or some other hook. Actions takes this function, which we'll call "Block current user", and allows you to assign it to any hook-op combination.
We do that by several coding conventions. Here is the skeleton of a simple action:
<?php
/**
* Implementation of a Drupal action.
*/
function action_block_user($op, $context = array(), &$object) {
switch ($op) {
case 'do':
global $user;
// block user here...
break;
case 'metadata':
return array(
'description' => t('Block current user'),
'type' => 'User',
'batchable' => TRUE,
'configurable' => FALSE,
'supported hooks' => array(
'nodeapi' => array(
'delete' => 1,
'insert' => 1,
'update' => 1,
'view' => 1
),
'comment' => array(
'insert' => 1,
'update' => 1,
'delete' => 1
)
)
);
}
}
?>
We've implemented two ops. The 'metadata' op describes the action by declaring some things, including what hook/op combinations it supports. The 'do' op is actually where the code runs. We list the 'do' op first in the switch statement for performance, since Drupal will then encounter it first during execution.
The above is a nonconfigurable action. There's nothing about it you can change. It will block the current user and that's that. It's basically a singleton action.
On the other hand, an action like "Send email" needs to know some things in order to run. It needs a subject, and body, a recipient, and such. Configurable actions are not available for use until they have been configured (obviously). They can be configured from the main actions interface at admin/build/actions.
The administration module provides an interface for site administrators to create a experience for users. The module allows for a full-page interface of the administration menu and can be configured. The default interface for this module is task based to help administrators create accomplish the most common task identified in usability studies. It also includes statistical overview information about the site activities as well as links to handbook pages to address challenging administration tasks.
You can deactive menus.
You can:
The AdSense Injector module allows administrators to specify automatic insertion of AdSense ads into a node full-page view, or, if desired, after teasers in frontpage or taxonomy list views.
It provides centralized control of:
AdSense Injector also respects the AdSense module visibility settings - if you have set visibility options in the AdSense module, AdSense injector will insert ads only into the paths you have chosen to allow.
Why is this useful? In my experience, this simplifies certain important aspects of ad insertion and placement.
Traditional approaches:
AdSense Injector uses (and requires) installation and proper configuration of the AdSense Module in order to function properly. Please install, configure, and test the AdSense module before you install Adsense Injector.
See it in use at http://exodusdev.com and http://www.roadcarvin.com
Note: This page describes Adsense_Injector release 2.5 and later
Configuration is fairly straighforward.
Enable the options that make sense (insert in node body and / or on teaser lists), enable insertion on the desired node types, and configure the insertion templates as needed.
The default templates are fairly simple.
One interesting feature as of the 2.5 releases is the ability to insert before and/or after the node teaser or body, and the ad insertion now uses the adsense module filter tag format - in other words, you insert '[adsense:nnnxnn:1:1]' style tags rather than specify ad format in the configuration options. This vastly simplifies the configuration, and, provides maximum flexibility in setting up ad insertion.
Please see the adsense module help and documentation for more information on the filter tag and ad formats available for use.
Installation is done in the usual way: just drop the module into your selected modules directory and enable the module.
More info here:
Note: This page describes the 2.5 and later releases
Consider the default node insertion template (formatted for readability):
<div class="ad-auto-inserted" style="float:left; margin: 0 1em .25em 0;">
[adsense:120x240:1:1]
</div>
%body
<br class="clear"/>
[adsense:468x60:1:1]
On full node views, this will insert a 120x240 left-floating ad block before the node body, then, after the body text, a 468x60 ad will be appended, both ads using the adsense module's group 1 and channel 1 settings.
Now, then, what else can we do? How about putting an ad on both the left and right side of the top of the node, as well as at the bottom? We can do that very easily, using inline float styles (for the purposes of this example - it's cleaner to use stylesheet-defined CSS rules).
(Yes, this is probably annoying in-your-face advertising, and I wouldn't recommend it, but it serves to demonstrate capabilities.)
<div class="ad-auto-inserted" style="float:left; margin: 0 1em .25em 0;">
[adsense:120x240:1:1]
</div>
<div class="ad-auto-inserted" style="float:right; margin: 0 0 .25em 1em;">
[adsense:120x240:1:1]
</div>
%body
<br class="clear"/>
[adsense:468x60:1:1]
Give it a try.
Obviously, you can play a lot of tricks with the template strings - for example, you can insert any arbitrary text before or after the node body, including html, javascript, etc. The sky (and your imagination) is the limit, just be careful not to break anything. (At this point, the adsense_injector module can do more than just inject ads using the new template scheme.)
Please see the adsense module help and documentation for more information on the filter tag and ad formats available for use.
NOTE: This module has been removed from core as of 5.0
The archive page allows content to be viewed by selecting the day. It also provides a monthly calendar view that users can use to navigate through content.
To view the archive by date, select the date in the calendar. Administrators can enable the Calendar to browse archives block in block administration to allow users to browse by calendar. Clicking on a date in the monthly calendar view shows the content for that date. Users can navigate to different months using arrows beside the month's name in the calendar display. The current date will be highlighted in the calendar.
You can
Each module that produces content may have a page that lists content of that type. For example all blog posts can be seen at the blog path. Content that has been categorized using taxonomy terms have a page for viewing that content.
Placeholder for the documentation of the asset module.
The audio module allows users to add audio media content to a site. Audio is an important medium for community communication. The recent rise of the podcast phenomenon is an example of the trend towards audio content. The audio module enables music, spoken word, and voicemail messages to be played on a site, and all audio node content is automatically podcast-enabled.
The audio module allows a user to create a new audio post. An audio post lets you uploadand download audio files, and uses the getID3 library to read and write ID3 tag information from the audio file. The getID# library is required. This module comes with a handy flash player that can be embeded in your site, to allow streaming of the audio without allowing downloads. Audio files can be submitted by browsing users computer for files to upload. Audio posts can also be configured to allow the files to be downloaded. Audio administration allows the path for audio files to be uploaded to be configured. The getID3 library can also be configured in audio administration.
You can:
If you've got the audio_image module enabled you can attach images to audio nodes. Currently the images are not displayed as part of the teaser. The following code snippet shows how to override the default teaser theme function on a PHPTemplate theme. Add this to your template.php file.
For Drupal 4.7
<?php
function phptemplate_audio_teaser($node) {
// make sure that all the allowed tags are included.
foreach (audio_get_tags_allowed() as $tag) {
$params['%'. $tag] = isset($node->audio_tags[$tag]) ? $node->audio_tags[$tag] : '';
}
$params['%filelength'] = theme('audio_format_filelength', $node->audio_fileinfo);
$params['%fileformat'] = theme('audio_format_fileformat', $node->audio_fileinfo);
$params['%player'] = audio_get_player($node);
$params['%play_count'] = $node->audio_fileinfo['play_count'];
$params['%download_count'] = $node->audio_fileinfo['download_count'];
// THE CHANGE FROM THE ORIGNAL FUNCTION IS HERE
// if there's an image, put it in as an %image parameter.
if ($image = audio_images_get($node->audio_images)) {
$params['%image'] = "<div class='audio-image'>\n" . theme('audio_image', $image) . "\n</div>\n";
}
// THAT'S ALL
$format = variable_get('audio_teaser_format', '%player %filelength');
return t($format, $params) . $node->teaser;
}
?>
For Drupal 5
<?php
function phptemplate_audio_teaser($node) {
// make sure that all the allowed tags are included.
foreach (audio_get_tags_allowed() as $tag) {
$params['!'. $tag] = isset($node->audio_tags[$tag]) ? check_plain($node->audio_tags[$tag]) : '';
}
$params['!filelength'] = theme('audio_format_filelength', $node->audio_fileinfo);
$params['!fileformat'] = theme('audio_format_fileformat', $node->audio_fileinfo);
$params['!player'] = audio_get_player($node);
$params['!play_count'] = check_plain($node->audio_fileinfo['play_count']);
$params['!download_count'] = check_plain($node->audio_fileinfo['download_count']);
// THE CHANGE FROM THE ORIGNAL FUNCTION IS HERE
// if there's an image, put it in as an !image parameter.
if ($image = audio_images_get($node->audio_images)) {
$params['!image'] = "<div class='audio-image'>\n" . theme('audio_image', $image) . "\n</div>\n";
}
// THAT'S ALL
$format = variable_get('audio_teaser_format', '!player !filelength');
return t($format, $params);
}
?>
For more info see #78883, the issue that spawned this.
Q: Why does the player stop at weird parts?
A: I'm not really sure. If you're running into this bug please leave a comment on this issue with more information.
Q: Is there an upgrade script for 4.6 to 4.7?
A: Yes, there is read more about on issue #57769.
Q: I don't want to have to upload the audio to my site and waste bandwidth. Can I use remote URLs?
A: No, but it's a feature I'd like to implement.
Q: Why do I have to click the Flash player twice?
A: You're using IE. See #70241.
Q: I can only upload 2MB files or less.
A: If you notice that you can only attach 2Mb MP3's, you need to up your limits. Assuming your host allows this - you need to add a line like this to your .htaccess file: php_value upload_max_filesize 20M or check the upload limitations of your PHP.ini settings.
Q: I screwed something up. How do I completely re-install the audio module?
A: First, you need to remove the audio module's tables:
DROP TABLE audio;
DROP TABLE audio_file;
DROP TABLE audio_metadata;
DELETE FROM system WHERE name = 'audio';
This module makes use of the wonderful getID3 PHP library for reading and writing ID3 tags for mp3 and other audio files. Creating a new audio file is as simple as creating a new 'audio' node type. The ID3 tags are extracted from the audio file and displayed in the node listing. The title can optionally be automatically set using the ID3 tag information, by default it is artist - song title. The node body itself contains all of the ID3 information for the audio file, with links for each of the fields. This allows a user, for instance, to find all audio files by artist, title, album, genre, and year, by simply clicking the link. Additionally, the length and format of the file are extracted and displayed too. And the best feature, it includes the XSPF Flash player so you can play the audio file right on the website, without having to download! If a user does want the audio file, there is a download link available as well. Additionally, if the ID3 tags are incomplete upon uploading, anyone with node edit permissions can edit the audio node and update the ID3 tags automatically! This module also keeps track of how many times the audio file has been downloaded and how many times it has been played through the website.
Because this audio file is created as a node, all of the wonderful node properties can be used. The most useful would be setting up a category (or a taxonomy) to label the content in this audio file, which can be setup to use 1 or more terms to "tag" the audio file. Each audio file can also be setup so users can post comments on the same page as the audio file as well.
Also, this module adds a link to each user's profile that links to all of their recent audio files, making it very handy to find all audio files uploaded by a certain person.
This review was adapted from a review written on Lullabot.com
If you want to make changes to the flash player you can over-ride the theme function. To understand "theme level" and overriding functions in drupal go here. To change the player type you need to make a template file in your theme directory. I use PHPTemplate so the file is called template.php.
The following (assuming you're using PHPTemplate) makes the flash player red:
<?php
// override the colors on the flash player
function phptemplate_audio_mp3_player($node, $options = array()) {
$options['b_fgcolor'] = 'cccccc';
return theme_audio_mp3_player($node, $options);
}
?>
In the template.php file I put this code which overrides the theme_audio_mp3_player function to use the 'Slim' player:
<?php
function phptemplate_audio_mp3_player($node, $options = array()) {
global $base_url;
// flash only supports a limited range of sample rates.
switch ($node->audio_fileinfo['sample_rate']) {
case '44100': case '22050': case '11025':
break;
default:
return;
}
$options = array_merge((array) $options, array(
'song_url' => $node->url_play,
'song_title' => $node->audio_tags['title'],
));
$params = array();
foreach ($options as $key => $val) {
$params[] = rawurlencode($key) .'='. rawurlencode($val);
}
$url = $base_url .'/'. drupal_get_path('module', 'audio') .'/players/xspf_player_slim.swf';
if ($params) {
$url .= '?'. implode('&', $params);
}
$output = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="15" id="xspf_player" align="middle">';
$output .= '<param name="allowScriptAccess" value="sameDomain" />';
$output .= '<param name="movie" value="'. $url .'" />';
$output .= '<param name="quality" value="high" />';
$output .= '<param name="bgcolor" value="#e6e6e6" />';
$output .= '<embed src="'. $url .'" quality="high" bgcolor="#e6e6e6" width="400" height="15" name="xspf_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
$output .= '</object>';
return $output;
}
?>
Next you'll need to download the 'Slim' player from the website here. Transfer these files to the /modules/audio/players/ directory on your server and ensure that the shockwave file is named exactly as at the end of the $url line.
Now refresh your page (force reload by adding a '?' to the end of your url) and now everytime that Drupal tries to use theme_audio_mp3_player, which uses the standard 'button' player it will be overridden with the above code and instead use the 'Slim' player.
If you would instead like to use the 'Full' player then substitute the code after $output with the required code from the XSPF Player website.
When a user edits their accounts details they can choose to upload an image or photo of themselves, also known as an avatar. The Avatar Selection module allows the user to pick an avatar image from a list already loaded by an administrative user. It is also possible to disable the uploading of pictures by users and only allow them to select an avatar icon from this list.
No images are supplied with this module. It is recommended that all images you use are roughly of the same size.
Once the module is activated, go to Administer >> Site configuration >> Avatar Selection (admin/settings/avatar_selection). Here you'll find a form that will allow you to upload or delete images. Users with the 'administer avatar selection' access permission will be able to upload and delete the images.
Stella Power (http://drupal.org/user/66894)
Download the latest version of the Avatar Selection module from the project page. Untar/unzip the files and place the entire avatar_selection directory in an appropriate module directory like sites/all/modules.
The Avatar Selection module can be configured at Administer >> Site Configuration >> Avatar Selection. Users will need the 'administer avatar selection' permission to alter the settings and to upload or delete images.
To delete an image from the selection, go to admin/settings/avatar_selection/delete and check the box for each image you wish to remove. Then just click on the "Delete" button to finish. There is no delete confirmation message, so please ensure you have the correct boxes checked before clicking on this button.
There are just two permissions you can assign a user with the Avatar Selection module.
The backup module performs a backup of your entire Drupal website. An archive file, or tarball, of your Drupal database and all your files is created on the webserver. You can then download this file with your web browser.
You can:
The backup module doesn't have the capability to restore from a backup, as this would involve Drupal having its own files and database pulled from under it as it runs.
To restore a backup archive from a unix / linux command line:
The banner module provides a way to manage banners on your site. You can upload images, allow users to upload their own banners, choose to approve banners that are uploaded, choose what URL to link banners to, and track statistics around the display and click-through rates of banners.
Banners are meant to be added either in a custom block or directly to your theme. See the Adding banners to your site section that follows for instructions on how to accomplish this.
Note: this is a work in progress. Please feel free to edit and extend this page.
You can:
Starting with version 4.7 of the module, Banners have their very own node type. To add a graphic banner, you need to have the Upload module enabled (graphics are attached to the banner nodes). Also, you will need to add them to a taxonomy term. Click administer » categories and either create a new vocabulary with the "banner" node type or add the "banner" node type to an existing vocabulary. Once you're done, click create content » banner to create a banner.
As listed on the Banner module info page, the banners module provides an interface to manage banners. To actually display the banners on your site, you need to add a small snippet of PHP code in either a block or directly to your theme template.
If you are not comfortable with editing your theme, adding a custom PHP block is the easiest method, but you will only be able to display banners in the sidebar. To add, for example, a banner to your header, you will need to edit your theme.
The banner_display(42,1) function is what is needed to display banners.
The number in parentheses refers to the taxonomy term ID from which you would like to show banners. Banners belong to taxonomy terms, so you will need to know the term ID for which they belong. You can usually find this out by going to administer » categories, then click the "list terms" link in your banner vocabulary to find the IDs for the category you use.
Displaying banners in a custom block
<?php return banner_display(42, 1); ?>See the Blocks section for more information on working with the placement and setup of blocks.
Displaying banners directly as part of your PHPTemplate-based theme
<?php print banner_display(42,1); ?>As noted above, the number indicates from which taxonomy term ID to display banners. You may add this code in multiple places in your theme, with either the same or different banner group numbers.
Important note: the code is slightly different than that for a block, in that it uses 'print' instead of 'return'.
See the PHPTemplate section of the theme developer's guide for more information on theming.
This was adapted from Bryght's banner configuration guide.
The Drupal bbcode.module adds a BBCode filter to Drupal. This allows you to use HTML-like tags as an alternative to HTML itself for adding markup to your posts. BBCode is easier to use than HTML and helps to prevent malicious users from disrupting your site's formatting.
See the help screen of the module (or the code) for information on which tags and variants are supported. This implementation is not necessarily the same as the original BBCode implementation.
Note that this filter also recognizes and converts URLs and email addresses to links automatically
You can file issues, read about known bugs, and download the latest version on the BBCode project page.
The biblio module allows you to create and maintain bibliographic lists of publications. The full (HTML) text of the publication can be included is so desired. Other files such as PDF or Word documents can be attached using the upload module.
Bibliographic entries can be imported from EndNote (versions 7,8,9,10 in XML or tagged format) and BibTex. The bibliographic lists can be formated in a number of styles including: American Psychological Association (APA), Council of Science Editors (CSE) and Institute of Electrical and Electronics Engineers (IEEE).
Updating: Any time you install an new version of the module you should run the update.php script in case there are any database modifications included with the new version.
mysql -u {userid} -p {drupaldatabase} < biblio.mysql
You will also have to enable the module on the admin/modules page.
visit biblio/
(more to follow)
(content to follow)
(content to follow)
The BitTorrent module allows the distribution of large files via the BitTorrent network technology. By sharing the cost of downloading as well as uploading with a network of other users no one site has to carry the burden of every download. This is very important for a network of community sites that want to share media such as podcasts, video blogs, and participatory culture media. BitTorrent should not be used to distribute copyrighted material. It is an open system and law enforcement officials can easily track and prosecute users who attempt to pirate content. This module provides a BitTorrent tracker which coordinates the sharing of content via a map of the content pieces in a .torrent file.
There is a list of torrents that are being tracked. You can set the explanation of BitTorrent for users of your site in general settings. You can also make a list of torrent announce URLs that your tracker will use. This module is not currently being distributed. It was developed by Digital Bicycle and will be distributed by CivicSpace Labs in a manner to avoid its use as a piracy tool.
You can:
The Blog Information module gives each user, with access permission, the ability to have their own blog title and description. This is similar to sites like blogger.com blogs.
Once enabled, and the appropriate groups have permission, the user on their edit account page as a new section call Blog Information asking for a users blog title and description. This information is displayed via a block on www.example.com/?q=blog/[user] pages and on blog nodes.
In the 2.x version of the Blog Information module there are 2 new features.
On a blog created by the blog module the page title for the blog reads like "example's blog" where the name (example in this case) is the blog authors username. On these pages you may wish to wish to remove the page title and use the Blog Information block instead.
To do this, in phptemplate, you need to modify your page.tpl.php file. Change:
<?php
print $title;
?>
To:
<?php
if (arg(0) != 'blog' && $node->type != 'blog') { print $title; }
?>
This will not display the $title tag on pages that are /blog or have a node type of 'blog'. On all other pages it will be displayed.
Buddy list enables users to add buddies in their social network to their user account. Users can maintain a list of their buddies and keep track of what their buddies are posting to the site. They can also track their buddy's buddies and thereby explore a social network.
You can add buddies via user profiles. The administrator must enable viewing users profiles to be able to use the buddy list option. On the View tab of the user profile, there is a Buddy list section. One of the buddy list actions is Add Buddy. Select this action to add a user to your buddy list. Administrators can also enable the Buddylist block, or Recent Buddy Content. This block allows you to see a list of your buddies and content from your buddies respectively. An administrator can also enable the Friends Of A Friend (FOAF) module to allow for sharing of buddy lists between different social networking applications.
You can
Also see Date documentation.
See the Calendar Project Page to download and install this module. Please report problems on the Issue queue rather than as comments on this page, since that makes the handbook quite messy and hard to read. Plus, many of the problems reported here are already reported or fixed, which you can see in the issue queue. I'm going to start removing comments that are bug reports or support requests from this page and asking you to report them on the issue queue instead. Comments that help clarify the handbook or point out ways that it could be improved are perfectly OK.
Requires Views and the Date API. This module will display any Views date field in calendar formats. Works with CCK date fields, Event module dates, node created and updated dates, and any other Views date field. The module does not create dates, it only displays dates that have already been created elsewhere, like CCK date fields.
Multiple calendars can be created for different purposes, i.e. one that displays node created dates as an archive calendar and another to display CCK dates for a custom content type, just give each a unique url.
You can use the supplied default calendar view as a starting point, or create one or more calendar views from scratch:
The Calendar module now uses the Date API from the Date module. The Date API was pulled out of the Date module so you can use the API with no dependence on CCK. For anyone updating a previous version of the Calendar module may run into problems on the update since the Calendar module will be installed but the Date API will not. The easiest way to make the transition is to uninstall the Calendar module (and Date module if you are using it) before uploading the latest code to your site, then go to the modules page and enable both Date API and the Calendar module. If you don't uninstall the Calendar module first, you will see some errors when you upload the new code, but it will automatically uninstall the Calendar module until you go to the modules page and install the Calendar module and the Date API module.
Switch between year, month, week, and day views with back and next navigation.
A mini calendar is available using the block view if the block view is also set to the Calendar type.
Two other blocks are available. A legend block will display only on calendar pages and will show a legend of the color coding for field names and content types.
A Switch Calendar block will display only on calendar pages and allows the user to switch between calendar, list, table, teaser, and full node views for whichever time period is being viewed. The back/next navigation will remain at the top of the traditional views displays so you can move from one month to the next, for instance.
To use iCal import or export, enable the new Calendar iCal module.
To export the calendar as an iCal feed, add a fourth Calendar argument to your view, the Calendar: iCal Feed argument.
To import iCal feeds from other locations into your calendar, choose the 'iCal' tab you see when looking at your calendar and fill out information about the feeds you want to insert into the calendar.
There was lots of good discussion in the DrupalCon presentation on Date + Calendar. Based on Earl's suggestion to make sure the Calendar arguments will work with any view and requests from the audience for the ability to show a list in the full page and a calendar in the block, or other combinations of calendar and traditional views in the page and block, I've made reworked the argument handling to make the Calendar arguments work independently of the plugin theme.
In the lastest commit to the 5.x and HEAD versions, you can now add calendar arguments to any view with a date field (list, table, teasers, etc) and get date-based back/next navigation just like the calendar view has; you can have a mini calendar in the block view and a list in the page, or any other combination you like. Just be sure the date field you want to use as the filter is listed in the Fields list.
Calendar module results can be customized by changing the included css and/or themes. The key theme is located at the top of the calendar.theme file and looks like:
<?php
/**
* Themeable node display
*
* appends the field name to the title
* constructs a teaser out of any non-date fields in the view
*/
function theme_calendar_calendar_node($node, $type) {
// Display the regular teaser view for local events.
if (!$node->remote && $type == 'calendar_node_day') {
$node = node_load($node->nid);
$node->teaser = node_view($node, TRUE, FALSE);
$node->title = '';
}
// For other views, construct a teaser out of the provided fields.
else {
if ($node->label && !strstr($node->title, $node->label)) {
$node->title .= ' ('. $node->label .')';
}
if ($node->fields) {
foreach ($node->fields as $field) {
$node->teaser .= '<div>'. $field .'</div>';
}
}
if (!$node->url && !$node->remote) {
$node->url = "node/$node->nid";
}
}
// Remote nodes may come in with lengthy descriptions that won't fit
// in small boxes of year, month, and week calendars.
if ($type != 'calendar_node_day' && $node->remote) {
$node->teaser = '';
}
return theme($type, $node);
}
?>
This default theme will display the node title with the field label appended to it, the date, and any other fields that were added to the view. This 'teaser' will be sent to a theme from calendar_api.inc based on the $type chosen. The types are 'calendar_node_month', 'calendar_node_day', 'calendar_node_week', and 'calendar_node_year'. The theme can be overridden in the same way other themes are, by copying that function to template.php and changing 'theme' to the theme name, then making any appropriate changes.
For instance, if you want different results when looking at the 'day' view, you could add a switch to the above theme based on the type, then if it is a 'day' type, do a node_load() to pick up more node information and print it out, or node_view() to display the complete node.
Using the Event module is perfectly acceptable, quicker/simpler way to get a basic calendar running on your site. If you need something more flexible/extensible, here's how to create a Calendar view. If you've got other differentiating factors, list them in the comments, and I'll incorporate them here.
Using
Download and extract the modules in your /sites/all/modules directory.
Go to Administer › Site building > Modules and enable:
Go to Administer › Content management > Add Content Type
Edit the content type again and then select Add field
Create content > Performance
Go to Administer › Site building > Views and you should have a Calendar View
Click Add..
Click Save and you're back at the Administer › Site building > Views. You should see the default calendar view with an Overridden status. And at the top will be your new calendar view that uses your CCK node called Performance
Click on the link under URL and you should see your performance on the correct day. If everything looks OK, go back and edit the view again and in the Page > Menu section, check Provide Menu. By default, the menu link will appear in the Navigation menu, but you can move it wherever by going to Adminsiter > Site Building > Menus.
A CAPTCHA is a type of challenge-response test used in computing to determine whether the user is human. This is used in Drupal to prevent spam posts and bot activity.
The reCAPTCHA module uses the reCAPTCHA web service to improve the CAPTCHA system and protect email addresses. For more information on what reCAPTCHA is, please visit the official website.
The reCAPTCHA module also comes with an input format to protect email addresses. This, of course, is optional to use and is only there if you want it. For a demonstration of how it works, please see the official website. The following is how you use that input filter:
The category module allows you to structure your site into a tree-like hierarchy of pages, and to classify your dynamic content, all within one seamless interface. Gone are the days when these two tasks were carried out using separate and incompatible tools: now it's all one and the same. Built upon the solid foundations of the book and taxonomy modules, the category module overcomes the weaknesses of both these tools, to give you more power than ever before in customizing the navigational experience of your Drupal site.
Documentation, announcements, a live demo, and more can be found on the category module web site. If you're interested, also see why the category module documentation is not here on drupal.org.
You can:
The CiviCRM module stores information on the universe of people associated with a community and on their interactions such as emails, donations, petitions, events, etc. It can act as a stand alone contact management system or it can be integrated with mass mailer, volunteer management, petition, and event finding. CiviCRM enables organizations to maintain all these activities in a single database, creating efficiencies and new opportunities for communities to better communicate and benefit from relationships with their community members.
The CiviCRM module allows you to create contacts, or import them from other sources. You can record relationships between contacts, such as indicating they live in the same household. There are two types of groups of contacts. You can create static groups which have a set list of contacts. You can also create dynamic (smart) groups based on characteristics that contacts have in common. For example, you could create a group of all contacts who live in California AND who have volunteered for your organization within the past year. The CiviCRM module also allows for tagging for less formal categorization of contacts or groups. You can easily extend CiviCRM to record community member information which is specific to your community or organization using custom fields. For example, you can create a set of fields to track volunteer skills and preferences. CiviCRM profile gives you a way to allow community members ('users') to update their own information, as well as share some of that information with others. Finally, you can configure custom activity types such as volunteering or attending events.
You can:
CiviContribute allows you to accept donations online via Paypal or Moneris. Additional payment processors can be supported by extending the modular code. Read the CiviContribute Guide for more information.
You can:
CiviNode is a module and API that exposes CiviCRM contacts, groups, and other CiviCRM object types to other Drupal modules. It's designed to make CiviCRM easier to use and integrate with all of the Drupal tools and techniques you already use to create websites.
Using CiviNode with CCK you can:
CiviNode does this via its own API to handle most of the lower level interaction with CiviCRM's native API. It implements hooks for CiviCRM into Drupal's form system and APIs, and implements widgets that developers can use in their own modules. If you are a module developer, this wrapper API for handling common programming tasks can save you time and effort when accessing CiviCRM content in your modules. CiviNode also adds hooks for theming CiviCRM content and generating links from Drupal pages back into CiviCRM contact view pages.
Work on this project is being done by Rob Thorne of Torenware Networks, and been sponsored by the generous support of The Collective Heritage Foundation/Bioneers, the Green Party of Canada, and Openflows Community Technology Lab.
To actually see CiviCRM data inside of Drupal, you need to add a CiviNode widget into one of your CCK data types. Here are some quick steps to get you started:
There are a lot more features to CiviNode, and the module is under active development. But hopefully, this will get you started.
To install CiviNode into Drupal and create and use CiviCRM content in your pages, you first need to set up CiviCRM and CCK, and you should look at the documentation for those modules elsewhere. If you want to take advantage of CiviNode's support of the Views module, you should install Views as well.
Once you've done that, there are a couple of things you will need to do in order to get started:
CiviNode is now configured, and we're ready to create CCK fields using your contacts.
The Drupal Classified Ads module provides a quick and easy way to host textual classified ads on your Drupal 4.7 or Drupal 5.x sites. If you run multiple sites, or don't want to be bothered with installing flexinode/CCK or other modules to piece together a classified ads system, this may be just the ticket.
This module creates a drop-in, plug-and-play textual classified ad node type (ed_classified) with no need to use CCK or flexinode. This module has been in use on several production sites for a while now. It provides the following features:
Overview and rationale at http://exodusdev.com/drupal/modules/ed_classified.module
Project page and official releases: http://drupal.org/project/ed_classified
Live demo site: http://gigs.exodusdev.com - sign in with your drupal user id and start creating ads (and if you are a drupal developer, you can tell the world about your services.)
Paid classified ads may be implemented by installing the lm_paypal module and limiting ed_classified node creation to paying users. Other schemes may work as well, but the ed_classified module does not handle paid ad creation for you - this is beyond the scope of the module at present, although lm_paypal integration is planned for a future release.
Photo ads may be implemented using image.module, upload_image, and other image modules. I use upload.module, image.module and upload_image combined on my sites, and that combination works pretty well. If you have upload.module, the ed_classified module will allow you to override the attachment form description text on classified nodes, supplying administrator-supplied text - this helps users understand what to do in order to create a photo ad.
You can use the location module to add location-based attributes to ads created using the Classified Ads module
You can see an example of the location module in use on http://gigs.exodusdev.com .
One advantage of this technique is that you can also enable google, yahoo, and other map support available in the location module.
Coder is the code review module. The name coder is a double entendre, "coder" being someone who writes code, and "code-r" short for "code review".
To be filled in...
A review is a set of rules designed to accomplish a task. There is a code standards review, a review for upgrading from 4.7.x->5.x, another review for upgrading from 5.x->6.x, there's the beginnings of a security review and a performance review. Each review has an array of rules. The reviews are shown on the UI pages and can be found in the includes directory.
A rule is a single specific pattern to find. Rules can use the following #type:
Thus, to find all _submit functions you could use
array(
'#type' => 'regex',
'#value' => '_submit\s*\(',
),
This example regex looks for _submit followed by optional spaces, and a required left parenthesis. If you wanted to be more specific, since the _submit handler has very specific arguments that are changing, you could look for:
'#value' => '_submit\s*\(\$form_id,',
Remember, coder is just a helpful tool. It's not going to catch every use-case (people who use different variable names), but a simple rule like this will find all 5.x submit handlers and warn you to upgrade it. If you wanted to be more generic, you could write a rule that looked for two arguments instead of 3, but the regex for that is a little harder.
You can also restrict your regex searches within a function. So, if you wanted to warn about the recent menu changes:
array(
'#type' => 'regex',
'#function' => '_menu$',
'#value' => '\$items\[\]\s*=|if\s*\(\$may_cache\)',
),
This rule looks for $items[] = or if ($maycache).
Quoted strings are replaced with '' in the php source (the default, but see below). Thus if you wanted to make sure that the above had a string array index (such as $items['something'] =, you could have written (BTW, this is a bogus example just to show quoted strings):
array(
'#type' => 'regex',
'#value' => '\$items\[\'\'\]\s*=',
),
Finding code patterns is only half the problem. You also need to write a warning. There are two warning options,
So, using the first example above, we should add a warning
'#value' => '_submit\s*\(\$form_id,',
'#warning' => t('hook_submit() parameters have changed'),
Notice that this warning uses t for text processing. Since this function takes processing time, and since the rules files are read a lot, there also exists a warning_callback that should be used in most cases. So, the above really should be:
'#value' => '_submit\s*\(\$form_id,',
'#warning_callback' => '_coder_6x_fapi_submit_warning',
...
functions _coder_6x_fapi_submit_warning() {
return t('!hook_submit() parameters have changed',
array(
'!hook_submit' => theme('drupalapi', 'hook_submit'),
)
);
}
Warning callbacks support either a text string or an array. If an array is returned, it should contain:
Usually, you're just looking for something in the php. But coder supports these #source options: