Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: subzero_mb on June 09, 2010, 10:20:15 AM

Title: Sending a post to the forum by my own control panel
Post by: subzero_mb on June 09, 2010, 10:20:15 AM
I have a control panel in my website to publish news in the blog, but I would like to send automatically this new also to the forum.
So, I would like to save the post in my personal database (to use in my blog) and to save in SMF databases to show in the forum.
Is there any function where you send title, text, author and ID of the sub-forum and automatically publish it in the forum??
And if it is not, is there any documentation where I can see what tables in the database are modified when a user create a new topic?
Thank you very much
Title: Re: Sending a post to the forum by my own control panel
Post by: Arantor on June 09, 2010, 10:29:02 AM
http://support.simplemachines.org/function_db/index.php?action=view_function;id=323 is the function responsible for creating posts.
Title: Re: Sending a post to the forum by my own control panel
Post by: subzero_mb on June 16, 2010, 02:54:40 PM
Thank you very much, I have dedicate so much time to create my own function to do that and I didn't notice to watch for it in the Source :(
But now, I have my Control Panel, outside of the website and the forum, so how can I call that function in my Control Panel? I just include the Subs-Post.php file inside? I don't think so because there are some globals inside..  :o
Title: Re: Sending a post to the forum by my own control panel
Post by: Kays on June 16, 2010, 03:28:41 PM
You could do that if SSI.php was included. In fact then you could use any of the SMF functions.

You should be able to find examples of how to use createPost if you searched the SMF Coding Discussion (http://www.simplemachines.org/community/index.php?board=60.0) board for it.
Title: Re: Sending a post to the forum by my own control panel
Post by: subzero_mb on June 18, 2010, 07:30:35 PM
Ok, thank you, now everything work properly. Just one question more, when I create the post using the function createPost I would need the topic ID and mesage ID to save then in my own database, but as I can see in the documentation the function just return true or false. Is there any way to get the ID of the post and topic created?
Title: Re: Sending a post to the forum by my own control panel
Post by: Kays on June 18, 2010, 08:24:23 PM
Yes, $topicOptions['id'] and $msgOptions['id'] will have those values.