Version: , by Boofo
Developer Last Online: Jun 2012
Version: Unknown
Rating:
Released: 03-07-2003
Last Update: Never
Installs: 0
No support by the author.
What I'm trying to do with the code below is pull both the post title (if there is one) and the thread title from the getlastposts query. What I want it to do is is show "Re: threadtitle" is there is no post title. Can someone please tell me what I am doing wrong?
PHP Code:
$totalposts=$userinfo[posts];
if ($totalposts!=0 or $userinfo[lastpost]!=0) {
$getlastposts=$DB_site->query("SELECT thread.title,thread.threadid,thread.forumid,post.title,postid,post.dateline FROM post,thread WHERE thread.threadid=post.threadid AND post.userid=$userinfo[userid] AND post.visible=1 ORDER BY post.dateline DESC");
$postctr=0;
$latestposts="";
while ($getlastpost=$DB_site->fetch_array($getlastposts)) {
$getperms=getpermissions($getlastpost[forumid],$bbuserinfo[userid],$bbuserinfo[usergroupid]);
if ($getperms[canview]==1) {
$postdate=vbdate($dateformat,$getlastpost[dateline]);
$posttime=vbdate($timeformat,$getlastpost[dateline]);
$posttitle=$getlastpost[title];
$posttitle=censortext($posttitle);
$posttitle=htmlspecialchars($posttitle);
$posttitle=preg_replace("/(\[)(you)(])/siU", $bbuserinfo[username], $posttitle);
$threadtitle=$getlastpost[title];
$threadtitle=censortext($threadtitle);
$threadtitle=htmlspecialchars($threadtitle);
$threadtitle=preg_replace("/(\[)(you)(])/siU", $bbuserinfo[username], $threadtitle);
$posturl="showthread.php?postid=$getlastpost[postid]#post$getlastpost[postid]";
$postctr++;
if ($postctr==1){
$lastpostdate=$postdate;
$lastposttime=$posttime;
$lastposttitle=$posttitle;
$lastposturl=$posturl;
}
eval("\$latestposts .= \"".gettemplate("getinfo_latestposts")."\";");
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
$totalposts=$userinfo[posts];
if ($totalposts!=0 or $userinfo[lastpost]!=0) {
$getlastposts=$DB_site->query("SELECT thread.title,thread.threadid,thread.forumid,post.title,postid,post.dateline FROM post,thread WHERE thread.threadid=post.threadid AND post.userid=$userinfo[userid] AND post.visible=1 ORDER BY post.dateline DESC");
$postctr=0;
$latestposts="";
while ($getlastpost=$DB_site->fetch_array($getlastposts)) {
$getperms=getpermissions($getlastpost[forumid],$bbuserinfo[userid],$bbuserinfo[usergroupid]);
if ($getperms[canview]==1) {
$postdate=vbdate($dateformat,$getlastpost[dateline]);
$posttime=vbdate($timeformat,$getlastpost[dateline]);
$posttitle=$getlastpost[title];
$posttitle=censortext($posttitle);
$posttitle=htmlspecialchars($posttitle);
$posttitle=preg_replace("/(\[)(you)(])/siU", $bbuserinfo[username], $posttitle);
$threadtitle=$getlastpost[title];
$threadtitle=censortext($threadtitle);
$threadtitle=htmlspecialchars($threadtitle);
$threadtitle=preg_replace("/(\[)(you)(])/siU", $bbuserinfo[username], $threadtitle);
$posturl="showthread.php?postid=$getlastpost[postid]#post$getlastpost[postid]";
if ($posttitle == "") { //only part i changed
$posttitle = "Re: $threadtitle";//
}//
Here's the code I am working with now. I took out all the other stuff because it wasn't working.
PHP Code:
$totalposts=$userinfo[posts];
if ($totalposts!=0 or $userinfo[lastpost]!=0) {
$getlastposts=$DB_site->query("SELECT thread.title,thread.threadid,thread.forumid,postid,post.dateline FROM post,thread WHERE thread.threadid=post.threadid AND post.userid=$userinfo[userid] AND post.visible=1 ORDER BY post.dateline DESC");
$postctr=0;
$latestposts="";
while ($getlastpost=$DB_site->fetch_array($getlastposts)) {
$getperms=getpermissions($getlastpost[forumid],$bbuserinfo[userid],$bbuserinfo[usergroupid]);
if ($getperms[canview]==1) {
$postdate=vbdate($dateformat,$getlastpost[dateline]);
$posttime=vbdate($timeformat,$getlastpost[dateline]);
$posttitle=$getlastpost[title];
$posttitle=censortext($posttitle);
$posttitle=htmlspecialchars($posttitle);
$posttitle=preg_replace("/(\[)(you)(])/siU", $bbuserinfo[username], $posttitle);
$posturl="showthread.php?postid=$getlastpost[postid]#post$getlastpost[postid]";
if ($posttitle == "") { //only part i changed
$posttitle = "Re: $threadtitle";//
}//
well i look at the query and you aren't getting the post title, you have thread.title so your $posttitle=$getlastpost[title] is really your thread title
Originally posted by mr e well i look at the query and you aren't getting the post title, you have thread.title so your $posttitle=$getlastpost[title] is really your thread title
is this out of a php file or did you modify it?
It's from an older hack I am updating for my site. How do we get the post title out of that query?