Skip to Content Skip to Menu

Profilebook: Orig Message Quoted in Reply

15 years 9 months ago #85085 by redleader36
Profilebook: Orig Message Quoted in Reply was created by redleader36
Hello all.

I was wondering if you guys might be able to help me out with the Profile Book plugin. I am trying to modify it so that when a user replies [returns favor] the original message is quoted above the new reply. How would one retreive the previous message?

would it be possible just to create a new temporary variable when viewing the original message, then when clicking on the reply link, it appends that message from the temp variable into the edit box? Is that the best way to go about this? Should I modify the reply function so that it looks up the previous message from the database?

any input or direction would be greatly appreciated!

Please Log in or Create an account to join the conversation.

15 years 9 months ago #85155 by redleader36
Replied by redleader36 on topic Re:Profilebook: Orig Message Quoted in Reply
wow. i guess i am on my own here.

if anybody is interested, i have gotten the script to pass text of the previous message to the page where the reply is sent. i just have to decide if i want to add the text right away in the bbedit box or if i want it to append the original message to the top of the reply in the background so the user can't see it. doing it in the background will be more complicated, i think.

Please Log in or Create an account to join the conversation.

15 years 9 months ago #85236 by redleader36
Replied by redleader36 on topic Re:Profilebook: Orig Message Quoted in Reply
well, i guess i was on my own.

i successfully rewrote the code so that when a user presses reply, they pass the $id of the original message onto the next page. that id [i called it $reid] is passed to the pbSave function where i look up that id in the database and append it to the end of the $postercomment variable before it is written to the database. if anyone wants to see it, here it is:

[code:1] function pbSave($id, $tab, $reid) {
global $my, $database, $_SERVER;
if($reid != null) {
$query="SELECT postercomment"
. "\n FROM #__comprofiler_plug_profilebook"
. "\n WHERE id=".$reid
. "\n ";

$database->setQuery($query);
$retext = "\n\n".$database->loadResult()."";}

$postercomment = $this->_getReqParam("postercomments", null).$retext;
$postername = $this->_getReqParam("postername", null);
$posterlocation = $this->_getReqParam("posterlocation", null);
$posteremail = $this->_getReqParam("posteremail", null);
$posterurl = $this->_getReqParam("posterurl", null);
$posterid = $my->id;
$posterip = $database->getEscaped(implode(",",$this->_get_ip_list()));
$postervote = $this->_getReqParam("postervote", "NULL"«»);
$remessage = $this->_getReqParam("remessage", null);

//print($retext."<br />"«»);
//print($postercomment);

$userConfig = $this->pbGetUserConfig($id);
$autoPublish = strtolower($userConfig->cb_pb_autopublish);
if($autoPublish=='_ue_no') $published=0;
else $published = 1;

$query = "SELECT COUNT(*) FROM #__comprofiler_plug_profilebook WHERE postername='$postername' AND posteremail='$posteremail' AND postercomment='$postercomment' AND posterid='$posterid' AND userid='$id'";
$database->setQuery($query);
$count=$database->loadResult();

if ($count == 0) { // avoid double-posts on clicking reload !
$query = "INSERT INTO #__comprofiler_plug_profilebook SET postername='$postername', posteremail='$posteremail', posterlocation='$posterlocation', postercomment='$postercomment', postervote=$postervote, posterip='$posterip',posterid='$posterid',userid='$id',published='$published',date=NOW(),posterurl='$posterurl'";
$database->setQuery($query);
if (!$database->query()) {
print("<font color=\"red\">pbSave SQL error: " . $database->stderr(true)."</font><br />"«»);
return;
}
$notify = strtolower($userConfig->cb_pb_notifyme);

if($notify=='_ue_yes'){
$cbNotification = new cbNotification();
$res=$cbNotification->sendFromSystem($id,sprintf(_pb_MSGSUB,getLangDefinition($tab->title)),sprintf(_pb_MSGBODY,$postername,getLangDefinition($tab->title)).sprintf($autoPublish?_pb_MSGBODYAUTOAPPROVED:_pb_MSGBODYREVIEWAPPROVE, getLangDefinition($tab->title),$this->_getAbsURLwithParam(array())));

}
}
}[/code:1]
I also had to change alot of code to get the variable to the pbSave function.

Post edited by: redleader36, at: 2009/01/13 23:58

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum