Feb 15 2015
Feb 15

Two new drupal distributions available on githubfrong

** https://github.com/alibama/cvillecouncilus is the distribution behind https://www.cvillecouncil.us - it’s an attempt to run a political campaign through a virtual proxy…

** https://github.com/alibama/rapid-prototyping-ecommerce-drupal – this is the code behind http://rpl.mae.virginia.edu/ it’s an e-commerce solution for 3d printing… A lot of this is implemented in rules and other well-standardized code thanks to Joe Pontani - a talented developer here in Virginia.  Joe integrated several third party tools, and set up the UVa payment gateway through Nelnet.

Both sites are getting updates over the next few months – the Charlottesville Council website also has a drupalgap implementation on it – absolutely awesome toolset…

18F API compliance is another feature I’m pretty stoked about… I got most of that done with the oauth2 server, views datasource, services and a couple of great notification features done with rules + views  i’ll get that feature out asap = it’s really convenient – matching a profile2 taxonomy field onto content taxonomy fields for notifications with new content.

any questions – please drop a line in the comments below

Aug 19 2013
Aug 19

The taxation rules that come with Drupal Commerce out of the box calculate VAT or sales tax for each line item without any conditions, so every item in the order is taxed. This works for many situations but if you have items which need to be tax exempt you're in trouble. But there is a relatively painless way around it using some rules and fields.

To start with create a new field on your product entity called Tax Exempt. Set it to be a Boolean, single on/off checkbox.

Create a field called Tax Exempt

Make sure the default value is not checked, we don't want things to be tax exempt by default. Also remember to hide this field in the Manage Display settings.

Now we have to set up the taxation rules to handle this. Make sure the Tax and Tax UI modules are turned on. Two tax types will be enabled by default: VAT and Sales tax. We're going to start by setting up a generic sales tax. Right now we're going to charge this sales tax for everything. Realistically in the United States, you need to only collect sales tax in the state you're doing business in. For more on this topic check out another post in our Drupal Commerce Tax Series, Conditional State Sales Tax.

Create a new tax, we'll call it Generic Sales Tax. Give it a rate of .07, this translates to 7%.

Create a new generic tax rate

We can click configure component and add our conditions. First we need to bring the Tax Exempt field into scope. In Rules you have to check for a field before you can query it. Our first rule will be to get to the Product entity.

Condition: Entity has field.

Data selector: commerce-line-item
Field: commerce_product

Rule condition: entity has field commerce-product

This gives us access to the product through rules. Our next rule will give us access to the Tax Exempt field.

Condition: Entity has field

Data selector: commerce-line-item:commerce-product
Field: field_tax_exempt (or whatever you called your field)

Rule condition: entity has field Tax Exempt

Now that we have access to our Tax Exempt field we can make sure tax exempt items are not taxed.

Condition: Data to compare

Data selector: commerce-line-item:commerce-product:field-tax-exempt
Operator: Equals
Data value: (checked)
What this does is create a NOT Data comparison. So as long as the product does not have the Tax Exempt field checked tax will be calculated.

Rule condition: field Tax Exempt is not checked

With these conditions taken into account when calculating sales tax from a line item creating tax exempt products is as easy as checking a box. Here are all of the tax exempt conditions together.

All conditions for exempting products from taxation

For information on how to handle sales tax by state see our article Handling Sales Tax Based on Order Address with Drupal Commerce.

Mar 15 2013
Mar 15

Rather remarkably we’ve managed to avoid the top xxx module list for Drupal 7… however to recap the presentation yesterday at ACCSVa.org here it goes….

A Drupal Roadmap with Rich Gregory – Look in to some critical dev tools like Drush and other things to get you going.

1.  Display Suite (putting Views at the top almost redundant….) – thanks to Display Suite and it’s buddy Field Group Drupal 7?s core content creation kit is a flexible dashboard delivery tool.  With a few clicks you can now turn a lengthy and unintuitive form into a dashboard – i’m seeing hope for a wordpress like content adding area.

and after

and after DS + FG

Forms before Display Suite and Field Group

Forms before Display Suite and Field Group

2. Views – it should go without saying, and now that it’s going to be a part of Drupal 8 core I’m going to leave it at that… you need views to do anything worth doing.  We’ve got a half dozen or more tutorials on views here, so dig in.

3. Context – this is your logic layout tool – pick conditions and reaction.  There are numerous modules to extend context as well – in the presentation I mentioned http://drupal.org/project/context_reaction_theme however this only has a D6 option.   You’ll probably need to use http://drupal.org/project/context_addassets to do essentially the same thing.  Also note that Mobile Tools allows you to use contexts to do dramatic theming changes based on the mobile device.

First up choose the conditions for your layout

First up choose the conditions for your layout

The choose your reactions

The choose your reactions

4.Rules: Rules allows your site to become a dynamic workflow management intranet style workhorse. The amount of flexibility here, much like Views, extends beyond the scope of a simple “short stack” review, however in essence you’re taking events that happen within the site, or custom crontab events, setting conditions and triggering actions. Coupled with modules like Views Rules the possibilities are amazing.

5. Entity reference - extending CCK (part of drupal 7 core) the up-and-coming successor to References. Allow content to reference other content, and as mentioned this allows View Relationships to create a SQL JOIN on your content – get more information about your Content Author, and many more options…this post here is particularly fun with references referencing references…

6. Honorable mention: Feeds – this is the bulk content migration tool of choice for folks like myself.  It’s intuitive and lets you harvest content from various sources and ingest it in to your content types, user tables, etc.. we have a few tutorials on feeds that may help you with some specifics – it’s a powerful tool, and coupled with tools like feeds tamper there are a lot of options.

7. Honorable mention: Flag.  Give your users buttons and they’ll push them.  Flags allow your users to have simple on/off buttons – categorize content, flag spam, etc…  they of course work with views, rules, and the rest of the gang :)

So there’s my short stack for Drupal 7 – I’m sure entities and entity forms probably belong on there, however for most basic sites I think this is a good start… heck probably need to talk wysiwyg editors too…. so many modules!  Thanks again to ACCSVA.org for the conference, Rich Gregory for the great tunes and the lift, and  Blue Cat Networks – the hat is bangin.

Jan 31 2013
Jan 31

No votes yet

Doug Hercules (dhercjr on drupal.org) is a graduate of the 2012 class of the DrupalEasy Career Starter Program and currently working as an intern with DrupalEasy.

This week I was tasked with learning how to automatically close comments on a node two weeks after the node is created. We initially looked into a couple modules that did this well, Comment closer and Comment commander, but since neither is quite ready for Drupal 7, we decided this would be a good opportunity for me to learn more about the Rules module. Maintained by Wolfgang Ziegler (fago) and Klaus Purer (klausi), this module allows you to define actions that are triggered automatically on various Drupal events as they occur. This blog post will walk you through how I accomplished this task.

Drupalize.me has a great video in their “Learning the Rules Framework Series” called Introducing Rules Scheduler (currently free!)that provided the basic framework for this task. This video was invaluable in getting me up to speed with basic rules functionality.

The first thing I needed to do was download and install Rules. I enabled the Rules, Rules UI and Rules Scheduler module, which required me to also download and enable the Entity tokens and Entity API modules.

Rules Scheduler works with Rules components only, and allows us to schedule an evaluation of rules components; not executing them instantly, but later at a predetermined time. So I began by creating a rules component, which is an individual set of Rules configuration that can be implemented by a Rule, as well as other modules on your site. To get started, on the main Rules Component page (admin/config/workflow/rules/components), I clicked to “+ Add new component”. I wanted my component to actually remove the comment ability to the node (an “action”), so in the “Component plugin” box I chose “Action set” and Clicked “Continue”. In the next screen, in the “Name” box, I typed “Close comments on a node”. The Variables section at the bottom of the page then looked like this,


I entered the following; DATA TYPE: Node, LABEL: Node, MACHINE NAME: node, USAGE: Parameter, and clicked “Continue”. I wanted this component to perform on a certain node, so I chose Parameter. A parameter is a variable that is given a specific value when the Rule is performed, it receives the specific node parameters as input and then sets the variables as an output to the component.

Next, I needed to create an action that would close comments. I did this by clicking “+ Add action”, and then in the “Select the action to add” box, I chose “set a data value”. Then in the DATA section “Data selector”’ box, I selected “node:comment” because that’s what I wanted my action to impact and clicked “Continue”. To enter a VALUE, I typed “1” in the Value box (This is just a integer; 0 meaning hidden, 1 meaning it’s closed and 2 it’s open), and clicked “Save” to save my new component. On its own, the component does nothing. It is only once I create a rule that utilizes the component will anything actually happen.

The next step is to create a react on eventrule to wait 2 weeks after my node is created, and then run the component. To do this I went to - admin/config/workflow/rules and Clicked “+ Add new rule”. In the “Name” box, I typed “actions when new articles are posted” and in the ‘React on event’ box I chose “After saving new content” and Clicked “Save”. There are many options that look similar so be sure to select this one.

I then realized I wanted this to occur not only to new stuff, but whenever I modify existing stuff as well, so I Clicked “+ Add event”, and in the “React on event” box I chose “After updating existing content” and Clicked “Add”. The key is, that in either case (new or existing content), I only want the component to be scheduled if the article is published. I’ll set this up in a later step.

In the Conditions section I Clicked “+ Add condition” and in the “Select the condition to add” box, I chose “content is of type”. Then in the CONTENT section “Data selector” box, I selected “node”. In the CONTENT TYPES section you can select all of the types that you want the comments to close after 2 weeks, in the “Value” box and I Clicked “Save”. For this exercise, I just selected “article”.

To ensure the article is published before the 2 week countdown starts, in the Conditions section, again I Clicked “+ Add condition” and in the “Select the condition to add” box, I chose “content is published”. Then in the CONTENT section “Data selector” box, I selected “node” and Clicked “Save”.

Now to schedule the component to run. In the Actions section, I Clicked “+ Add action” and in the “Select the action to add” box, I chose “schedule component evaluation”. In the COMPONENT section I chose “Close comments on a node” in the “Value” box and Clicked “Continue”. In the SCHEDULED EVALUATION DATE section, I typed “+2 weeks” in the “Value” box (For a good test to make sure you’ve done everything right, you can type “+2 minutes” to make sure it works).

The identifier is what differentiates one task from the other, so in the IDENTIFIER section, I typed “ close comments for node [node:nid] “ in the “Value” box so we only have one comment closing for each mode, and lastly, in the NODE section Data selector box, I chose “node” to send the node variable of the node being saved to the rules component and Clicked “Save”. Therefore, the Rule takes this node and passes it into the component as the node parameter, these nodes and parameters gets saved, and are then loaded when the component is executed. 

Now if you did the “+2 minutes” test, you can add an article to your site, and verify the comment capability on the new node. Wait for 2 minutes, refresh your screen and see that the comment capability is gone. Once confirmed, don’t forget to go back in and edit your rule to “+2 weeks” or you won’t be getting too many comments on your site!

I’ve gone ahead and exported both the rule component and the rule for you to check out. First to import the component, go to admin/config/workflow/rules/components and paste the following rule component export into your import page.

{ "rules_close_comments_on_a_node" : {
"LABEL" : "Close comments on a node",
"PLUGIN" : "action set",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "node" : { "label" : "Node", "type" : "node" } },
"ACTION SET" : [ { "data_set" : { "data" : [ "node:comment" ],
"value" : "1" } } ]

Similarly for the rule, from admin/config/workflow/rules, import the following:

{ "rules_actions_when_new_articles_are_posted1" : {
"LABEL" : "actions when new articles are posted",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "rules_scheduler" ],
"ON" : [ "node_insert" ],
"IF" : [
{ "node_is_of_type" : { "node" : [ "node" ],
"type" : { "value" : { "article" : "article" } } } },
{ "node_is_published" : { "node" : [ "node" ] } }
"DO" : [
{ "schedule" : {
"component" : "rules_close_comments_on_a_node",
"date" : "+2 weeks",
"identifier" : "close comments for node {node:nid}",
"param_node" : [ "node" ]

and there ya go, a new component and rule in under a minute! I hope that at least sparks your curiosity into Rules.

Trackback URL for this post:


Sep 13 2012
Sep 13

CCK Signup is a fun module that is very drupal in the sense that it really just extends a bunch of modules you may already have.  Here’s a brief tutorial on using Rules to handle some basic notifications.  Say you want to know when someone has dropped a class.


Your initial rule conditions

Your initial rule conditions

  1. get a new rule set up and set the initial condition to be “After deleting content”
  2. Set the next condition to be “content has type”
  3. Select the signup type of content
  4. Lastly choose to send an email to an arbitrary email address – in this case let’s say it’s you, the webmaster
  5. Send the email.  Thanks to the Tokens module you can reference content from the fields in the deleted content Using tokens in the emails

    Using tokens in the emails

    Send an email to an arbitrary email

    Send an email to an arbitrary email

    select the type of content

    select the type of content

    Content has type as condition

    Content has type as condition

May 17 2012
May 17

Sometimes Drupal opens up a big can of whoop-up process on ya, and Rules Scheduler is one of those gems.  Rule Scheduler allows you to use rule triggers to schedule rule sets.

Use Case:Ever want to send an email the day before a scheduled event?  We use CCK Sign-up and wanted to send an email to users one week before an event, as well as the day of.  We also needed to send teachers views of the roster of students

Here’s the 2 minute mojo on it http://www.youtube.com/watch?v=55HwOzFHoB8 and it just highlights the mistakes I was making.

The recipe came out of Drupal documentaiton, and these two tutorials got me 90% of the way:

working with scheduled rules

working with scheduled rules

And I thought I was home free, however I ran in to a pretty stupid problem that took me a minute to understand = all the identifiers need to have tokens in them with unique values or else they overwrite themselves in the database.

Solution? Easy = add some tokens – [node:nid] worked for me

The nicely scheduled rules

The nicely scheduled rules

Another fun feature in this project was revisiting one of my favorite modules: Rules Views Integration.  The cool thing about scheduling a rendered view in a rule set is that the rule gets rendered at the last minute and so you can schedule (in our case) a class roster to go out and it’ll have the most up to date information possible at the time of sending.

NB: I also ran in to a problem where cron wasn’t sending my emails initially.  I have no idea why it was stuck, however Ultimate Cron has been a good friend of late and unlocking and running the tab got it back on track = I haven’t seen it stall in a few weeks now.

Ultimate Cron unlock and run run run

Ultimate Cron unlock and run run run


Something else I haven’t gotten into yet, however, is the use of the Rules Scheduler Views.   Something tells me there is some magic to be had in there, used correctly.  At this point however I’m just using the off-the-shelf defaults.   I know of no Views Bulk Operations for scheduled rules, so perhaps the default info is all there is to know.  In any case, it’s an elegant solution to working with drupal’s cron functions.

Apr 06 2012
Apr 06
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Apr 06 2012
Apr 06

This screencast shows how to:

  • Invoke a Rules event
  • Send parameter data to a Rules event

This is shown by an event triggered every time a view is being rendered, sending the name of the view as a parameter.

Apr 06 2012
Apr 06

This screencast shows how to:

  • Declare a Rules event
  • Declare the data provided by the event
  • Use that data in a rule

The example used creates an event "View is being rendered", passing along information about which view is being used.

Apr 06 2012
Apr 06

This screencast shows how to create a condition plugin for Rules:

  • How to declare new conditions for Rules
  • How to provide the condition callbacks with parameters to act on
  • The big similarities and the few differences between actions and conditions

In the example, a condition is built to check which view type a provided view has.

Apr 06 2012
Apr 06
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Mar 30 2012
Mar 30
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Mar 30 2012
Mar 30

This screencast shows how to add parameters to your actions, for example to allow site builders to select which user object an action should work with.

Mar 30 2012
Mar 30
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Mar 30 2012
Mar 30

This intro chapter contains a quick presentation of the Rules module from a conceptual perspective. It includes:

  • Actions, conditions, events
  • Data types: the importance of entities, relationships and tokens
  • Lists and loops
  • Components and parameters
  • Some words about the Rules user interface

If you would like to see more about configuring Rules before continuing this series on writing code to integrate with the Rules module, you can watch the Learning the Rules Framework series.

Mar 13 2012
Mar 13

Note to all:  this module is majorly messed up – am leaving this warning here until http://drupal.org/node/1494820 is resolved – briefly the template files get deleted and the output becomes munged after ~1,000 pdfs are generated.   Also while some of my early tests were cranking ~100-200 pdfs per minute we’re seeing results now in the 3-5 per minute making this module unusable for large scale projects. here’s a patched version for D6views_pdf-patched

Views PDF allows you to output the results of a view onto a PDF. You can even upload an existing PDF to use a background template – pretty cool.   For the Audio Visually inclined here’s your 3 minutes of fun. http://www.youtube.com/watch?v=PszjYSq7xQQ

Use Case: Generate 40,000 PDF’s with a user’s name on them and some other predefined fields and make these files accessible to the user for download. 

Problem: creating the PDF’s on the fly is slow – so we need to have them all pre-generated

Solution: Used Cottser‘s writeup here http://drupal.org/node/1415380#comment-5701968 and modified it to be a rule set instead of a rule – with argument type node. Under that added one rule that ended up looking like this

Rule set for saving PDF's to server

Rule set for saving PDF's to server

As you can see the rule requires a pdf view – so hopefully you’ve already got one of them here are some shots of mine

PDF View

PDF View

and here are

views pdf argument settings

views pdf argument settings

the argument settings.  Now earlier we mentioned that the pdf needs to be accessible to users, so back over in our rule set we take an action – we load a referenced user (the user is referenced in the node itself through a user reference cck field) so our final rule set ends up looking like this

Final look of Rule Set

Final look of Rule Set

Ok – almost finished.  Now that we have a rule set we need to add this to a views bulk operation view so that we can “do the deed.”

I like Improved Admin because it gives you a nice starting point for working with Views Bulk Operations.. use whatever brings you the greatest joy.

PDF Save Rule Set in Views Bulk Operations

PDF Save Rule Set in Views Bulk Operations

Once your Rule Set is added to your VBO you may use it with any set of nodes you like.  On our VMWare machine we were churning ~200 pdfs per minute, not too shabby.

Mar 12 2012
Mar 12

A few weeks ago after looking at the taxonomy views integrator a reader posted about how helpful sub path alias is combined with url alter and of course pathauto.   Full Disclosure: tested path alias extended, it seems more robust, but must have missed something as it didn’t flow right off the shelf…

Use Case:  when a user logs in I want them to go to a URL based on their user ID and immediately begin editing the URL.  Pathauto will give you token replacements to do stuff like survey/[user:uid] however when you go to edit the node it typically reverts back to node/81948794387/edit making it difficult to reference.  You could use something like drupal_get_normal_path($path); to do this, but that's not going to make it pretty on the url line, and it's just kinda messy.

A rules based page redirect to an edit page - no node lookups needed

For those interested in a video it's here - no reason to get too excited though - it really does just work - tested against 40,000 nodes and they're all happy, you should be too... http://www.youtube.com/watch?v=t6Touamrvk0

Other niceties – your user/username/edit pages are now working, your mother sent you cookies and it’s Monday morning.  Get some.

Mar 07 2012
Mar 07
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Mar 07 2012
Mar 07
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Feb 24 2012
Feb 24

Create a rule set and add an argument to receive from your view

There are numerous ways to clean up old posts. Node Expire + Rules is one way, however it requires the user to specify an expiration date, another module, and in that sense is neither intuitive nor efficient. Using Rules and Views together via rules + views integration there’s a great way use the data that has already been entered.

For the video folks here’s your 2 minute rundown of what is up:

1) Create the rule set to handle the data. Add a content argument – you’ll be passing the node ID’s over to Rules for the actions to take place

2) Inside the rule set add a rule – no conditions are needed, just add the action to unpublish the nodes

Here's what your final rule should look like

3) The final rule should look similar to the image at right

4) Once you’ve got your rule set up it’s time to create the view that will send information over to the rule.  Assuming you have rules + views integration and Views Periodic Execution installed you’ll now be able to execute your views on a cron tab

5) In views you’ll need to set the periodic execution phase, the rule set, and of course set up your filters as per usual and MOST IMPORTANTLY include the NID (so that rules knows which nodes to act on)

Select your rule set and pass the node id for your argument

6) The Views Periodic Execution mod by Stephen Jones aka darthsteven

Set the periodic execution phase

7) and of course you need to choose the rule set unto which the little nids may argue and achieve action.  Once you pick your rule set the available arguments’ll appear – any fields you have elected to have appear in your view are available to activate the rule.

Create a rules executor view and send it to your rule set
Feb 02 2012
Feb 02

Rules are great for workflows. We have about 30 rules in place on our intranet to help almost every part of our daily workflow, and as with most offices communication between we mere mortals and our fearless leaders is critical. With the help of realname and realname user rereference we create a convenient user interface for data entry,

Realname User Reference Widget

After that we work with Rules and Tokens to create a more automated workflow.  For the Video types there’s a brief ~3 minute video.

The important thing to remember when working with user references in rules is that you must load the user reference BEFORE those that user and the associated tokens become available.  Give your user reference a handy name to create your unique tokens and you’re ok.  Once you have loaded the referenced user into your rule, the tokens are available to use – any information stored in the referenced user’s profile is there too. Also used in this tutorial though not mentioned explicitly is html mail for sending prettier emails through rules.

This is how our rule looked at the end

Debugging: If you find yourself in trouble remember that in the settings page you may turn on the rules debugger (which, depending on the number of rules may churn out a rather lengthy list… ). In the settings there’s also an option to turn off token warnings.  This may tell you whether or not you’ve done your job with the use of tokens.

Debugging Rules - tokens have options too

Dec 06 2011
Dec 06

This screencast shows how you can use Rules to alter the presentation of your Drupal site, such as:

  • Enabling, disabling and moving blocks around
  • Setting HTML title element and also on-page titles
  • Setting body classes
  • Setting the active menu item (using Menu Position)

Some bigger questions about using Rules for altering presentation is also discussed:

  • Using Rules for presentation altering is relatively heavy. (It consumes about 2.5 MB more PHP memory than Context, and has about the same loading times – judging from a first, rough comparison.)
  • Using Rules for presentation altering gives a more complex UI than the interface use for modules made for more particular use cases.
  • It is possible for modules to provide alternative user interfaces to Rules.
  • Rules allows reusing actions in many different situations, between different modules.
  • Rules (and Entity API) provides generalized data handling.
Dec 06 2011
Dec 06
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Dec 06 2011
Dec 06
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.

Dec 06 2011
Dec 06

This screencast shows the

  • That Rules Link adds links to entities (and that you set up each link separately).
  • That these links triggers rule sets.
  • That the links may be displayed as links on (for example) comments and nodes.
  • That Rules Link is useful when you previously used Flag, but didn't really need the 1/0 data that Flag provides (but rather just the Rules trigger effect).
  • That access to each configured link can be controlled using the standard permission system.

All of this is demonstrated by adding a "block spammer" link to comments, allowing administrators to block the comment author and delete all comments written by him/her.

Dec 06 2011
Dec 06

This screencast quickly shows the events, conditions and actions that Flag exposes to the Rules module. It covers:

  • Event: Flagging and unflagging entities
  • Condition: Flag is set on an entity (by a particular user)
  • Condition: An entity has at least a number of flaggings
  • Action: Load the list of users flagging an entity
  • Action: Set or remove a flag (for a particular user)
  • Action: Remove all flaggings (for a particular user) – or save a particular number of flaggings
Nov 08 2009
Nov 08

On this site, or Living Plenty or dedicated to my cat Abraham Mao, I want authenticated users to be taken to the group page, which shows all their unread group discussions. Anonymous users when browsing the sites would just go to the usual node page.

When searching drupal, I tried out Front page module, however, it did not work for me to do what I wanted.

Luckily while watching a drupal videocast, I did stumble upon the answer, which was to use the Rules module.

* Go to '/admin/rules' to administer rules

* Click on 'Triggered rules'

* Select "Add a new rule" tab or '/admin/rules/trigger/add'
* Choose "User has logged in" event
* Click "Save changes" button

* Click on "Add an action" button
* Select "Page redirect' under system, and click on the "Next button"
* Check "Force redirecting to the given path, even if a destination parameter is given"
* Click "Save" button


Your rating: None Average: 2.5 (13 votes)

Oct 21 2008
Oct 21

Many of you know some of the unspoken rules of Drupal. But, I have a feeling that I have to reiterate them once more for everyone:

1. Do not hack core No matter how easy it seems to change one little file in Drupal's core file system to make it do what you want it to do, do not change it. Drupal is made so that the upgrade path is easy. It has been well thought out and designed so that there really isn't any reason to change or modify core in any way, shape, or form. Changing the file system means that you make upgrading to future versions of Drupal very difficult, meaning that you'll miss out on many security updates, bug fixes and will run into a maintenance nightmare later on. If what you're trying to do cannot be accomplished by what's there already, create an issue about your problem in the Drupal issue queue and maybe write a patch for it. Your feature will then become a part of Drupal core and you'll once again have that clean upgrade path. Do yourself and your fellow developers a favour and don't hack core. 2. Do not hack core! This cannot be said enough. 3. Update to the latest Drupal New versions of Drupal come with vital security fixes and bug fixes and will help protect your site from attacks. This doesn't necessarily mean update to Drupal 7 if you're on Drupal 6, just to update to the latest point fix of Drupal 6.  Also remember that older versions of Drupal will eventually stop being maintained as less people use and contribute back to it, so keep your upgrade path on the radar. Developers also love the updated APIs that come with newer versions of Drupal as they are much nicer to work with and allow much more flexibility. 4. Use contributed modules Whatever you're trying to do with Drupal has probably already been attempted. Search around for a module that already exists that implements what you're looking for and use it. If it doesn't work how you'd like to it, stick a not in the project issue queue and fix what's wrong with it. The less custom code you produce means the less maintenance you'll have to do later on. 5. Uninstall before deleting modules If you want to remove a module from your website, be sure to uninstall it from the modules page before deleting the module's folder. Wim Mostry brought this up after realizing that a client's site had a bunch of obsolete data and settings left over from older modules. 6. One module to ruin them all If you're developing a custom module for a website, often times it seems like the best solution to stick all of your custom hooks and custom functions in one giant module. In reality, however, this custom module full of custom functions will eventually turn into one tangled mess of unmaintainable code. Do yourself a favour and group different sections of functionality if different modules. Creating distinctions in module functionality will allow you to easily turn off and on functionality instead of having to route through a horrible mess of code later on. 7. Develop with error reporting on When developing a module, open up your php.ini, and set "error_reporting" to E_ALL. This will let you know about any small PHP warnings and notices you run into during development. The outcome will be nice, strict, clean code. On production sites, however, make sure to return it back to what it was so that users don't get confused if any big ugly red warnings/errors appear. 8. Contribute If you make a changes to a contributed module for use on your own site, create an issue about it in the module's project queue outlining what you changed. Giving the module maintainer the chance to see how people are using their module will allow the module to adapt, evolve and grow.  Next time you use that module, you won't have to worry about making that change again because it will become part of the module's core functionality, as well as keeping the clean upgrade path. 9. Have Fun! You're part of an amazing community of people with a large amount of awesome talent. Get involved with your local Drupal group, and get to know the people who are doing the same things as you and have fun!

If you know any other unspoken rules of Drupal, please let them be known!

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web