First, you have to "alter" your database to add "private" field. Login to your CPanel and then phpMyAdmin; click on "b2posts" table and then go into the SQL section. In this section, run the following: ALTER TABLE b2posts ADD post_private INT(1) DEFAULT 0 NOT NULL; --- Now in b2template.functions.php file, put the following function anywhere in between "": //checks for the private cookie function setprivate($password) { global $HTTP_COOKIE_VARS, $HTTP_POST_VARS; if (isset($HTTP_COOKIE_VARS['private'])) { if ($HTTP_COOKIE_VARS['private'] == $password) { $private = $HTTP_COOKIE_VARS["private"]; } else { setcookie("private", "", time()-36000000, "/", ".michaelpark.net"); } } else { if (isset($HTTP_POST_VARS['private'])) { $private = md5(trim($HTTP_POST_VARS['private'])); if ($private == $password) { setcookie("private", $private, time()+36000000, "/", ".michaelpark.net"); //change this to your domain } else { if (empty($private)) { exit ("Please enter the password!

Go back"); } else { exit ("Wrong password!

Go back!"); } } } } return $private; } //private entry check function isprivate($password, $private) { global $postdata; if ($private != $password && $postdata["Private"] == 1) { $isprivate = 1; } else { $isprivate = 0; } return $isprivate; } --- In b2functions.php file under get_postdata and get_postdata2 functions, add the following, respectively: 'Private' => $myrow->post_private and... 'Private' => $row->post_private Put a comma at the end of the previous line in each function if there are none; for example: 'Karma' => $row->post_karma should look like... 'Karma' => $row->post_karma, --- In b2edit.form.php file, locate: Add the following on the next line: tabindex="7" id="private" />
--- This is optional, but if you want to "tag" your private entries in b2edit.php file, open "b2edit.showposts.php" file and locate: And then add the following after "": --- In b2edit.php file, locate: $post_title = addslashes($HTTP_POST_VARS["post_title"]); On the next line, add: $post_private = intval($HTTP_POST_VARS["post_private"]); Repeat this step for the "edit post" (action) section. Now modify the INSERT and UPDATE SQL syntaxes as: $query = "INSERT INTO $tableposts (ID, post_author, post_date, post_content, post_title, post_category, post_private) VALUES ('0','$user_ID','$now','$content','".$post_title."','".$post_category."','".$post_private."')"; ...and: $query = "UPDATE $tableposts SET post_private=\"$post_private\", post_content=\"$content\", post_title=\"$post_title\", post_category=\"$post_category\"".$datemodif." WHERE ID=$post_ID"; Don't copy and paste these lines if you have other hacks installed that insert and update data into the database. --- In b2config.php file, place: #private entry password $password = "your password"; $password = md5($password); --- On the top of index.php and/or b2.php files after "include("blog.header.php");", place: //private cookie check $private = setprivate($password); And locate: Replace it with: And surround "the_content" function like: This is a private entry. To view, please enter the password in the field below:
You can then control the inclusion of comments link as well as others using the "$isprivate" variable; for example: ...and: ...and: In the third case, "public comments disabled" will be displayed if the entry is private AND the user doesn't have the password (in a cookie). Therefore, "b2comments.php" does not have to be modified. Besides, that file can't be loaded or displayed by its own. However, if you are using a popup comments page, proceed... --- In "b2commentspopup.php" file, place the following after "include("blog.header.php");": //private cookie check $private = setprivate($password); And right after "": "" is a private entry. To enter comments, please enter the password in the field below:
" method="POST">
Then after [comments] "": --- If you want to enable your visitors to be able to delete the cookie containing your private password by clicking on a link, save the following in a separate file and put a link to that file on somewhere on your site, preferably only on your private entries. For example: delete cookie]'; } ?> --- As for RSS and RDF files, I suggest you to delete them from your server. I modified mine according to the instruction by the original author of this hack, but I got errors, and I do not know how to fix them.