Helpful Drupal Modules

Its that time again; for nwe post with findings of the week of course. So, I was searching for some modules that could help me with my development and came across few. I believe, if used properly, these can be very helpful modules.

Of course, some of you might not agree so please feel free to share your ideas. I am always eager to learn more and will keep learning through out my career; at least that is what I am supposed to say to portrait me as a humble person.

Well, let’s dive into some of the modules that I think would’ve greatly helped me had I known about these before. So, I decided to post these here in case it helps someone else. 

Disclaimer: I just found out about these modules and wanted to share these before I forgot. So, I haven’t actually used these but thinkthat these will be helpful.

Features: I came across a a podcast which helped me understand how this can be very useful. That podcast not only went through steps on how to use this module but also mentioned other 2 modules that, after reading about those, I found useful (and are listed below). I’d also like to share that podcast as a thank for taking time and help us Drupal developers; http://mustardseedmedia.com/podcast/episode43

Context: Now this is something that I have used a lot; programatically. It would’ve saved a lot of time had I known about this before. But, as they say, better late than never.

Demo: Ever thought that you’d like to revert your site database back to previous state after doing a bit of testing? I have; so imagine my surprise that there is a module for that and I don’t have to do this manually.

Security Review: How often have you thought to see if you can check whether your site is secure or not? I ofte have. So, this module can walk through several known scenarios and generate a report whether there are any security issues with your current installation or not. A nice find that I got from http://drupal.org/node/244924.

Email Registration: Recently, I had to use e-mail address as username. I was thinking of ways I had to get this done; change registration and login form, implement hooks to use e-mail as username and more. But, I found this Email Registration form that does that for you. Following article helped me compare it with Logintoboggan module and made it easier to understand the differences; Using Email as Username. This is the only module that I have already used and it works well.

Well, those are new modules that I learned last week. Hope it can help someone. If not then I’ll continue to look for ideas that can help others because that’s what PHP and Drupal are; Open Source and share with & help others.

Drupal 7: Tweet from Drupal

I wanted to be able to post my from Drupal to Twitter without having to tweet it twice. I found this very nice Twitter module within Drupal to be able to do that. Some instructions are quite simple but it still took me around 2 hours to figure out which setting to use to tweet from Derupal.

Most of these instructions came from Sign in to drupal with your Twitter account page. But there is s very subtle detail that is needed to be able to post to Twitter and most of my time was spent on that; and I fround that option accidentally.

You will need to install OAuth and Twitter modules. I will not go into details as that is very staright forward. You will need to enable OAuthm, Twitter, Twitter Actions and Twitter Post modules; all Twitter modules are included in one Twitter module.

Before moving ahead with any settings, you will need to create an application in Twitter Developer enviroment; you will need consumer key and consumer secret from there. You will need to save these in admin/config/services/twitter. Following 2 steps need to be following before moving ahead:

  1. Give Read and Writeaccess in Application Typein Settings tab
  2. Create Access Tokenin Overview Tab
    1. This step needs to be performed after providing Read and Write access so your application will have write access to post
    2. This will allow this application access to your own account

After you are done creating that app, you will need to provide your site and user access to that application so it can post to your account. For that, you will need to go to users/USERNAME. Edit your account and then go to Twitter Accounts tab. Once there, click on Add Account. This will take you to a Twitter page which will ask you to confirm access to your site to post tweets in the Twitter user account; you will need to be logged in as that user or it will ask you to login as a user before proceeding. Click on Authorize App and it will take you back to your site where the request originated from ; Twitter account will be automatically added to your Twiter account list.

Last change you will need it make is to enable which content type will have Post to Twitter checkbox enabled. For that, you can go to admin/config/services/twitter/post. Check from which content type you want to post to Twitter. Save changes.

Now you are ready to post to Drupal and Twitter at the same time. Once you add/edit content in that that content type, you will have the option of posting to Twitter. By default, its not enabled. So, you will need to enable it for each post. 

This is it. Tweets from Drupal are just one content entry away.

Drupal 7: Custom Module – Part 1

When I first started using Drupal, it was simple matter of installing and using it. Then came the task of learning how to theme. But there came a point where required functionality needed to be coded in Drupal rather than just being able to use the GUI interface. One requirement, that started my path towards learning on creating Drupal modules, was custom front-end page and serving ajax pages. I found creating those pages with a custom module easier than some other ideas. But before being able to create a custom page (which wil be discussed in later tutorial) I needed to create a custom module where I could code custom page module. This tutorial will go through steps on how to create a custom module.

A quick note, I will be going through just the basics steps on how to add module. But wherever apppicable, I will be providing links where you can get detailed information. So, think of this tutorial as well explained reference document with information on each resource and not just the reference.

[b]Requirements[/b]: Drupal 7

To start with, we will assume that the name of this module will bemymodule. So, create a folder called mymodule in sites/all/modules folder. We need at least 2 files for a module to work. You can add as many other files as you need to extend your module but these are only 2 required files for a module to work.

First file is to module information like name, description, version etc. This will be used by Drupal to determine what name, version etc. to show while viewing module list. We will now create [i]mymodule.info[/i] file in mymodule folder. This file will contain following information:

[code]
name = My Custom Module
description = “Custom module to add custom functionality”
version = 7.x-1.x-dev
core = 7.x
project = rattanpal
[/code]

Most of this file is self-explanatory. Every module has a name, description, version and core. More information on these options can be found at http://drupal.org/node/542202. Next and last required file for adding a custom module is [i]mymodule.module[/i] file. This file controls options for module access, custom menu entries, module settings etc. Following is the code that we will put in our myodule.module file; which will be explained shortly.

[code type=”php”]
‘. t(“Displays Help for MyModule”) .’

‘;
break;
}
}
?>
[/code]

[i]mymodule_help[/i] is Hook to implement Help for your module. You will eventually want to enter more information for users to help them how to use your module. This is explained in detail at http://drupal.org/node/1095546

If you were osave these changed and go to admin/modules at this moment, you will see your module listed in list of modules. At this point, you should be able to enable/install your custom module.

We will continue with this in another tutorial where we will use this module to add a custom page. We can use that page to deliever any type of content (for example, ajax to server json content or a custom front page). We will also discuss how to use permissions to secure that page, if needed.

EDIT: Part 2 of this tutorial is at Drupal 7: Custom Module – Part 2.

Online Courses

Coursera.com is a great website which provides many courses online for free. These are full fledged courses, generally, provided by professors or professionals in those fields.

The learning tool itself is very clean. It follows a class like structure where you have videos with a theory lesson from instructor followed by a quiz somewhere in that video and an assignment for that week’s lessons.

Learning Photoshop

So, finally found a tutorial which is easy to follow for learning Photoshop. I have been trying for some time to larn it but kept getting confusing after a while. This new site has around 32 You Tube tutorials of up to 4 hours of learning. It claims to get you completely up to speed at the end. I have been through 2 tutorials and so far so good. Lets see how it goes after. Hope it doesn’t get boring.

For anyone interested, tutorials are at Photoshop Crash Course.

GO Transit Signal Breakdown

GO Transit, Toronto has a cmplete signal system breakdown today. They are not sure what happened as is the first time such a thing happened.   They are not sure how t fx it  

But for now, they are using older signal system that they used before computerized system was in place. At least they are moving now. Sitting in train for a long time and not moving is not fun; especially when you are not tired enough to sleep.

Welcome to www.rattanpal.com

I have redesigned www.rattanpal.com as my way of returning back to community by sharing the knowledge that I acquired from my endless nights searching the net. I will do my best to share all the issues that I came across and solutions to those as well as solutions to any future issues.

Aside from tech related solutions, I will also be using my site to share my experiences for any tech or non-tech related issues along with resources that I came across and found valuable; along with my thanks to their writers for taking to share their knowledge with us.

Please use the contact form to contact me for any questions/concenrs or even to just send encouraging words.

 

Jaswinder Rattanpal

www.rattanpal.com