Subzero-mb Posted June 1, 2015 Share Posted June 1, 2015 Now I am testing IPS4 I want to include some of the functions I used in my website with IPS3. One of them is the possibility to create a new topic outside of IPS suite. With IPS3 was very easy, you just call the topic posting library and give the title, author and message of the topic...$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php', 'classPost', 'forums' ); $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' ); $this->post = new $classToLoad( $this->registry ); $this->post->setBypassPermissionCheck( true ); $this->post->setIsAjax( true ); $this->post->setPublished( true ); $this->post->setTopicID( 123 ); $this->post->setForumID( 2 ); $this->post->setForumData( $this->registry->class_forums->getForumById( 2 ) ); $this->post->setAuthor( IPSMember::load( 1 ) ); $this->post->setPostContentPreFormatted( "This is the post" ); $post = $this->post->getPostData();Now with IPS4 I have not seen yet any documentation related to post in the forum from an external site, so maybe someone can give me an advice about how can I start with this because right now I am lost. WIth an advice it will be more than enough, I am not waiting for someone who make all the job for me but just some information. Many thanks! Link to comment Share on other sites More sharing options...
Kevin Carwile Posted June 1, 2015 Share Posted June 1, 2015 Link to comment Share on other sites More sharing options...
Subzero-mb Posted June 1, 2015 Author Share Posted June 1, 2015 I cannot see anything @Kevin Carwile Can you post it again? Link to comment Share on other sites More sharing options...
Ahmad E. Posted June 1, 2015 Share Posted June 1, 2015 I cannot see anything @Kevin Carwile Can you post it again? It's because the topic he linked to is in the contributer section. I will quote the relevant post for you $title = "Something Something"; $content = "<p>We aint gonna take it!</p>"; $member = \IPS\Member::load( $member_id ); $forum = \IPS\forums\Forum::load( $forum_id ); $topic = \IPS\forums\Topic::createItem( $member, $member->ip_address, \IPS\DateTime::ts( time() ), $forum ); $topic->title = $title; $topic->save(); $post = \IPS\forums\Topic\Post::create( $topic, $content, TRUE, NULL, TRUE, $member, \IPS\DateTime::ts( time() ) ); $topic->topic_firstpost = $post->pid; $topic->save(); thanks everyone, this seems to effectively reproduce the "posting" function from 3.x Link to comment Share on other sites More sharing options...
Subzero-mb Posted June 2, 2015 Author Share Posted June 2, 2015 Thank you so much @Ahmad El-Oukly! I will try the code later but it looks like I need Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.