Drupal offers user management out of the box. This includes new user registration, log in, password mailer and user session management. Drupal stores password as md5 hash value. When a user provides her log in credentials, Drupal generates md5 has values for the password provided and compares it with the one stored in the database against the provided username/email address. This is a well known technique implemented by Unix.
Though Drupal manages the users, we can still alter the behavior of different default actions on a user activity. For example, if you log in from the front page, by default, you will be redirected to front page. Instead we can make to redirect to different page or different front page, that can only be accessed by logged users. To achieve this, we need to use hook_user Drupal hook.
Read moreĀ Drupal hook: hook_user.
Drupal auto complete field lets you select values appear as you type in the text box. Which maximizes the usability and user experience.
Think of a situation, You are creating a custom search function which display author picture, some text containing the word(s) you are typing and node post date.
This can not be achieved by creating a CCK auto complete field since such fields can be added to node types only. You need to create a custom module and write hook_search (no more supported in Drupal 7.x). You have to define a extra attribute in your text box definition: #autocomplete_path. The value this attribute takes is a path defined with hook_menu known to your Drupal site. Any non-existing path assigned to this attribute will result in error. So, first make sure you have defined the path and the callback function with proper permissions.
The auto complete works on ‘change’ event of the text box. As you type, the path defined in #autocomplete_path calls the function defined in ‘callback function’ of the menu definition. The function may fetch values from the site database contact third party services.
The function should return an array with key-value pairs. The values matching with the text in the text box will be displayed under the text box and you can select any of the values using either mouse of up-down keys.
Read more: Drupal: Auto complete field.
This CodeLet creates a floating menu/layer at the bottom edge (by default) of the page. You can though enhance it to be displayed at any edge of the page like the task bar of an operating system.
You can add link, music players, tip of the day, important alerts and make it like a quick access bar.
Floating bar.
Drupal hook: hook_mail_alter.
When sending e-mails or newsletters from your website, you might want to inject some information like website name, disclaimer, copy right information, unsubscribe link and such. Just like hook_form_alter, you can use hook_mail_alter to virtually alter anything in the mail just before Drupal sends the e-mail. You can even change the mime type of the email, for example, from plain text to HTML and vice versa.
Grid of terms in a block.
This CodeLet show how to display terms in a vocabulary as block. The CodeLet will display the terms, along with term icon, if taxonomy image module is installed, in a grid of 4X4. The block is configurable. You can select which vocabulary to show the terms from. Its quite attractive and can be used on front page.
Node Visitors.
This CodeLet adds a local task on node page which lists all the unique visitors of the node. You can configure the profile fields to be shown list.
Drupal hook: hook_view.
The full view of a node including all the information associated with the nodes like author, node posted date, file attached to the node and any other data that are associated by other custom modules is managed by hook_view. The main goal and use of the hook_view is to allow the node modules to add extra information and manage those extra information to display when viewing the node. Nodes can have tease view as well as page view. On teaser view, only some of the information associated with the node is displayed; we can say its an overview of the node. On page view, all the information associated with the node is displayed.
Project codes.
This CodeBook contains CodeLets from different projects that are allowed to publish to community. All the CodeLets under this CodeBook are published under GNU/GPL license. You can use, share, modify and publish it under GNU/GPL license.
Image menu.
This CodeLet will allow you to add an image to a menu by overriding the menu in the template.php file of you theme. Also, the module offer admin side control to select and put the image to a menu item.
Node information.
This CodeLet shows a link on nodes to request more information for a node. By clicking the link, the user will be redirected to the site wide contact page and the subject field of the contact form is filled with the node title. Also, the link to the node will be added just before the mail will be sent. Thus preventing the user from modifying the link.