News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Any way to Download a Topic or Post to the host or to the user's Download area ?

Started by aegersz, September 20, 2016, 10:02:24 PM

Previous topic - Next topic

aegersz

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 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

nend

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.

aegersz

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 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

i wrote this and it works  :):

<?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();
?>

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

... 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 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here


aegersz

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

GigaWatt

"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?"..."


Advertisement: