Drupal Date field: Calculate weekdays

This CodeLet calculates the weekdays and eliminates weekends from the calculation. This CodeLet creates all the days from a start date to end date from a date field and keeps only weekdays. Some of the statmenete in this CodeLet reflects the project specific requirements. This CodeLet is work for a Drupal 7.x date field having end date enabled. The CodeLet takes only start date and end date in form of array as argument.

Read more: Drupal Date field: Calculate weekdays.

Drupal computed field: Override computed field

This CodeLet overrides the computed field and calculates the value programmatically. So you don’t have to provide the code in ‘Calculate value’ on field configuration page.

Read more: Drupal computed field: Override computed field.

Drupal ubercart coupon: Send and Recycle ubercart coupons

This CodeLet will pick an inactive coupon created with UC coupons module randomly and generate new coupon code. This coupon can then be send via email using simplenews module.

Read more: Drupal ubercart coupon: Send and Recycle ubercart coupons.

Donate userpoints on Drupal node page

This CodeLet will display a userpoint donation form. User can donate points to the author of the node right from the node page. This CodeLet donates ‘tip’ to admin for the nodes admin has created. You can further customize this CodeLet to meet your requirement. With this CodeLet, you will also get a block which you can place any where on the site. The CodeLet uses userpoint-donate module’s permissions.

Read more: Donate userpoints on Drupal node page

Message on Drupal pages

This CodeLet allow you to display a message on every page.
This is a Drupal 7.x CodeLet which has introduced a new Drupal hook_page_build.

Read more: Message on Drupal pages.

Custom Drupal form on Drupal node

This CodeLet demonstrates how to hook into node’s view page in Drupal 7.x. It usese Drupal 7.x hook — hook_node_view($node, $view_mode, $langcode). Thise particular CodeLet adds a form with button. This CodeLet also demonstrate use of Drupal 7.x form API. This is one of the live projects code in work!

Read more: Custom Drupal form on Drupal node.

Drupal Tweaks: hook_menu, hook_form_alter, hook_user

This CodeLet shows use of different hooks in Drupal. Mainly, it depicts use of hook_menu, hook_user and hook_form_alter. The CodeLet also depicts the use of AHAH event in Drupal forms. The CodeLet was written to tweak exisiting Drupal features in a way to achive the desired goals as per the project requirments.

Read More: Drupal Tweaks: hook_menu, hook_form_alter, hook_user.

Drupal GoAway content: Ban/block Authors

This CodeLet allows you to add a ‘ban IP/block user’ link for content using GoAway module. GoAway module just supports banning user IPs in comment and it doesn’t offer a feature to ban/block author’s IP/user. The CodeLet takes care of the link text display depending on the data it finds from the db. If user’s IP is available, it will display ‘Ban IP’, otherwise it will display ‘Block user’. You can ‘Unban/Unblock’ an author in similar way.This CodeLet requires Drupal’s Goaway module — http://drupal.org/project/goaway installed and configured.

Read More: Drupal GoAway content: Ban/block Authors

Flag module: Missing argument 2 for views_break_phrase

This CodeLet depicts the patch which will replace the views_break_phrase() implementation in flag_plugin_argument_validate_flaggability.inc. However, the development release of flag module has already implemented this change. The changes has to be made because signature of views_break_phrase() has been changed.

Read more: Flag module: Missing argument 2 for views_break_phrase

Patch

This CodeBook is a collection of patch CodeLets. These patches help fix bugs and issues in a core or contributed module. Applying a patch to a module is the best way to fix any issue.

Read more: Patch

Rss Feed Tweeter button Facebook button Technorati button Reddit button Myspace button Linkedin button Webonews button Delicious button Digg button Flickr button Stumbleupon button Newsvine button Youtube button