Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

using post.php directly?

Aloittaja Deicist, maaliskuu 15, 2007, 07:36:02 AP

« edellinen - seuraava »

Deicist

I've had a quick search through the forum and can't see anything to help with this, sorry if I've missed it :D

I want to post something to my forum from another part of my site automatically.  Basically, I have a site that tracks file releases.  When a new release is put on the site (via a PHP script) I want to create a new post in a certain board on the forum.  I'm guessing I could do this via a couple of mysql calls (ie: put the information straight into the smf database) but I don't really want to do this for fear of breaking something.  Is there a way of doing this by just calling some of the functions from post.php?  If so, how would I do it?

Cheers for any help you might be able to offer :)

twistedsymphony

I've been trying to integrate a system similar to what you want to do... plus a lot of other features

There are a number of different method you can use

this one here seems to work the best: http://www.simplemachines.org/community/index.php?topic=114026.0

^I've tested and can confirm that script works beautifully.

One thin I would change is the postprep function that trys to strip out all of the html tags for bb code... if the user id you're using to create the post is an admin simply sticking an [ html ] [ /html ] tag on either end of the html formated code will make it display properly.. it doesn't work for any users but admins though (and I think it's a newer function too so it only works in newer versions of SMF)

The other methods...

you can create an html form with "hidden" inputs and post it to http://yoursite/yourforum/index.php?action=post2
view the page source of a new topic screen to get all of the proper input names.
you'll need to include ssi.php at the top of the page with the form and the posting user will need to have already been validated.

the last method is just sending an update directly to the database tables with new post/topic info. This works but you wont get notifications for the post, and having looked at post.php I wouldn't write directly to the dB for fear that I'd break something or leave something with incomplete data.

That first link I sent you is really the best way to go... I wish you luck
my integration is taking exceptionally long because SMF has conflicting functions with my other application. it means I just have to do things in a roundabout way.

Deicist

I managed to get it working using the Createpost function, as described here:

linky

Cheers for the help :)

Advertisement: