PDA

View Full Version : Reading database in editpost.php


rjordan
01-30-2005, 06:03 PM
Where in EDITPOST.PHP does vB read the post from the database? I cannot seem to locate this.

I am attempting my first "real" PHP hack here, so any help is appreciated!

Xenon
01-30-2005, 09:03 PM
it's done on line 71

$postinfo = fetch_postinfo($postid);

the fetch_postinfo function gains every info out of the db :)
(it's defined in functions.php for further info)

rjordan
01-31-2005, 12:13 AM
I have the following:

editpost.php
$xyz = "Test message";
$xyz = handle_bbcode_view_message($xyz);
functions_bbcodeparse.php
function handle_bbcode_view_message($code)
{
$postInfo = fetch_postinfo($postid);
$code .= $postInfo['post'];
return $code;
}

This is returning nothing other than a single copy of the post. It should return two copies of the same post according to what I (think) I have put together. Any insight into what might be wrong with this?

Paul M
01-31-2005, 12:44 AM
Well a quick look suggests you are not passing the postid to the function, so it will fail to find anything ... but what on earth are you trying to do ???

rjordan
01-31-2005, 12:55 AM
* Modified my post because I pasted the wrong text.

I have a variable assigned the text Test Message. The post I am reading has the same text. I am trying to re-read the original post from the database so I can track post edits. I am 1/2 step away from finishing it, but this and the permission problem I am having (posted earlier today) are stopping me.

Mink_
01-31-2005, 01:27 AM
Can't you track edits in the admin cp?

rjordan
01-31-2005, 01:30 AM
Ok, I have changed it to the following:

editpost.php
$xyz = "Test message";
$xyz = handle_bbcode_view_message($xyz,$post[postid]);
functions_bbcodeparse.php
function handle_bbcode_view_message($code,$postid)
{
$postInfo = fetch_postinfo($postid);
$code .= $postid.$postInfo['post'];
return $code;
}

Now I get back the value of $post[postid] after my initial phrase (as a test), so the variable is being passed. The message text is still not coming back from the database.

Can you? I have not seen this as an option... if that is the case, then I am going to feel a bit stupid...

I have gone through and do not see an option to turn on edit tracking... where would it be hiding?

Mink_
01-31-2005, 01:42 AM
You could just make a simple SQL query based on that value... Just go into phpyAdmin or whatever you use and look at the database format... the rest should be pretty simple.

And about that option not being in the admin CP... You can see when MODs edit posts at http://www.yoursite.com/forums/admincp/modlog.php...

rjordan
01-31-2005, 01:45 AM
Ah, MySQL... that is something else I need to learn... not really so simple for me at the moment.

Is $postInfo['post'] the correct variable to call based on my code?

Xenon
01-31-2005, 01:19 PM
i think you need

$postInfo['pagetext'] here :)

rjordan
01-31-2005, 09:56 PM
That was the missing piece! Thank you very much!

Xenon
02-02-2005, 03:43 PM
you're welcome :)