Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-22-2015, 03:37 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 91,578
Kyttias is on a distinguished road
Default Is this possible?

When replying to a user's PM, I'd like to place a copy of the title and text from the original message into the new PM.

In view/messagesview.php it already detects if you're replying to a user (rather than making a new PM) by use of this:
PHP Code:
if($mysidia->input->get("id")) $user $mysidia->input->get("id"); 
I was able to take that a step further, made it this:
PHP Code:
if($mysidia->input->get("id")) {
    
$user $mysidia->input->get("id");
    
$re "RE: ";

And a few lines down, I modified the where the title appears to include "RE: " before the title if new the recipient as such.
PHP Code:
$pmForm->add(new TextField("mtitle"$re."(no subject)"50)); 
Okay, cool. That works - "RE: " only appears while I'm replying, because it knows the recipient when the page loads.

But that's also not a copy of the title I'm replying to, either, it's just a placeholder title (I added it in so people wouldn't get errors while attempting to send messages with no subject lines).

So... if $user equals a 'get' value of id, is that because that's how the url is being rewritten? Where's that the rewrite happening (because its not part of the htaccess)? If values containing the original message (and title) are already being sent, what're they called? Do I need to explicitly send these values, if they're not already being sent? (Because I don't mind jabbing at the message on the page with some javascript and attaching it to the url the reply button goes to if I have to. But do I have to?)



EDIT - Discussed this on aim with HoF. The solution was to send the message's actual id (not the username) and use the PrivateMessage object to pull data from the id that had the user name, title, and message contents.

In view/messagesview.php, inside the newpm() function, I changed the contents of the if statement mentioned above to now contain the data I asked for (EDIT 2 - this has been updated to reflect issues discussed later in the thread):
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(); 
Try styling $msg up a bit, if you like, but test that it sends properly. It took me some effort to get this to look nice. I don't actually use the CKEditor so I don't know if adding in raw html will help you. (It helped me.)

Change appropriate $pmForm lines as needed. Mine's different, but this is the jist of the two lines changed:
PHP Code:
/* title line: */
$pmForm->add(new TextField("mtitle"$title50)); 
/* editor line: */
$pmForm->add(new Comment($editor->editor("mtext"$msg))); 
But I need to send that data, so in classes/class_privatemessage.php, in the getMessage() function, change
PHP Code:
<a href='../../messages/newpm/{$this->fromuser}'
to
PHP Code:
<a href='../../messages/newpm/{$this->mid}'
And that'll pretty much do it. I did some other things, of course, but in case anyone's wondering for future reference.
__________________
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:00 AM.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:24 PM.

Currently Active Users: 770 (0 members and 770 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636