Moderate posts using Actions and Workflow

There are many options for moderating posts in Drupal. A tried and true method is with the use of the modr8 module.

I used Drupal's core trigger module, the contributed workflow module and a custom action to accomplish a similar functionality.

I enabled the workflow module, and created the "course queue" workflow, with states "accepted", "pending" and "declined".

Sending mail with drupal mail

To send a mail out in your drupal module, use drupal_mail($module, $key, $to, $language, $params, $from, $send)

$module is the name of your module, $key is the identifier of your mail, to specify different mail templates.

e.g.

$params['!firstName'] = $node->field_firstname[0]['value'];
$params['!lastName'] = $node->field_lastname[0]['value'];
$params['!todaydate'] = date('m-d-Y');

Ecommerce with Beanstream

Ecommerce can be a complicated topic because it is expected to take into account the company's method of selling, marketing, inventory and processing cash.

The basics of communicating with an e-commerce gateway such as Beanstream, who also happens to reside in Victoria, Canada, is to provide a bunch of information that gets encoded to https://www.beanstream.com/scripts/process_transaction.asp via curl.


$merchant_id = '000000000'; // Replace with your merchant id
$sBeanstream = "requestType=BACKEND";

Credit Card validation

If you need a simple ready-made solution for credit card validation, there is Analysis and Solution Company's Credit card validation script.

Included with be the main logic ccvs.inc.php, and a language folder containing translations of text.

Here is a sample of code calling the validation function:

// Credit card validation
include("ccvs.inc.php");
$ccn = new CreditCardValidationSolution;
if (!$ccn->validateCreditCard($credit_card_number, 'en')) {

REPRODUCE

Due Date: 
Thursday, April 29, 2010

CVSing back your drupal site.

The benefits of using source control are great. It is like working with another developer, to review your code changes, even if you are all by yourself, not to mention being able to rollback any changes that you have made.

When using drupal, I like to grab core, modules and themes using cvs rather than downloading files. I find it easier to keep core and modules up-to-date while maintaining the patches I might have applied to a module.

Getting started with Drupal recipe on MacOSX

Install AMP server for MacOSX

  1. Download MAMP
  2. move it to Applications
  3. make a mysql configuration change
  4. [mysqld]
    max_allowed_packet=64M
    
  5. check php.ini that memory_limit is 32M or more

Download Drupal with drush

  1. download and extract drush from http://drupal.org/project/drush

  2. wget http://ftp.drupal.org/files/projects/drush-All-Versions-2.1.tar.gz
    tar zxvf drush-All-Versions-2.1.tar.gz

Rules can make your life simpler

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.

Cycling74 migration

Migrate cycling74.com fud forum to bbpress

Nifty flowchart generator with graphviz

While working on my talk to give an introduction to wikis at Free Geek, I played around with the Graphviz extension, and had quite a bit of fun.

With a few lines I was able to create this lovely flowchart on family interaction.


digraph family {
nodesep=1.0 // increases the separation between nodes
node [color=Red,fontname=Courier]
edge [color=Blue, style=dashed] //setup options
P [label="Parents"]
D [label="Daughter"]
S [label="Son"]