Drupal

If you want to modify the user registration page, and only override a fields description, it can be done easily with the following code:

function myModule_form_alter(&$form, $form_state, $form_id){

  if($form_id == 'user_register')
  {
    // Change registration email description
    $form['account']['mail']['#description'] = t('MySite does not accept gmail,
    hotmail or similar accounts.  If you must use a gmail type account,
    please explain why in the Comments section, and we will consider your
    request.)');
  }
}

myModule is a custom module and you use the form_alter() hook implementation.  This allows you to ONLY modify the mail element and its associated #description property instead of the whole form.  Rather neat!

Drupal's Form API is powerful, but it's associated learning curve can be a steep one.  However, if you stick to these basic 5 steps you will be off to a good start in creating your own Drupal theme on the double.

The 5 basic steps to create a Drupal form using the API are as follows:

 

  1. A menu item
  2. A menu callback for that menu item
  3. Define the form
  4. Validate the form
  5. Re-direct or post-validation form submission

This document doesn't go into the basics of creating a module, but assues that you already possess that knowledge or can use Google.  This module is called basicform!

When creating a new block or altering an existing one, inside the block configuration interface, snippets of PHP code can be written to determine whether or not a block should be displayed.

 

Two of the most common snippets as follow:

Displaying a block to logged-in users only

Only return TRUE when the global $user is not 0.

<?php

global $user;

return (bool) $user->uid;

?>


Displaying a block to anonymous users only

Only return TRUE when the global $user is 0.

In my other tutorial, I covered how to create a rotating banner using CSS and a simple random PHP script.  This howto or tutorial covers creating a rotating banner or background using Jquery and a bit of CSS.

It is no more complex than the first method, but to get started you need the Jquery module installed.

Jquery is available here at: http://drupal.org/project/jquery_ui

The great thing about Drupal is that people post most of their findings and work on the Internet so others can read it.  However, SEO or search engine optimization is a bit of a mystery for alot of website admins and web-beginners.  Most of the information regarding SEO is out on the Internet, but it can seem confusing and is spread out on an array of websites.

In Drupal there are two common functions that are sometimes misused, but are quite important to everyday Drupal development.  These functions both complete their primary functions, but also sanitize data and make sure it is safe for the user.

The two functions that will be covered in this article are:

A couple simple tricks to modify a form:

Everyone knows modifying a form can be a pain and particularly confusing for the beginner if you don't know where to start.  I am putting this quick article together to supplement my last article and highlight those tricks.
 

Introduction:

Drupal is a great open-source project that combines being a unified web-framework, a serious API and is highly modular due to its architecture.  It is also very community driven, powerful and above all, caters to the developer and the themer.  Off the bat, Drupal can be a little big confusing and intimidating for the beginner.  In this mini-series, I will show you various ways of adding fields to the registration and user process in Drupal.

IDEs such as Dreamweaver can cost alot of money for the results they produce.  As the web changed, a Java based-platform, Eclipse exploded onto the development scene.  As Eclipse gained more popularity, communities formed and open-source editions that packaged it into a PHP IDE.

One of these IDEs is called Aptana. 

This Howto covers downloading and configuring Aptana for PHP and Drupal development.

Error:

warning: date() It is not safe to rely on the system's timezone settings.  You are *required* to use the date.timezone setting or the date_default_timezone_set() function.  In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identified.  We selected 'America/Los_Angeles' for 'PST/-8.0/noDST' instead in...

Navigation
Syndicate
Syndicate content
Share/Save