If I want to remove the drop down for the year will that make the birthday not show on the calendar? If it looks like it is ok to remove it what can be removed?? What should it look like?
[PHP]function date_selection($default_date="", $field_names=array("user_birthday_month", "user_birthday_day", "user_birthday_year"), $labels=1)
// Returns date selection as a drop-down menu, if field names are omitted birthday fields are used
{
// Determine start date
if ($default_date)
{
if (strpos($default_date, "-"))
{
list($year, $month, $day) = explode("-", $default_date);
if (substr($year, 0, 1) == "s")
{
$year = substr($year, 1);
$start_date = ($year > date("Y")) ? date("Y") : $year;
}
}
else if (substr($default_date, 0, 1) == "s")
$start_date = substr($default_date, 1, 4);
}
if (!$start_date)
$start_date = 1900;
$months = array(
lg("month_january"),
lg("month_february"),
lg("month_march"),
lg("month_april"),
lg("month_may"),
lg("month_june"),
lg("month_july"),
lg("month_august"),
lg("month_september"),
lg("month_october"),
lg("month_november"),
lg("month_december"));
if ($labels)
{
$month_list = sprintf('<OPTION VALUE="00">%s</OPTION>%s', lg("month"), "\n");
$day_list = sprintf('<OPTION VALUE="00">%s</OPTION>%s', lg("day"), "\n");
$year_list = sprintf('<OPTION VALUE="0000">%s</OPTION>%s', lg("year"), "\n");
}
for ($i = 0; $i < 12; $i++)
{
($i == $month - 1) ? $is_selected = " SELECTED" : $is_selected = "";
$month_list .= sprintf(' <OPTION VALUE="%s"%s>%s</OPTION>%s', $i + 1, $is_selected, $months[$i], "\n");
}
for ($i = 1; $i <= 31; $i++)
{
($day == $i) ? $is_selected = " SELECTED" : $is_selected = "";
$day_list .= sprintf(' <OPTION VALUE="%02d"%s>%02d</OPTION>%s', $i, $is_selected, $i, "\n");
}
(($field_names[0] == "user_birthday_month") or (strlen($default_date) <= 5)) ?
$current_year = date("Y") : $current_year = 2037;
for ($i = $start_date; $i <= $current_year; $i++)
{
($year == $i) ? $is_selected = " SELECTED" : $is_selected = "";
$year_list .= sprintf(' <OPTION VALUE="%s"%s>%s</OPTION>%s', $i, $is_selected, $i, "\n");
}
// Sort fields according to date format
$parts = preg_split('/\-|\s+|,/', USER_DATE_FORMAT);
foreach ($parts as $part)
if (in_array($part, array("m", "M", "F")))
$sorted_output[] = array($field_names[0], $month_list);
else if (in_array($part, array("d", "j", "jS")))
$sorted_output[] = array($field_names[1], $day_list);
else if ($part == "Y")
$sorted_output[] = array($field_names[2], $year_list);
$date_field1 = (strpos($sorted_output[0][0], '"') !== false) ? $sorted_output[0][0] : '"' . $sorted_output[0][0] . '"';
$date_field2 = (strpos($sorted_output[1][0], '"') !== false) ? $sorted_output[1][0] : '"' . $sorted_output[1][0] . '"';
$date_field3 = (strpos($sorted_output[2][0], '"') !== false) ? $sorted_output[2][0] : '"' . $sorted_output[2][0] . '"';
return sprintf('<SELECT NAME=%s ID="wgui_%s">%s</SELECT>' . "\n" .
'<SELECT NAME=%s ID="wgui_%s">%s</SELECT>' . "\n" .
'<SELECT NAME=%s ID="wgui_%s">%s</SELECT>' . "\n",
$date_field1, str_replace('"', '', $date_field1), $sorted_output[0][1],
$date_field2, str_replace('"', '', $date_field2), $sorted_output[1][1],
$date_field3, str_replace('"', '', $date_field3), $sorted_output[2][1]);
}[/PHP]