Print all Posts

Discussion in 'Feedback' started by TIKITRADER, Jun 9, 2012.

  1. 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
     
  2. Joe

    Joe

    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.
     
  3. Thank you for the reply Joe.

    This would be a nice feature to have when it becomes available one day.
     
  4. 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]<br><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.
     
  5. 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>
     
  6. 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
     
  7. TIKITRADER .... Even though it is a very easy mod I don't think Joe or Baron will do it because:

    • Returning 1000's of posts to one page could put too much load on the server.
    • Joe and Baron not interested in coding PHP/MySQL, even though it's easy it does take some time to learn.


    Joe/Baron .... I recommend this book by Larry Ullman. Very good book.

    http://www.amazon.com/PHP-MySQL-Dynamic-Web-Sites/dp/032152599X

    PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide
    [​IMG]
     
  8. diaoptions I do appreciate your knowledge and passing that information along, so I have a better understanding of just what is involved for ET to gather and print all posts from a user.