Bug Theme Modern-Notepad Wordpress
Friday, November 7th, 2008Kemarin aku menemukan sedikit bug pada theme modern notepad (kalo memang bisa disebut sebagai bug). Setelah login dan ketika kirim komentar pada salah satu artikel, ketika diklik submit comment, proses insert komentar tidak berjalan. Hanya tampilannya blank. Setelah sedikit diulikin, ditemukan ada 1 baris script yang tidak ada pada theme modern-notepad ini. Solusi dari kasus ini adalah dengan menambahkan script :
<input type=”hidden” name=”comment_post_ID” value=”<?php echo $id; ?>” />
di dalam commentform di theme modern-notepad (comment.php).
Masalah berikutnya adalah pesan “Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.” selalu tampil di bawah textarea pada commentform. Solusi dari masalah ini adalah dengan mengubah “none” menjadi “1″ dan tanda “!=” menjadi “==” pada script :
if (’1′== get_settings(”comment_moderation”))
di dalam commentform di theme modern-notepad (comment.php).
Masalah berikutnya adalah pada plugin password protected. Meskipun udah login pada artikel yang di protect, masih juga belum bisa isi komentar. Solusinya adalah dengan menyamakan beberapa baris script pada comment.php di theme modern-notepad, dengan theme default. Berikut script yang diubah :
sebelum diubah :
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) {
// if there's a password
if ($_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) {
// and it doesn't match the cookie
?>
<p class="nocomments">
<?php _e("This post is password protected.
Enter the password to view comments."); ?>
<p>
<?php
return;
}
}
setelah diubah :
if (!empty($_SERVER['SCRIPT_FILENAME'])
&& 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) {
// if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
// and it doesn't match the cookie
?>
<p class="nocomments">This post is password protected.
Enter the password to view comments.</p>
<?php
return;
}
}