Codekarate Content

By shane
Sat, 2011-05-21 00:31

After all the recent news dealing with Amazon or the Playstation network it may be hard for people to remain confident in the promise that the "cloud" has to offer. Day dreaming of people running around shouting "the sky is falling" seems to pop into my head. However, despite the fact that my confidence in the entire cloud movement is unwavering, I think the recent happenings bring out a lot of good points that people should know about. I have listed three that I believe in below:

Point 1: The cloud is not as secure as you think

By shane
Thu, 2011-05-12 12:58

If you need to alter a CCK form or perhaps a form being constructed by another module, sometimes using hook_form_alter() isn't enough. Sometimes the form has not yet been fully constructed and you need to modify a part of the form that is not yet available for you to touch.

This is where the After Build function comes in handy. It allows you to modify the form after the form is built and all the form_alter's have been run. Here is a simple code snippet on how to begin using the Drupal form after build function.

By shane
Wed, 2011-05-11 13:54

I recently ran into a problem on a site using the Organic Groups module in which I had to automatically create a group node when a user purchased a product with Ubercart. Below is the function I created to automatically create that Group node.

By shane
Thu, 2011-05-05 13:44

One of the things I am very interested in as of late, is coding efficiency. What do you do to increase your coding efficiency? Do you use specific tools or tricks?

I am going to go ahead and give away some of my secrets in hopes of helping others (and maybe to pick up some additional tricks).

My Development Environment

By shane
Tue, 2011-05-03 14:06

I recently was tasked with creating a Drupal 6 Ubercart Payment Gateway module. I started the task off looking over various contributed payment gateway modules for Ubercart as well as looking at the authorize.net payment gateway module that comes with the Ubercart module. What I found was that there are many techniques that developers use when building a payment gateway module. I am going to outline the ones that worked best for me.

By shane
Thu, 2011-04-07 23:08

I wanted to post an example of using hook_user to load some data to the user object. This simple example will just load an arbitrary value to the user object anytime a user object is loaded. You would typically load additional items by querying the database to get the information but for example purposes I just give it a simple value.

/**
 * Implements hook_user().
 */
function MYMODULE_user($op, &$edit, &$account, $category = NULL) {
  if ($op == 'load') {
    //typically you would use db_query or something similar here
    $account->mymodule_value = 'My value';
  }
}
By shane
Tue, 2011-04-05 11:12

So I finally got around to looking into module development with Drupal 7. In fact, I really started to get my hands on Drupal 7 for the first time. I was very pleasantly surprised with the admin overlay and the entire usability of Drupal 7.

While building a module with Features, Views, and Fields (most of CCK was rolled up into Drupal 7 core with some changes and is now called Fields), I quickly ran into a problem. I wanted to do a simple query of node data. In Drupal 6 I would have accomplished this with a simple select statement. Something like:

 
By shane
Sun, 2011-04-03 00:24

I planned on just giving a high level overview of how I typically go about setting up a subscription based Drupal 6 website. I planned on just creating a primer for someone to look over, but I decided to give myself a challenge and see if I can create the entire site in 15 minutes.

Another thing to note is that I will start from nothing and build a simple subscription site in Drupal in 15 minutes with just the default Garland theme. I will also be writing this blog post at the same time with all the commands or actions I perform on the site. I am not sure if I will get it finished in 15 minutes, but I guess we will see.

By shane
Thu, 2011-03-24 15:22

When I first began working with forms in Drupal 6 I dove right in without reading all the documentation available on Drupal.org. However, I soon realized using drupal_goto() inside my form's submit handler was not the correct way to do things. This is just a little bit of information on how to set form redirects correctly from in the main form function, the submit function, and even a form alter function.

From the main form function:

If you are a Drupal developer and are not using the Drupal features module to help with your workflow, you are missing out on a huge opportunity. What kind of opportunity you may ask? How about an opportunity to make your life easier, allow you to develop Drupal websites faster, and provide you with simple ways to version control your exportables (views, cck, panels, variable settings, etc). I am going to give a brief recipe of how I use features in my workflow in hopes that maybe you will get some new ideas (and perhaps send ideas my way as I am always looking to improve the development process).

If you want a complete walk through and introduction to the Features module as well as more information on crafting a Drupal development process. You can check out my 5 Secrets to Becoming a Drupal 7 Ninja Ebook.

If you are interested in a video on the Drupal 7 features module, check out my Drupal 7 Features module introduction.

Pages