Immediately ABOVE it (make sure you put it ABOVE the } ) put:
PHP Code:
if ($what=="download") {
if (is_array($privatemessage)) {
header("Content-disposition: filename=messages.txt");
header("Content-type: application/octet-stream");
header("Pragma: no-cache");
header("Expires: 0");
while(list($key,$val)=each($privatemessage)) {
$downloads=$DB_site->query_first("SELECT touserid,fromuserid,dateline,title,message FROM privatemessage WHERE privatemessageid='$key' AND userid=$bbuserinfo[userid]");
$tousername=$DB_site->query_first("SELECT username FROM user WHERE userid='$downloads[touserid]'");
$fromusername=$DB_site->query_first("SELECT username FROM user WHERE userid='$downloads[fromuserid]'");
$msgdt = vbdate($dateformat,$downloads[dateline]);
$msgtm = vbdate($timeformat,$downloads[dateline]);
$wordwrap = wordwrap($downloads[message],75,"\r\n");
Note for Foreign Users: replace the words 'Date/Time Sent', 'From', 'To', 'Subject' in the above code with whatever wording in your language that suits you.
Save file and upload.
2. Edit template privfolder.
Find:
Code:
$massforwardlink
Immediately after OR before it (it does not matter), put:
Code:
or <input type="submit" class="bginput2" name="download" value="Download" style="background-color:#606096;color:#FFF788;font-size:10px;font-weight:bold">
Note for Foreign Users: replace the word "or" and the value "Download" with whatever wording in your language that suits you.
That's it!
Usage: select one or more messages in one of your Private Messages folder and click on "Download". You will be prompted to save messages.txt on your hard drive (a Windows filename & folder selection dialogue will pop up).
Cheers,
Bira
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
I just installed it and when I try to download a pm it just takes me to a web page which contains the private message . How do i change it to the orgional version that prompted you to save it as a tet file?
Okay well since no one wanted to help wittle old me, after reading this thread over again, I did some messing around with private.php and got it working the way I wanted it too. But for some reason the file name to be downloaded is private.php instead of messages.txt...
Fantastic feature to add to the board. Installed it with only the problem of the webpage appearing rather than the download, which I've now fixed with the help of this thread. Well done and thanks.
Originally posted by smelialichu This is a great hack, just one problem though. When i click on download it displays the pm's in my browser and doesn't download it. i use IE 5.01 none of the other people on the board have reported the problem, ideas? I realise the problem is most likely at my end.