Make WordPress Core

Ticket #13821: 13821-2.2.diff

File 13821-2.2.diff, 2.3 KB (added by kapeels, 14 years ago)

This one has less green part and trims password before check

  • 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                                $post_data['post_password'] =   trim($post_data['post_password']);
     172                                if( empty( $post_data['post_password'] ) ) {
     173                                    $post_data['post_status'] = $post_data['hidden_post_status'];
     174                                }                               
    170175                                unset( $post_data['sticky'] );
    171176                                break;
    172177                        case 'private' :
  • 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                        var post_password = jQuery.trim($('#post_password').val());
     458                        if ( $("#visibility-radio-password").attr('checked') && post_password == '' ) {
     459                            // trim-fix
     460                            $('#post_password').val('');
     461                            $('#post_password').addClass('form-invalid');
     462                            // if password is blank, the slide-up event won't happen and so, the post visibility won't be updated...                                                                               
     463                            return false;
     464                        } else {
     465                            $('#post_password').removeClass('form-invalid');                             
     466                        }
    456467                        var pvSelect = $('#post-visibility-select');
    457468
    458469                        pvSelect.slideUp("normal");