• Avail guidance to develop Drupal modules & Drupal themes
  • Share and get review of your code
  • Get Access to free CodeBooks and ThemeBooks
  • Drupal 5, 6 and 7 covered

Userpoints Meter

0 Points /1000 Points

CodeLets

  • This code shows us that if user login then show this"logout" if user is not login then show"login"
    it means authenticated user are able to see 'logout' and anonymous user are able to see 'LogIn'
    authenticated user= not able to see login button
    anonymous user = not able to see logout button

  • 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.

  • 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. The syntax to override the computed field is as follow:

    Drupal 6.x: computed_field_FIELD-NAME_compute($node, $field, &$node_field)
    Drupal 7.x : computed_field_YOUR_FIELD_MACHINE_NAME_compute(&$entity_field, $entity_type, $entity, $field, $instance, $langcode, $items)

  • 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. This CodeLet uses three tokens for coupons:

    Coupon code: [coupon-code]
    Coupon name: [coupon-name]
    Coupon value: [coupon-value]

    These tokens can also be placed in newsletter subject field.
    When a new code is generated and the coupon is get activated, coupon's 'valid from' and 'valid until' values changes to current time and one week later respectively. When the coupon expires, on next cron runs, it will be inactive and be available to be picked again randomly.

    The advantage of this CodeLet is, you don't have to add coupons manually each time few of the used up or expired. They get 'recycled'

  • 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.

  • 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.

  • 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!

  • 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.

  • 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.

  • 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.

Syndicate content

Recent comments