PostNuke Help

Previous
pnUserSetVar

Home
up

Next
pnVarCensor


pnUserValidateVar

validate user variable

Synopsis

bool pnUserValidateVar()(name, value);

Description

pnUserValidateVar() validates a user-specific variable on the PostNuke system.

Parameters

name

The name of a user variable to validate

value

The value to be validate against the named user variable

Return Values

This function returns true if the validation is successful, false if the validation fails. This function returns void if an exception was raised.

Exceptions

This function raises BAD_PARAM if you pass an invalid parameter. This function raises DATABASE_ERROR if an error occurs while querying data. This function raises UNKNOWN for internal problems. This function raises VARIABLE_NOT_REGISTERED if the metadata of variable you are asking for is not registered.

Notes

See the User Variable section in the PostNuke Module Development Guide for getting an explanation on user variables.

Examples

// Validate the user's email address
if (!pnUserValidateVar('email', $email)) {
  module_user_askdata(array('errmsg' => 'Invalid email'));
}
// Validate the user's timezone_offset address
if (!pnUserValidateVar('timezone_offset', $timezone_offset)) {
  module_user_askdata(array('errmsg' => 'Invalid timezone offset'));
}
pnUserSetVar('email', $email);
pnUserSetVar('timezone_offset', $timezone_offset);
       

See Also

pnUserGetVar()


Previous
pnUserSetVar

Home
up

Next
pnVarCensor