View Single Post
  #10  
Old 12-23-2015, 10:50 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 92,049
Kyttias is on a distinguished road
Default

Got it: It wasn't checking if it was a numeric value or not until I applied trim() to it to remove whitespace/linebreaks. I had no idea there were even there until I decided to echo the value to see what was going on.

Inside view/messagesview.php, my newpm() function now looks like this:
PHP Code:
$message = new PrivateMessage
// CHANGES START HERE

$title "(no subject)"// this way it'll never be blank
if($mysidia->input->get("id")){ // if there's an get value
    
$where trim($mysidia->input->get("id")); // trim the value
     
if (!ctype_digit($where)) { // if its not numeric only
        
$user $where// create a message to this user
    
} else if (ctype_digit($where)){ // if it IS numeric only then it's a reply, so pull data        
        
$oldMessage = new PrivateMessage($where); 
        
$js "<script>$('.content h2').text('Reply To Message');</script>"// optional
        
$user $oldMessage->fromuser;            
        
$title "RE: ".$oldMessage->messagetitle;    
        
$msg "› {$user} wrote: ".$oldMessage->messagetext;
    }
}

// CHANGES END HERE
$editor $message->getEditor(); 
Added in some optional javascript in the $js variable that should work if you have jQuery included. It'll change the title of the page to indicate it's a reply page, rather than continue to say its a new message page (assuming you're still using the h2 size for page titles, else change it).

Let me clarify that you should leave the url that sends a PM to a user alone in classes/class_userprofile.php. Keep it as it was - sending a username. Do NOT change it to send a user id.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 12-23-2015 at 11:06 AM.
Reply With Quote