Advertisement:

Author Topic: Any way to Download a Topic or Post to the host or to the user's Download area ?  (Read 2522 times)

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
I thought it might be handy for members to take Topics or Posts offsite for whatever reason.

Like who really owns their posts ?

The last forum I was on before I built mine left 1000's of people feeling that their data was stolen.

I'd like to give people a special option of preserving their posts or entire topics.

How hard would this be to code and would anybody be willing to do it ?

I'm willing to download the unloaded post or topic to people manually and then send via email if that makes them love my forum but my php / sql is still too poor to code it myself.
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
It depends, how would you like to save the post?

The simplest way would be to have the user use the print topic option and have them print to file using their PC. If you want to waste CPU cycles you can do this server side.

If you want to do only the users post and have something more automated it shouldn't be to hard to code. However depending on certain factors this may be a slow query depending on how many post and how far you'd like to go back.

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
Thank you, user's own posts would be the way to go.

My system never gets enough load to slow down.

I'm usually the guy that writes his own software but as an older guy now, I haven't got the patience to do much beyond listing all members etc. with php and sql.

Incorporating it into SMF may be too much work but I'd even settle for a batch php job if anyone has the time.

I could then redirect the output to a file but it should have post headers like Topic and date/time.
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
i wrote this and it works  :):

Code: [Select]
<?php
$servername 
"localhost";
$username "root";
$password "root"// <- modify
$dbname "smf209";

// Create connection
$conn = new mysqli($servername$username$password$dbname);
// Check connection
if ($conn->connect_error) {
    die(
"Connection failed: " $conn->connect_error);
}

//$sql = "SELECT FROM_UNIXTIME( poster_time )
$sql "SELECT *
        FROM  `smf209_messages` WHERE poster_name =  'andrew' ORDER BY id_topic, poster_time"
// <-modify poster_name
$result $conn->query($sql);

if (
$result->num_rows 0) {
    
// output data of each row
    
while($row $result->fetch_assoc()) {
        print 
"<strong>".$row['subject']."</strong> by "$row['poster_name']. "<br/>";
        echo 
"Dated: "date("d/m/Y H:i:s"$row['poster_time']);
        echo 
" "PHP_EOL"<br/>";
        echo 
$row['body']. PHP_EOL"<br/>";
        echo 
" "PHP_EOL"<br/>";
    }
} else {
        echo 
"0 results";
}
$conn->close();
?>

« Last Edit: September 26, 2016, 04:39:17 PM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
... it may run from the web directory, then cut and pasted into a file on your client OS/desktop then finally emailed to the member.

it may be cumbersome and fiddly as it requires command line access to your host but it does the job of saving someone's posts, should they want to leave the site - yes, i'm such a nice guy, i'll even help you pack your bags as you're walking out the door ...  ???

example of the basic output:

Bedroom DJ Here. by andrew
Dated: 16/12/2014 09:25:21
latest re-re-mix is in the reply post.

Re: Bedroom DJ Here. by andrew
Dated: 27/09/2016 04:01:43
second post by andrew

Legalise Phenethylamines ? by andrew
Dated: 16/12/2014 09:40:14
again, the least of all evils.

there are many people who would benefit from tracking their usage because it would shock sense into some of them !

Re: Legalise Phenethylamines ? by andrew
Dated: 24/03/2015 02:49:58
take the money out of it and rethink ...

etc.
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline devilkin

  • Semi-Newbie
  • *
  • Posts: 50
  • Gender: Male
    • k c o r e . o r g
I've created a script that dumps the entire forum: https://github.com/jdeluyck/scripts/tree/master/smf_forums
SMF 1.1.1, located at http://www.aelst.be/smf/

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
thank you, i saved that away if i need it.
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline GigaWatt

  • The Smiley Guy
  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,441
  • Gender: Male
    • Macedonian electronics forum
Me too, will definitely test it out ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Sh@mbles

  • SMF Hero
  • ******
  • Posts: 4,964
  • Gender: Male
    • i30 Owners Club
^ yeah good work devilkin ;)