Changeset 9 for trunk/bp_xprofile/bp_xprofile.classes.php
- Timestamp:
- 04/03/2008 10:30:24 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp_xprofile/bp_xprofile.classes.php
r8 r9 510 510 511 511 case "datebox": 512 if($this->data->value != "")512 if($this->data->value != '') 513 513 { 514 514 $day = date("j", $this->data->value); 515 515 $month = date("F", $this->data->value); 516 $year = date("Y", $this->data->value); 516 $year = date("Y", $this->data->value); 517 $default_select = ' selected="selected"'; 518 517 519 } 518 520 521 $html .= '<div id="field_' . $this->id . '"'; 519 522 $html .= '<label for="field_' . $this->id . '_day">' . $asterisk . $this->name . ':</label>'; 520 523 521 524 $html .= $this->message . ' 522 525 <select name="field_' . $this->id . '_day" id="field_' . $this->id . '_day">'; 526 $html .= '<option value=""' . $default_select . '>--</option>'; 527 523 528 524 529 for($i = 1; $i < 32; $i++) … … 542 547 $html .= ' 543 548 <select name="field_' . $this->id . '_month" id="field_' . $this->id . '_month">'; 549 $html .= '<option value=""' . $default_select . '>------</option>'; 544 550 545 551 for($i = 0; $i < 12; $i++) … … 547 553 if($month == $months[$i]) 548 554 { 549 $selected = ' selected = "selected"'; 555 $selected = ' selected = "selected"'; 550 556 } 551 557 else … … 556 562 $html .= '<option value="' . $months[$i] . '"' . $selected . '>' . $months[$i] . '</option>'; 557 563 } 558 564 559 565 $html .= '</select>'; 560 566 561 567 $html .= ' 562 568 <select name="field_' . $this->id . '_year" id="field_' . $this->id . '_year">'; 563 569 $html .= '<option value=""' . $default_select . '>----</option>'; 570 564 571 for($i = date('Y', time()); $i > 1899; $i--) 565 572 { … … 578 585 $html .= '</select>'; 579 586 $html .= '<span class="desc">' . $this->desc . '</span>'; 587 $html .= '</div>'; 588 580 589 break; 581 590 } … … 861 870 if($this->is_valid_field()) 862 871 { 863 if($this->exists() )872 if($this->exists() && $this->value != '') 864 873 { 865 874 … … 873 882 field_id = " . $this->field_id; 874 883 884 } 885 else if($this->exists() and $this->value == '') 886 { 887 // Data removed, delete the entry. 888 $this->delete(); 875 889 } 876 890 else … … 1039 1053 function delete() 1040 1054 { 1041 1055 $current = $this->get_current(); 1056 1057 if($this->filename == $current['picture']) { 1058 update_option('profile_picture', 'none.gif'); 1059 update_option('profile_picture_thumbnail', 'none.gif'); 1060 } 1061 1062 if(file_exists($this->path . "/" . $this->filename)) { 1063 unlink($this->path . "/" . $this->filename); 1064 } 1065 1066 if(file_exists($this->path . "/" . $this->thumb_filename)) { 1067 unlink($this->path . "/" . $this->thumb_filename); 1068 } 1069 1070 return true; 1042 1071 } 1043 1072
Note: See TracChangeset
for help on using the changeset viewer.