here is what i'm trying, but it's not working. does anything look out of place to anyone?
/**
* Generate a random number for a confession title. Check that the title
* isn't already in use before returning the value
* @return integer (as string)
*/
function confession_generate_title() {
// To make the maximum value a setting, retrieve this way:
// $rand = rand(0, variable_get('confession_max_title_number', 10000000000));
$rand = mt_rand(1000, 1000000000);
$test = node_load(array('title' => $rand));
while (($test !== FALSE) && ($test->nid > 0)) {
$rand++;
$test = node_load(array('title' => $rand));
}
return $rand;
}
Comments
Comment #1
gaurav.kapoor commented