Archive for February, 2010

Paypal remit problems for Indian firms and its broader implications

Sunday, February 14th, 2010

Paypal has recently stopped allowing Indian providers to receive funds from other paypal account holders and it is also voiding the withdrawal of funds by Indian establishments to their Bank A/c’s in India. This is a double whammy by Paypal as most small to medium web dev shops and freelancers in India depend on Paypal for receiving payments from their clients abroad.

Also, the way Paypal has handled this situation is a bit appalling. Rather than intimating the Indian account holders in advance and assuring them of a resolution, they are first reversing the received funds back to the users and *than* informing the sellers of this issue.

While I am sure Paypal is working hard to resolve this issue as they have the financial strength and their brand image to safeguard, this raises some valid questions on how reliable are these online service providers in India. If this can happen to Paypal, what stops Gmail, Facebook and other such online providers from blocking access to their services to Indians?

As these firms are operated from outside India and are not governed by Indian laws and regulations, their failure to comply with any present and future law and regulations in India, might force them to rescind their services to their users in India.

My advice for avoiding such a situation from adversely impacting your business would be to read the fine print for all such online services which your business depends on and have a Plan B in place in case these services are unavailable one fine morning, as in the case of Paypal.

Update: The head of Paypal APAC region has posted an update on this issue, whch can be viewed at www.thepaypalblog.com.
There has been quite a bit of criticism for the post on Paypal, which can be viewed on the EvenHorizon1984 Blog.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Create a custom block in Drupal 6 using modules

Thursday, February 4th, 2010

In this post we will discuss on creating a custom block through a module in Drupal 6.  One question can come into your mind that we can create block from the administrative menu/site building/blocks. So, what is the need to create block from module.

The benefit of creating block from module is that, the module can be placed in any theme or in any other sites and once the module is enable the block will created automatically with its contents as we have configured in the module.

Some easy steps to create block through module :

Step 1 :

Create a folder (give a folder name e.g., mymodule) in the modules directory of your Drupal site.  The name which you are giving as a folder name will become your module name. To create a module there must have two files inside the module folder named as:

( a) mymodule.info (b) mymodule.module

mymodule.info file contains the general information of the module you created and mymodule.module file contains the main coding which creates the block.

# We are considering the module name as customblock and hence filenames are customblock.info and customblock.module

Step 2 :

Copy the code given below and paste it inside the customblock.info file.

; $Id: customblock.info,v 1.4 2009/02/18 22:02:46 dries Exp $
name = Custom Block
description = Creating Custom Block to demonstrate the block creation through module.
package = Diadem
version = VERSION

; Information added by drupal.org packaging script on 2008-10-08
version = “5.11″
project = “drupal”
datestamp = “1223496909″

This is the general information about the module and description field reflect the purpose of creating the module . Give the correct version which you are using for your drupal site. You need to change this information as per your requirement.

Step 3 :

Always remember that all the function name should start with the module name, e.g.  modulename_node_info(), modulename_perm(), etc. Copy the code given below and paste it inside the customblock.module file. You will observe that there has no php end tag at the end of the file. It is recommended in drupal that we donot need to end the php tag in the module pages.

<?php
/**
* Implementation of hook_node_info().
*/
function customblock_node_info() {
return array(
‘customblock’ => array(
‘name’ => t(‘Custom Block’),
‘module’ => ‘customblock’,
‘description’ => t(‘How to create a custom Block.’),
)
);
}

/**
* Access Permission of this module by hook_perm();
*/
function customblock_perm() {
return array(‘access customblock content’);
}

/**
* Implementation of hook_block().
*/
function customblock_block($op=’list’, $delta=0) {
// listing of blocks, such as on the admin/block page
if ($op == “list”) {
$block[0]["info"] = t(‘Custom Block’);
return $block;
}
else if($op == ‘view’)
{
$block_content=”;
$block_content.=’<div style=”border:1px solid #D6D6D6; background-color:#F2F2F2; padding: 5px;”>’;

$block_content.=’<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Why do we use it? <br />
<a href=”http://drupal.org/” target=”_blank”>Click Here</a> – Drupal.Org
</div>’;
$block_content.=’</div>’;

$block['subject'] = ‘Custom Block’;
$block['content'] = $block_content;
return $block;
}
}

Explanation :

1)  customblock_node_info() : This is the implementation of the hook_node_info function defined in Drupal. This function contains the information about the module. E.g.: name which will show in the module listing page. Description – Some general information about the module and module – module name.

2) customblock_perm(): This is the implementation of hook_perm function defined in Drupal.

3) customblock_block() : This is the implementation of hook_block function defined in Drupal. This function is responsible to return the block content. You can see, we have defined a variable $block_content which contain the block with its contents and properties.

$block['subject'] variable contains name of the block created. Finally, we assigned the $block_content into the $block['content'] variable beacuse this varible is responsible to create the block.

step 4 :

Enable the customblock module from administrative menu/site building/modules.

mod

Custom Block Module

Once you enable the module a block named as Custom Block will be created . Configure the block from administrative menu/site building/blocks. Finally, place the block where you want to display in your drupal site.

Block
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...