Drupal Developer

DrupalD's picture

Drupal: Create Drupal7 node Programmatically

This CodeLet will read data from an external API, parse the JSON response & build a node of specific type. It imports taxonomies & images as well.
The fascinating thing about this CodeLet is, it can import data to multi - value node fields, including multi widget fields & different field types.

Set user password using RULES

This CodeLet allows to set the user password during Rule execution, the following process can be used.

a) create user entity ($newuser)
b) set a rules variable $password (use PHP code to generate a random string)
c) execute custom PHP which looks like

This way, you can also use the variable $password in say, an email to the user letting them know what their automatically generated password is.

DrupalD's picture

Drupal: Change User account title

This CodeLet will change the title of the User account page. It will consider and set user's 'username' as the titlte of the account page. Drupal offers this by default. But this can be used when some other modules have already modified the title.

DrupalD's picture

Drupal: Last Login details

This CodeLet will store user's login history and creates a block. Admin can place this block on user pages or on pages. Future ammendments to this code will allow to use the stored login details to be displayed using a theme function.
This CodeLet will be submitted to Drupal.org community soon.

Drupal Module hooks : Module file

We have discussed about the hooks to be used in .install file in Drupal module hooks: install file and in this discussion we will look at the hooks to be used in .module file. Remember, a Drupal module can have multiple .module files and each .module file has one accompanying .info file providing information about the module.

DrupalD's picture

Drupal: Set content in a region programmatically

This CodeLet will allow you to set some text in a region you specify from configuration page. The regions are from the current theme. The desired content will be displayed in the region when the page is rendered.

DrupalD's picture

Drupal : Login / register with Facebook connect button

This CodeLet will add a facbook connect button to your login / registration form. Using the CSS, you can change the appearnce of the login block/page. This CodeLet also uses Ajax login/register module. Please make sure you have all the require modules and libraries installed before you using this CodeLet.

Programmatically create vocabulary

In some situation, you module is required to create a taxonomy which the module use to perform other tasks/features it offers. This is when you can write a code to craete the require vocabulary in the module and make it availabel as soon as the module is installed. You can also add terms programatically to that vocabulary!

Using taxonomy_save_vocabulary for Drupal 5.x & 6.x and taxonomy_vocabulary_save for 7.x, you can create the vocabulary programmatically in your module.

Here is a Drupal 6.x example:

DrupalD's picture

Drupal: Redirct to node translation form

This CodeLet redirects the user to translate the node in the specified lanaguge. This will reduce the efforts to click on the translation tab and can enhance to transalte the nodes in all the enabled langauges, one-by-one.

DrupalD's picture

Drupal: Custom node with hooks

This CodeLet demonstration how to create a custom node in code and use different Drupal hooks to build different features.

The CodeLet implements following Drupal hooks:
- hook_node_info
- hook_menu
- hook_perm
- hook_nodeapi
- hook_form_FORM_ID_alter

This CodeLet also creates an xml document which will then be used by the gallery to display images as slideshow.

DrupalD's picture

Drupal: Reset admin password

This CodeLet will create hash for your admin password. You can provide the string for password and the CodeLet will generate the hash. You can then copy this hash and add in password field in the users table. The code has to be put in index.php of your Drupal installation and the order of the code is important.

DrupalD's picture

Drupal: Taxonomy tree with image

This CodeLet creates a tiled dispay of taxonomy block with child terms. If you use taxonomy image module, you can select the preset and taxonomy on block configuration page. The CodeLet then fetches all the tree along with their images and display in tile in the block.

DrupalD's picture

Drupal: Generate unique invoice number for unbercart order

This CodeLet generate a unique invoice number for every order placed with ubercart. The unique invice number is stored in a custom table and a function is provided to fetch the invoice number for respective order number. You can use this function in order template to display the inovice number

Pages

QR code for this page URL This page URL
Feedback