codekarate

Subscribe to codekarate feed
Updated: 50 min 37 sec ago

Customizing Drupal 6 Quicktab Styles

Mon, 05/14/2012 - 03:39

This is a guest post from Adam, my Co-founder at BEgINr Media

When finished: After you get through this tutorial you will have made a custom Quicktabs style in Drupal 6.

This is how to do it.

Stuff I am assuming:
...you have downloaded the Quicktabs module from Drupal.org and Install it.
...you have a photo editor (Gimp, Photoshop, etc)

Post Topics:  CSS Drupal Drupal 6 Theme Development Drupal Planet

read more

Drupal 6 Ubercart Theme Add to Cart Form

Fri, 05/11/2012 - 18:37

So you need to theme the Add to cart form that is output by Ubercart? If so, read on for more information. If you are looking to change the general theme or style of the Ubercart product node page, then you might want to look at my post on theming Ubercart Product Page for Drupal 6.

Post Topics:  Drupal Drupal 6 Ubercart Drupal Planet

read more

Drupal 6 Override views pager theme function

Wed, 05/09/2012 - 16:12

It is possible to override a specific pager for a specific views using a theme function in your template.php file. Here are the steps needed:

Theme Views Pager Step 1

No matter how you want your pager to look, make sure to select mini pager within views. This will allow you to take advantage of the views pager theme hook patterns. I was unable to get this to easily work when using the full pager.

Depending on how you want your pager to look, you can start with either the code that produces the views mini pager or views full pager using the options below.

Post Topics:  Drupal Drupal 6 Views Drupal Planet

read more

Disable Personal Contact Form in Drupal 7 Contact module

Fri, 05/04/2012 - 03:47

In the comments of a past post discussing best Drupal modules, it was recommended not to use Webform for contact forms. So for a project I am currently working on I decided to just use the Drupal 7 contact module that comes with core Drupal.

I have used this is the past and it works just fine. My requirements were simple, "provide a site-wide contact form that authenticated users can use to contact the site admins". On the surface it seems simple enough.

Post Topics:  Drupal Drupal Planet General Discussion

read more

The best way to learn Drupal

Mon, 04/30/2012 - 10:10

I often get asked what is the best way to go about learning Drupal or the best way to get started with website development. Because of these questions, I decided to put together a list of things I wish I would have done first, when I started to teach myself Drupal.

Learning Drupal Tip #1 - Getting Started Post Topics:  Drupal Module Development Theme Development Drupal Planet General Discussion

read more

Top Ten Best Drupal 7 Contrib Modules

Tue, 04/24/2012 - 22:34

Over the years I have used hundreds of Drupal contributed modules and have written a lot of my own. However, I thought it appropriate to compile a list of my 10 best Drupal 7 contrib modules that I don't think I could live without.

Criteria for my best drupal 7 modules list Post Topics:  Drupal 7 Drupal Planet General Discussion

read more

Drupal 7 Views Exposed Filters in Blocks (and panels)

Sun, 04/22/2012 - 19:42

Ran into a views and panels issue today that was very simple to fix, but difficult to track down. Here is my situation in case you run into a similar views/panels issue.

I have one Drupal 7 panel page that does a lot of visibility rule filtering based on the path of the panel. Depending on the path, I have different pieces of content that show up. In some situations, this may be a view (othertimes it is static content, custom coded blocks, etc).

Post Topics:  Drupal Drupal 7 Panels Views Drupal Planet

read more

Drupal 6 Fixing Stuck Cron Run

Thu, 04/19/2012 - 14:54

If you have ever seen this in your Drupal 6 log, I feel your pain:

Attempting to re-run cron while it is already running.

So what is going on here? Basically, a cron run started and for whatever reason did not finished... and frankly, probably never will. So the first question:

How to I get the Drupal 6 Cron Unstuck?

This is fairly easy to do. There are three easy ways (choose the one that works for you):

Post Topics:  Drupal Drupal 6

read more

Drupal Force HTTPS (ssl)

Fri, 04/13/2012 - 11:24

There may come a time where you need to force a user to see your site under HTTPS. If you only have one site on the server, you can easily add something like this to your apache config file:


Redirect permanent / https://www.domainname.com/

Post Topics:  Drupal System Administration Servers

read more

Theme an image field in Drupal 7

Fri, 04/06/2012 - 10:46

If you have a node with an image field in Drupal 7 and need to manually print the image, here is a quick code snippet for theming the image:

$my_image = array( 'style_name' => 'my_style', //the image style created 'path' => $node->field_my_image['und'][0]['uri'], );   print theme('image_style', $my_image);

As you will notice, the image field is called "my_image" and is accessible from $node->field_my_image['und'][0]

You will need to make sure you set up "my_style" inside the Image Styles section in the D7 Admin interface.

Post Topics:  Drupal Drupal 7

Drupal 7 Deleting Organic Group content

Tue, 04/03/2012 - 21:52

Ran into a situation today where I had to delete content from a group programmatically. Basically I have a setup where a group can only have one of a specific type of content posted to their group at any one time. I have it set up so a user can control which one is posted into the group but it needs to restrict them to only allow one.

Post Topics:  Drupal Drupal 7

read more

Drupal 7 Add Node to Organic Group (OG) programmatically

Tue, 04/03/2012 - 11:56

Needed an easy way to add content into an organic group using Drupal 7. I ended up using the og_group function provided by Organic Groups (in the og.module file). Here is the quick solution that worked for me.

//Get the group id $gid = 25;   //Get the full node that needs to be subscribed to the group $node = node_load(17);   //Set the values $values = array( 'entity_type' => 'node', 'entity' => $node, 'state' => OG_STATE_ACTIVE, );   //Add this node to the group $result = og_group('node', $gid, $values);

Post Topics:  Drupal 7

Recurly subscription integration in Django

Sat, 03/31/2012 - 15:22

In my last post I discussed setting up a Payment Form in Django for entering credit card information. Here is how I tied it in on the back-end to integrate with Recurly for the recurring payments on http://getpropeller.com.

I added the following to a file called subscriptions.py and added it to one of my Django Apps. It provides a light wrapper around the Recurly Python library.

class SubscriptionManager: """ A class that handles the subscriptions on Propeller """ def __init__(self, company):

Post Topics:  Django

read more

Django Credit Card Payment Form

Sat, 03/31/2012 - 01:35

Was not able to find a drop in example of a Payment form for Django that worked for me on http://getpropeller.com to hook into Recurly's API for recurring payments. I found a few Django snippets that got me close, but had to make some modifications to get things working.

Here is what I came up with for my forms.py file:

class CreditCardField(forms.IntegerField): def get_cc_type(self, number): """ Gets credit card type given number. Based on values from Wikipedia page "Credit card number". http://en.wikipedia.org/w/index.php?title=Credit_card_number

Post Topics:  Django

read more

Blogging for Drupal

Wed, 03/21/2012 - 09:38

This is a guest post from Mitchel Xavier. Mitchel Xavier is a Drupal Developer for a Drupal web design company in Sydney, Australia.

Post Topics:  Drupal 6 Drupal 7 General Discussion

read more

Drupal 7 getting all members of an Organic Group

Mon, 03/19/2012 - 12:21

Simple function that gets a list of all users subscribed to an organic group.

/** * Get all users of a group */ function _get_users_in_group($gid) { $query = db_select('users', 'u');   $query ->condition('u.uid', 0, '<>') ->condition('u.status', 1, '=') ->fields('u', array('uid', 'name')) ->join('og_membership', 'ogm', "ogm.gid = :gid AND u.uid = ogm.etid AND ogm.entity_type = 'user'", array(':gid' => $gid)); return $query->execute(); }

You can then loop through the results using something like:

 

Post Topics:  Drupal 7

read more

Django dynamically retrieve and serve PDF file

Thu, 03/08/2012 - 20:39

I am using Recurly for recurring payments on the Propeller website. This site is a Django web site running on Heroku. I needed to fully integrate recurring payments so I opted to use Recurly's API instead of any type of hosted or JS form version. This required a good deal of work (and it is still not finished) but is definitely worth the effort.

Post Topics:  Django

read more

Using Virtual Environments in Django

Thu, 03/08/2012 - 10:44

At first I was a little hesitant to virtual environments in Django. Not because I didn't think it was a good idea, but because it seemed like a lot of extra work. After finally spending some time learning more about it, I can tell you that overall it is pretty easy and I would highly recommend it for all Django development.

Using Virtual environments not only makes rebuilding your environments easier, it also makes deploying to a service such as Heroku or Google App Engine possible. Here is the general workflow I use when dealing with virtual environments.

Create environment Post Topics:  Django

read more