Bring Your Business to Life › Support › Image Store › WP 3.4 Breaks password protected galleries › Reply To: WP 3.4 Breaks password protected galleries
June 15, 2012 at 12:20 pm #47923
Xpark Media
Keymaster
I just tested it and you are right, it’s a hash issue; I will fix it as soon as I can.
If you are not afraid of doing a quick fix this is what you have to do. Replace the following code in the store.php file ( image-store/_inc/store.php ) line 893
}elseif( $gal->post_password === $pass ){ setcookie( 'ims_galid_' . COOKIEHASH, $gal->ID, 0, COOKIEPATH, COOKIE_DOMAIN ); setcookie( 'wp-postpass_' . COOKIEHASH, $gal->post_password, 0, COOKIEPATH, COOKIE_DOMAIN ); update_post_meta( $gal->post_id, '_ims_visits', get_post_meta( $gal->ID, '_ims_visits', true ) +1 ); wp_redirect( get_permalink( $gal->ID ) ); die( ); }
with
}elseif( $gal->post_password === stripslashes( $pass ) ){ global $wp_hasher; if ( empty( $wp_hasher ) ) { require_once( ABSPATH . 'wp-includes/class-phpass.php'); $wp_hasher = new PasswordHash(8, true); } setcookie( 'ims_galid_' . COOKIEHASH, $gal->ID, 0, COOKIEPATH, COOKIE_DOMAIN ); setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes($gal->post_password) ), 0, COOKIEPATH, COOKIE_DOMAIN ); update_post_meta( $gal->post_id, '_ims_visits', get_post_meta( $gal->ID, '_ims_visits', true ) +1 ); wp_redirect( get_permalink( $gal->ID ) ); die( ); }