This tutorial explains how to created a single page with a login form an a register form in Drupal6.

developed_loginregister

To accomplish this, we have to go through some concepts first:

Continue reading “A custom login/register page for Drupal 6″…

This function will print a large list of all the variables that are declared in the current scope:

An interesting variable is $node, but it is not always accessible.

 

The short answer:

It’s not possible

The long answer:

In a simple user form it is possible to add a single on/off checkbox.

$form['thermometer_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Show the thermometer'),
'#options' => array(0 => t("no"), 1 => t("yes")),
);

But, it’s not possible to provide a default value (checked/unchecked) with a single chechbox. This causes difficulties when you want to show the saved value of a user.

A simple solution is to use a “yes/no radiobutton list” instead of a single checkbox.

$form['thermometer_enabled'] = array(
'#type' => 'radios',
'#title' => t('Show the thermometer'),
'#options' => array(0 => t("no"), 1 => t("yes")),
'#default_value' => variable_get('thermometer_enabled', 0),
);

In this example the result is saved in the variable thermomoeter_enabled and has the default value of 0 (false).


Wordpress.org clearPaper by CreativeBits.it Copyright © 2012-2019 Robin Brackez. All rights reserved. By visiting this site you agree to accept cookies that are purely used to check how many visitors I have. Theme by: creativebits. Custom adaptations by Robin Brackez.