Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/03/2008 10:30:24 PM (18 years ago)
Author:
apeatling
Message:

fixed date selection and the clearing of date selections. Added the ability to delete profile images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp_xprofile/bp_xprofile.classes.php

    r8 r9  
    510510                       
    511511                        case "datebox":
    512                                 if($this->data->value != "")
     512                                if($this->data->value != '')
    513513                                {
    514514                                        $day = date("j", $this->data->value);
    515515                                        $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                                       
    517519                                }
    518520                               
     521                                $html .= '<div id="field_' . $this->id . '"';
    519522                                $html .= '<label for="field_' . $this->id . '_day">' . $asterisk . $this->name . ':</label>';
    520523                               
    521524                                $html .= $this->message . '
    522525                                <select name="field_' . $this->id . '_day" id="field_' . $this->id . '_day">';
     526                                $html .= '<option value=""' . $default_select . '>--</option>';
     527                               
    523528                               
    524529                                for($i = 1; $i < 32; $i++)
     
    542547                                $html .= '
    543548                                <select name="field_' . $this->id . '_month" id="field_' . $this->id . '_month">';
     549                                $html .= '<option value=""' . $default_select . '>------</option>';
    544550                               
    545551                                for($i = 0; $i < 12; $i++)
     
    547553                                        if($month == $months[$i])
    548554                                        {
    549                                                 $selected = ' selected = "selected"'; 
     555                                                $selected = ' selected = "selected"';
    550556                                        }
    551557                                        else
     
    556562                                        $html .= '<option value="' . $months[$i] . '"' . $selected . '>' . $months[$i] . '</option>';
    557563                                }
    558                                
     564
    559565                                $html .= '</select>';
    560566                               
    561567                                $html .= '
    562568                                <select name="field_' . $this->id . '_year" id="field_' . $this->id . '_year">';
    563                                
     569                                $html .= '<option value=""' . $default_select . '>----</option>';
     570                                                               
    564571                                for($i = date('Y', time()); $i > 1899; $i--)
    565572                                {
     
    578585                                $html .= '</select>';
    579586                                $html .= '<span class="desc">' . $this->desc . '</span>';
     587                                $html .= '</div>';
     588                               
    580589                        break;
    581590                }
     
    861870                if($this->is_valid_field())
    862871                {
    863                         if($this->exists())
     872                        if($this->exists() && $this->value != '')
    864873                        {
    865874
     
    873882                                                        field_id = " . $this->field_id;         
    874883
     884                        }
     885                        else if($this->exists() and $this->value == '')
     886                        {
     887                                // Data removed, delete the entry.
     888                                $this->delete();
    875889                        }
    876890                        else
     
    10391053        function delete()
    10401054        {
    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;
    10421071        }
    10431072
Note: See TracChangeset for help on using the changeset viewer.