Make WordPress Core

Ticket #13821: 13821-2.diff

File 13821-2.diff, 2.5 KB (added by kapeels, 14 years ago)
  • var/www/html/wordpress-trunk/trunk/wp-admin/js/post.dev.js

     
    453453                });
    454454
    455455                $('.save-post-visibility', '#post-visibility-select').click(function () { // crazyhorse - multiple ok cancels
     456                        // hack - check if "Password protected" is checked but password is not set                       
     457                        if ( $("#visibility-radio-password").attr('checked') && $('#post_password').val() == '' ) {
     458                            $('#post_password').addClass('form-invalid');
     459                            // if password is blank, the slide-up event won't happen and so, the post visibility won't be updated...                           
     460                            $('#publish').val( postL10n.update );
     461                            postStatus = $('#post_status');
     462                            optPublish = $('option[value=publish]', postStatus);                           
     463                            if ( optPublish.length == 0 ) {
     464                                postStatus.append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
     465                            } else {
     466                                optPublish.html( postL10n.privatelyPublished );
     467                            }
     468                            $('option[value=publish]', postStatus).attr('selected', true);                           
     469                            return false;
     470                        } else {
     471                            $('#post_password').removeClass('form-invalid');                             
     472                        }
    456473                        var pvSelect = $('#post-visibility-select');
    457474
    458475                        pvSelect.slideUp("normal");
  • var/www/html/wordpress-trunk/trunk/wp-admin/includes/post.php

     
    167167                                $post_data['post_password'] = '';
    168168                                break;
    169169                        case 'password' :
     170                                // if password is not set, revert post status to what it was
     171                                if( empty( $post_data['post_password'] ) ) {
     172                                    $post_data['post_status'] = $post_data['hidden_post_status'];
     173                                }                               
    170174                                unset( $post_data['sticky'] );
    171175                                break;
    172176                        case 'private' :