#1
|
||||
|
||||
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:
PHP Code:
PHP Code:
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:
Change appropriate $pmForm lines as needed. Mine's different, but this is the jist of the two lines changed: PHP Code:
PHP Code:
PHP Code:
__________________
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. |
#2
|
||||
|
||||
Well it is possible, I had the idea before that there would be a quoted text, but couldnt get the formatting done properly. Since Mysidia uses CKEditor now, there may be a solution to this, and I will see what I can do about it.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#3
|
||||
|
||||
Thanks for helping me on aim. I editted the first post to try and explain the solution.
__________________
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. |
#4
|
||||
|
||||
I see, glad you figured it out. Maybe you can post this as a mod or tutoriual, so it will be easier for other users to find. Best of luck. ^^
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#5
|
||||
|
||||
Oohh I was actually wondering about this. Awesome, thanks for sharing Kyttias!
|
#6
|
||||
|
||||
I did encounter an error with this when trying to send a user a PM through their profile (going to user profile and clicking "send user a PM" link), as it tries to create a PM by inserting their username into it, which I believe no longer works since this makes it so PMs are not ID'd but the username?
Not sure, super tired so I'll look into it more tomorrow but I wanted to give y'all a heads-up in case you've not tested it (though I'm aware that link may no longer exist on your site).
__________________
My Mods Site (1.3.4, 2020 Mods) |
#7
|
||||
|
||||
Oh, good point Abronsyth. Links will have to be changed there, too! (Though, yeah, I've removed the link from my user's profiles, I should really add it back in...)
I think that's in classes/class_userprofile.php currently, inside the contactinfo() function. The line begins with this: PHP Code:
Maybe... if the value is not numerical, set the recipient to whatever the value is? (edit: I've tried a lot of things, included is_numeric(), is_int(), and even going so far as !ctype_alpha() but... I seem to maybe be doing something extremely basic wrong??? I can't get this to work.) Thoughts, HoF?
__________________
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 12:10 AM. |
#8
|
||||
|
||||
replace line 178 with:
PHP Code:
__________________
|
#9
|
||||
|
||||
Well, no... the id the file is looking for is the message id of an message being sent as a reply, not a user id.
By default the url is: .../messages/newpmAnd originally the reply button linked to a page with a url like this: .../messages/newpm/Kyttias(A new message is created going to Kyttias, but no information about the old message itself is being sent.) Now, we have it sending the message id number instead so we can extract the message title and text: .../messages/newpm/25(A reply is sent to the sender of message id #25. The message and title of message id #25 are being used to pre-fill reply information.) The profile link still wants to create a new pm to a particular user, so it still tries to sends you here: .../messages/newpm/Kyttias(But this won't work with the modifications we've made, even though it's how it worked previously. If there's a 'get' value (the last end of the url) at all, it's now automatically assuming it's the message id #. The file is trying to figure out what to do with a message id #Kyttias. It's looking for a message id #, not a username, and definitely not a user id. It screams and cries and throws and error.) I'm hoping for a way to detect whether the value is numerical only (it's definitely receiving a message id #, so go through with the new modifications) or not (it's receiving a username instead, so set the message up how it was before the mod). But everything I've tried so far has come up not working. . . . Or, and this could get messy fast, with the reply button url we could add the substring "reply_" before the message id, and on the user profile we could add the substring "user_". We could preg_match to check which substring is prefixed to the get value, and decide what to do based on if that substring exists... but then we also have to then remove that substring we attached before we can continue on. So... messy, but doable. There's got to be a better way, right?
__________________
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 10:22 AM. |
#10
|
||||
|
||||
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:
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. |
|
|
What's New? |
What's Hot? |
What's Popular? |