boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Revised Improved Private Entry Hack
Goto page Previous  1, 2, 3, 4, 5, 6
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
turtelina



Joined: 25 Jan 2002
Posts: 23
Location: Austria

PostPosted: Thu Jan 08, 2004 12:39 pm    Post subject: Reply with quote

Hi Michael,

I am having the same error as Jenny_Jen on page 4 did. I did everything, checked the checkbox to make the entry private, but itīs showing up as normal entry.

This is what you replied to her back then:

Quote:
Your problem seems to be because the hack is not properly reading the field value in the table. Have you modified the "get_postdata" and "get_postdata2" functions? If you did, please verify the insertion by going into your phpMyAdmin after making a private entry.

I also have to ask you if you indeed modified the b2posts table with the SQL syntax given in the instruction.


I checked in my phpAdmin, and my test entry has a 0 in the post_private colum. Thatīs wrong, is it?

Canīt seem to fix that.
*head explodes*
Back to top
View user's profile Send private message Visit poster's website
Cyberian75



Joined: 26 Sep 2002
Posts: 967
Location: Washington

PostPosted: Thu Jan 08, 2004 6:45 pm    Post subject: Reply with quote

turtelina wrote:

I checked in my phpAdmin, and my test entry has a 0 in the post_private colum. Thatīs wrong, is it?


In that case, the value for that variable might not be being passed from one page to another; i.e., from your "edit page" to the "post" section of the b2edit.php file.

Did you...

Quote:

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";


It could also be that you forgot to modify these INSERT and/or UPDATE SQL statements.
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
turtelina



Joined: 25 Jan 2002
Posts: 23
Location: Austria

PostPosted: Thu Jan 08, 2004 8:38 pm    Post subject: Reply with quote

Heya Michael,

Thank you so much for your help!

I had the first two things (add post_tilte and the post_private) .

To the Insert and Update syntaxes...

I didnīt paste the code from your tutorial, but from a reply you gave to someone on page 3 I think it was, because I have the customfield hack installed too.

Now, I replaced the query insert with the one you gave here, because it looked similar.

This is what my query_update sais right now:

// snip


Last edited by turtelina on Fri Jan 09, 2004 3:35 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Cyberian75



Joined: 26 Sep 2002
Posts: 967
Location: Washington

PostPosted: Thu Jan 08, 2004 8:48 pm    Post subject: Reply with quote

turtelina,

That looks correct to me. Now, show me your insert statement.
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
turtelina



Joined: 25 Jan 2002
Posts: 23
Location: Austria

PostPosted: Thu Jan 08, 2004 8:56 pm    Post subject: Reply with quote

It sais this:

// snip

Thank you Michael!

Could this have anything to do it? I am checking the columns in my post table right now, and they go in this order:

ID, post_author, post_date, post_content, post_title, post_category, post_karma, Mood (customfield, donīt wonder Very Happy), post_private

Does the insert thing have to include all of that in that order?


Last edited by turtelina on Fri Jan 09, 2004 3:35 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Cyberian75



Joined: 26 Sep 2002
Posts: 967
Location: Washington

PostPosted: Thu Jan 08, 2004 9:17 pm    Post subject: Reply with quote

Try...

Code:

/* Edited for b2customfields */
$sql1 = "SELECT * FROM b2customfields";
$result1 = mysql_query($sql1);
$query = "INSERT INTO $tableposts (ID, post_author, post_date, post_content, post_title, post_private, post_category";
$queryadd = "";
while($row1 = mysql_fetch_array($result1)){
$query .= ",".$row1['field_name'];
if($row1['field_type']=="checkbox"&&empty($_POST[$row1['field_name']])){
$queryadd .= ",'0'";
}else{
$queryadd .= ",'".$_POST[$row1['field_name']]."'";
}
}
$query .= ") VALUES ('0','$user_ID','$now','$content','".$post_title."','".$post_private."','".$post_category."'".$queryadd.")";
/* End edited for b2customfields */

_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
turtelina



Joined: 25 Jan 2002
Posts: 23
Location: Austria

PostPosted: Fri Jan 09, 2004 3:47 pm    Post subject: Reply with quote

Thank you so much for all of your help Michael! I went through all the files for at least 3 or 4 times yesterday.

Until I remembered that I hadnīt pasted the code, that you have to paste into b2edit.form.php, in the right place, because I couldnīt find the pingback echo code. I pasted it under something else where I thought itīs right. It wasnīt of course. Once I fixed that, it worked.

I am sorry, I didnīt think that this one thing would make the whole hack not work.

I have a similar problem as shimmer now. (page 3)

Michael, what did you mean with that?

Quote:
Anyway, try putting your function on the top of your index file after the inclusion of "blog.header.php" but before calling that function.
Back to top
View user's profile Send private message Visit poster's website
Cyberian75



Joined: 26 Sep 2002
Posts: 967
Location: Washington

PostPosted: Fri Jan 09, 2004 7:07 pm    Post subject: Reply with quote

I don't know which page you got that quote from. I can't find it on page 3. Anyhow, what error are you getting now? "Header already sent..."? If so, make sure that there are no empty spaces or breaks after "?>" in each file you edited.
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
turtelina



Joined: 25 Jan 2002
Posts: 23
Location: Austria

PostPosted: Fri Jan 09, 2004 8:25 pm    Post subject: Reply with quote

Thanks Michael. Yes, I am getting this:

Quote:
Warning: Cannot modify header information - headers already sent by (output started at /home/turtnet/public_html/commonhead.php:12) in /home/turtnet/public_html/dailylife/b2-include/b2template.functions.php on line 1359


Which is this line (bold):

Quote:
/* this is commented out because it just makes PHP die silently
for no apparent reason
if (is_array($function_to_add)) {
foreach($function_to_add as $function) {
if (!in_array($function, $b2_filter[$tag])) { $new_functions[] = $function;}}} else */if (is_string($function_to_add)) {
if (!@in_array($function_to_add, $b2_filter[$tag])) {
$new_functions[] = $function_to_add;
}


I took out all empty spaces, around line 1362, which just moved the error up 3 lines to 1359. I thought it is a cookie error because of a theme script I use, but I get this error, even when I remove the theme file include.

However, itīs not that much a problem, as I love your hack even without a cookie being stored. Very Happy

I am going to play around with it, maybe I can figure it out.

Thanks so much for the hack Michael, itīs brilliant! Thanks for your comments, too! Very Happy
Back to top
View user's profile Send private message Visit poster's website
Cyberian75



Joined: 26 Sep 2002
Posts: 967
Location: Washington

PostPosted: Fri Jan 09, 2004 8:33 pm    Post subject: Reply with quote

Are there any HTML outputs in your commonhead.php file? If so, you have to call the function of my hack before you include that file in your index file.
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group