Skip to:
Content

BuddyPress.org

Changeset 9


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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp_xprofile.php

    r6 r9  
    380380                {
    381381                        $picture = new BP_XProfile_Picture($_GET['file']);
    382                        
     382
    383383                        if(!$picture->delete())
    384384                        {
     
    386386                                $type = 'error';
    387387                        }
    388                         else
    389                         {
    390                                 $thumbnail = new BP_XProfile_Picture($picture->thumb_filename);
    391                                 $thumbnail->delete();
    392                                
    393                                 $message = __('Profile picture deleted.');
    394                                 $type = 'success';
    395                         }               
    396                 }
    397         }
    398        
     388                }
     389        }
     390
    399391        $current = BP_XProfile_Picture::get_current();
    400392        $current_thumbnail = new BP_XProfile_Picture($current['thumbnail']);
  • 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
  • trunk/bp_xprofile/bp_xprofile.cssjs.php

    r7 r9  
    144144               
    145145                p.success { background: green;}
    146                 p.err { background: red;}
     146                p.err {
     147                        border-top: 2px solid red;
     148                        border-bottom: 2px solid red;
     149                        color: red;
     150                        padding: 5px 0;
     151                        width: 40%;
     152                }
    147153               
    148154                span.desc {
Note: See TracChangeset for help on using the changeset viewer.