Private Messages

4 posts / 0 new
Last post
John Flood
Offline
Joined: 29-07-07
Aug 12 2007 18:32
Private Messages

How do I save them is there a default setting?

Joseph Kay's picture
Joseph Kay
Offline
Joined: 14-03-06
Aug 12 2007 19:28

unfortunately you just have to either copy and paste them into a word document or save the webpage to your hard drive (ctrl-S), one at a time. bit of a pain but the module doesn't have a mass save feature at the moment sad

John Flood
Offline
Joined: 29-07-07
Aug 12 2007 19:41

Thanks I can do that so don't be sad eh. It's the not knowing how things work here that can be a bit confusing at first. smile

Felix Frost's picture
Felix Frost
Offline
Joined: 30-12-05
Aug 23 2007 12:09

Here is some code for showing all messages at the same time. I can't guarantee that it will work if you have thousands of messages, though: The script might just time out before everything loads... I made it towards the version of privatemsg.module that I found on your backup site. Hopefully you haven't updated it since.

--- old/modules/privatemsg/privatemsg.module	Tue Aug 21 14:57:00 2007
+++ sites/all/modules/privatemsg/privatemsg.module	Thu Aug 23 13:40:35 2007
@@ -713,6 +714,12 @@
 }
 
 function privatemsg_view($message_id) {
+   
+  //If request to show all messages, use our new function instead. -Felix-
+  if ($message_id < 0) { 
+    return privatemsg_view_all($message_id);
+  }
+
   global $user;
   $result = db_query('SELECT p.id, u.uid, u.name, p.author, p.timestamp, p.subject, p.message, p.newmsg, p.recipient, p.folder, p.format FROM {privatemsg} p, {users} u WHERE (recipient = %d OR author = %d) AND author = u.uid AND id = %d', $user->uid, $user->uid, $message_id);
 
@@ -724,6 +731,24 @@
   return theme('privatemsg_view', $message);
 }
 
+//New function to show all messages. -Felix-
+function privatemsg_view_all($message_id) {
+  global $user;
+  $all_messages = "";
+  if ($message_id == -1) {
+    $result = db_query('SELECT p.id, u.uid, u.name, p.author, p.timestamp, p.subject, p.message, p.newmsg, p.recipient, p.folder, p.format FROM {privatemsg} p, {users} u WHERE recipient = %d AND author = u.uid', $user->uid);
+  }
+  else {
+    $result = db_query('SELECT p.id, u.uid, u.name, p.author, p.timestamp, p.subject, p.message, p.newmsg, p.recipient, p.folder, p.format FROM {privatemsg} p, {users} u WHERE author = %d AND author = u.uid', $user->uid);
+  }
+
+  while ($message = db_fetch_object($result)) {
+    $all_messages .=  theme('privatemsg_view', $message);
+  }
+
+  return $all_messages;
+}
+
 function privatemsg_delete() {
   if (($folder = _privatemsg_delete(arg(2))) !== false) {
     drupal_set_message(t('Message deleted.'));
@@ -898,6 +923,12 @@
         );
   }
   $form[] = array('#type' => 'markup', '#value' => theme('pager', array(), variable_get('privatemsg_per_page', 10)));
+
+  //Make links to new show all messages function. -Felix-
+  $form[] = array(
+      '#type' => 'markup',
+      '#value' => '<br /><b>Show all messages: </b>' .  l('Received', 'privatemsg/view/-1') . ' | ' . l('Sent', 'privatemsg/view/-2') . '<br /><br />'
+      );
 
   if (count($messages) > 0) {
     $form['delete_messages'] = array(