 |
TIKITRADER
Registered: Nov 2006
Posts: 3145 |
06-09-12 05:15 AM
Is there a way to print all posts from a member ?
I can open a thread and print the thread very easily, but if I visit a posters personal page and open the ' Search for all posts by this user ',
I don't see any way to print the page of posts, or even print/ download all the posts from the User.
Simply I would like to gather posts from Spydertrader, JackH in a quick easy way without saving the entire threads they were active in.
Thanks,
Tiki
|
| |
|
Edit/Delete • Quote • Complain |
Joe
Administrator
Registered: Dec 2004
Posts: 1876 |
06-09-12 01:12 PM
Unfortunatly this is not possible. This is a request that has been made in the past, and something that we are looking forward to providing in the future, but this is currently not possible.
|
| |
|
Edit/Delete • Quote • Complain |
 
diaoptions
Registered: Aug 2011
Posts: 392 |
06-10-12 12:58 AM
A small modification to the php mysql query code can output the posts to a html file, then using the browsers print function print the html page to a pdf file. This mod could be done on it's own page.
Below is a rough example, which may have syntax errors, and the table and row names for the ET database would obviously be different. So it would need some work.
PHP:
<?php
$user_id= "62436";
$output_file = "output.html";
$sql = mysql_query("SELECT posts FROM posts_table WHERE user_id = '$user_id' ORDER BY date");
$fh = fopen($output_file, 'w') or die("can't open file");
fwrite($fh, "<html>\n<body>\n");
while($row = mysql_fetch_array($sql)){
fwrite($fh, "$row[posts]<hr>\n");
}
fwrite($fh, "</body>\n</html>");
fclose($fh);
?>
The code selects all posts from the posts table which matches the user id and orders it by date. It then writes the info row by row to the output.html file, this file in some cases will be huge and you obviously do not want to scroll down it, so you print it to a pdf file using the browsers print function - in my case I use Firefox.
In the while loop you can add other info, such as users name and date of post. The example only includes the post.
|
| |
|
Edit/Delete • Quote • Complain |

diaoptions
Registered: Aug 2011
Posts: 392 |
06-11-12 01:51 AM
This is an update of the code above. The user id is passed through the URL using the PHP GET variable. I'm not sure what sort of load this would put on the server if it returns 1000's of posts, but perhaps ET could charge a small fee.
PHP:
<html>
<body>
<?php
$user_id = (!empty($_GET['user_id'])) ? $_GET['user_id'] : 0;
$sql = mysql_query("SELECT posts FROM posts_table WHERE user_id = '$user_id' ORDER BY date");
while($row = mysql_fetch_array($sql)){
echo "$row[posts]<hr>";
}
?>
</body>
</html>
|
| |
|
Edit/Delete • Quote • Complain |
TIKITRADER
Registered: Nov 2006
Posts: 3145 |
06-12-12 02:22 AM
diaoptions this is very kind of you to contribute your code to ET.
I appreciate your time and valuable post.
Baron and Joe,
Is this something that can be added to make printing user posts a possibility ?
Thanks
|
| |
|
Edit/Delete • Quote • Complain |
| Receive
an email whenever a new post is added to this thread by subscribing
to it. |
|
|
|
|